Access Servlet Session Attribute Using JSTL
Posted by tech on
June 23, 2009
|
|
In Java this piece of code, request.getSession().getAttribute(“my_var”) can be accessed using JSTL with the sessionScope keyword. To access my_var, call sessionScope.myvar.
Remember to use sessionScope because if your Java code looks like this: request.getAttribute(“my_var”) will not work. See sample JSTL code below.
1 | <c:out value="${sessionScope.my_var}"/> |
tags: attribute, servlet, session
No Comments
Using Java Servlet Filter In Tomcat’s j_security_check
Posted by tech on
June 3, 2009
|
|
When using Apache Tomcat as the Servlet container server for your Servlet needs, sooner or later you will come across a situation where you need to do something before and after you login using j_security_check. The solution is to use Servlet filters so that every request will pass through these filters. But using it for j_security_check? The answer is? NO. You cannot do this in Tomcat. While I did read in some articles that IBM Websphere will let you do this, in Apache Tomcat there is just no way. You can try some other workaround that uses the Servlet Filter class to do what you want it to do.
Found this post useful? Buy me a cup of coffee or subscribe to my RSS feeds and Google Friend Connect






