salil verma

Greenhorn
+ Follow
since Jun 03, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by salil verma

The session id is sent throught cookie. This may be the case that the cookie might be existing even after the closing the web browser.
you can do two things for this --
1- Clear the cookies .
2- if you want your application make in such a way as it does not allow to sign in again automatically. while processing the jsp take the JSESSION_ID cookie and setMaxAge(-10).
In this case cookie will automatically deleted as soon as the browser is closed .

You will get the desired result
18 years ago
I wanted to mention that the user wanted to have two instances of the bean with the same attribte name .That is why, the user created one at request scope and other a page scope.
kindly refer to the followin code for to get what exactly i want to mention. I am refering to the attribute name "bean_name".


just see at the end of page 349 it is mentioned that user want one more instance of same name of same bean but want to set the properly again.
So in the second senario we have changed the scope of the bean . In this case two instances of the same bean will exist one at request scope and the second at page scope.
In error page exception object becomes available only in case when the
<%@ page isErrorPage="true"%> tag is defined. (Tested with websphere server)
If this is available even without using this tag, this may be special feature of tomcat
I was testing the approach of tag file ..

I made the following tag file (Tagtest.tag)
<h1> this is from tag file </h1>

and following tld file (Tagtest.tld)
<?xml version="1.0" encoding="UTF-8"?>
<taglib>
<tlib-version>1.0</tlib-version>
<uri>MyVersion</uri>

<tag-file>
<name>NameOfTagFile</name>
<path>/WEB-INF/tags</path>
</tag-file>
</taglib>


added the following entry in web.xml file
<taglib>
<taglib-uri>MyVersion</taglib-uri>
<taglib-location>/WEB-INF/Tagtld.tld</taglib-location>
</taglib>

and used the follwing code as a jsp file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="c" uri="MyVersion"%>
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>Tagjsp.jsp</TITLE>
</HEAD>
<BODY>
<P> About to include the content from the tag file </P>
<c:NameOfTagFile/>
</BODY>
</HTML>

but when i try to run the jsp file i get the follwing error message
"Unable to locate tag library for uri MyVersion"

I have put the tag file in /WEB-INF/tags and tld file in /WEB-INF directory.I am using websphere server as environment. using jsp 2.4 environment.
Can any one help me resolve this problem.
getRequestDispatcher() and getNamedDispatcher() can be used for servlet as well as for jsp file. The only difference is that in case of getRequestDispatcher() we use uri. while in case of getNamedDispatcher() we use value defined in <servlet-name> tag in web.xml file for that particular entry.
when i try the follwoing code in the error page it runs fine.





but when i add the following section in the <body> </body> tag

<!---
<br>
now trying thwough EL</br>

<c ut value=requestScope["javax.servlet.error.message"]>
</c ut>
-->


The page is not taken as error page. and displays the error message .The total section is HTML commnet the why m i gettin such an error?

Can any body help me out regarding this.
vivek, you can see the same by executing the following code

yup yup
If we don't specify <http-method> ,all the methods will be constrained . No one with any role will be able to access any of the http methods.
including admin also.
In HFSJ book in the mock question i found the code -

<jsp eclaration xmlns:jsp="http://java.sun.com/JSP/Page">
int x=0;
</jsp eclaration>

can any one suggest, what does "xmlns:jsp="http://java.sun.com/JSP/Page" refer and what is the need of it ?
Client can not access any of the resources existing in WEB-INF directory. So only put those jsp files of resources to which you want to use in the application but do not want to let the client use it directly.
Client can not access any of the resources existing in WEB-INF
hi
I saw in j2ee docs but could not find the attributes with name

javax.servlet.forward.request_uri
javax.servlet.forward.context_path
javax.servlet.forward.servlet_path
javax.servlet.forward.path_info
javax.servlet.forward.query_string

can you let me know, where it might be available in j2ee docs
just check out this code this may be helpful to understand the thing

Test1.jsp
------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>Test1.jsp</TITLE>
</HEAD>
<BODY>
<jsp:include page="Test.jspf">
<jsp aram name="test" value="First Paramter" />
<jsp aram name="second" value="Second Paramter"/>
</jsp:include>
</BODY>
</HTML>


Test.jsp
-----------------------------------------------------------------
<p> The first parameter is ${param.test} </p>
<p>The second parameter is ${param.second}</p>


<jsp:include page="test2.jsp"/>



Test2.jsp
----------------------------------------------------------------------
<p> I am in test 2 </p>





Now if you execute the file test1 you will get the expected result . But just change the extension of Test.jsp to Test.jspf. Then try to execute the same.

You will find , while changing the extension of test.jsp to jspf the scripts are the executed. That is the thing they have mentioned in the paragraf.
The class declaration of javax.servlet.GenericServlet is

public abstract class GenericServlet
extends java.lang.Object
implements Servlet, ServletConfig, java.io.Serializable

you can understand the same that i wanted to express