wood burning stoves 2.0*
The moose likes Struts and the fly likes Interceptors in Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Interceptors in Struts2" Watch "Interceptors in Struts2" New topic
Author

Interceptors in Struts2

Naga Niranjan
Greenhorn

Joined: Aug 02, 2005
Posts: 25
Hi,

I want to set an attribute in an interceptor with the scope of request to access that in JSP. The follwing code I have used, but that attribute is not getting in JSP.

Interceptor code:

In the above code permissionsList is fetching from a Map, which is in application scope.

JSP code:


Expecting suggestions in this regard.

Niranjan
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Should work, but without the rest of the interceptor code it's hard to say. Is it available in an action?
Naga Niranjan
Greenhorn

Joined: Aug 02, 2005
Posts: 25
It is not available in Action class. The remaining code in that interceptor is checking the session whether it is active or not.
To overcome this problem, temporarly I have used scriplet in JSP as I cannot find any solution yet.

Niranjan.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Like I said, should work, but without interceptor code and your configuration I can't really help.

This is *never* appropriate for a scriptlet, though; better to use a Preparable action and get it to the JSP in the action.

(The JSP page is hit through an action, right?)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interceptors in Struts2
 
Similar Threads
doubt in page 356 of HFSJ
Populating value in managed bean
struts2 login interceptor not finding session attribute of user details.
setting attribute using EL
Struts2 - <s:iterator> in two-Dimensional Array.