• 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

Struts2 parameters is coming null in action class when using Interceptors

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

When I am using Interceptors, the values on Action class coming as null. I have removed the Interceptors, the values coming perfect from the JSP page.

Login.jsp



LoginAction.java

web.xml


struts.xml (working version)



struts.xml (Notworking version )


AuthenticationInterceptor.java


Logs statements (both cases)



Any suggestions?
 
Santhosh Kalisamy
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fixed this issue by including default Interceptors.



struts.xml


Hope this helps, you all.
 
Greenhorn
Posts: 12
Eclipse IDE Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Struts 2.3.15 still the same issue.
Your workaround works fine. Thanks Santhosh!!!
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alessandro Gentile wrote:With Struts 2.3.15 still the same issue.



This is not an "issue". This is how Struts works. The ParametersInterceptor places the request parameters on the Value Stack and the ActionMappingParametersInterceptor sets the values on the Action. If you do not have these interceptors in your stack, the values in your action will be null.
It is a good idea to read the Interceptor documentation before changing interceptor stack or you can have other side effects as well.
 
Alessandro Gentile
Greenhorn
Posts: 12
Eclipse IDE Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe, I've just made a fool of myself!!
I was misled by the previous post where this whole matter is presented as an "issue".
I confess my utter ignorance. Struts2 has a steep learning curve, there's a lot to read!
Thanks for your advice!!!
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No worries. Once you get the hang of it, it is pretty slick how you can drop in Interceptors to modify how Struts works, but yea, just starting out it's pretty strange.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic