request.getAttribute("the name you have used in servlet class");
Eg:
In servlet class
Boolean flag=true;
In servlet class request.setAttribute("sessVariable", flag);
In JSP page;
Boolean value = (Boolean)request.getAttribute("sessVariable");
NOTE: whater type of Object you have set to request, while retrieving you have to do the casting of same type. otherwise, you will be getting ClassCastException.
Hope this will resolve you problem.
Thanks
Prasanna M
santosh kimothi
Ranch Hand
Joined: Jun 10, 2009
Posts: 32
posted
0
thanks for your quick reply...... but my problem is still there..
i will specify my problem in detail...
i am having a servlet class as follows.... where i am saving the list(java.util.List) of records retrieved from db in a request scope...........
but it is showing the following error message....
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /StudentDetails.jsp(3,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
Ramkumar Subburaj
Ranch Hand
Joined: Sep 07, 2007
Posts: 83
posted
0
in your tld file set rtexprvalueto true.
SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
and you're accessing the attribute this way in your EL:
Excuse-me if I'm being ignorant, but shouldn't you actually need to use the value stored in the StudentConstants.STUDENT_LIST constant to retrieve the request attribute from the EL statement?
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
posted
0
The problem lies in here
Please remove the ) character in the EL expression. And why do you need this value to be set in there ? (You can do away with this line of code).
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: how to get the value saved in request scope in a servlet into a jsp page