• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interceptors in Struts2

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should work, but without the rest of the interceptor code it's hard to say. Is it available in an action?
 
Naga Niranjan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?)
reply
    Bookmark Topic Watch Topic
  • New Topic