Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interceptor issue in Struts 2

 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a struts2 application, where I am using different workflows to understand different things. Currently, my index jsp has 2 forms, each associated with a separate action. One of them takes a name and prints the String "Hello+name" on the success page. The other one takes a name and a password, and if the values match a hard-coded pair of values, it shows a success page, else it reverts user back to the index page (I am testing interceptor for validation in this workflow). The struts.xml file is like this



Now, in the first action tag, I have not used any interceptor; yet the name gets transferred to my UserGreetingsPage.jsp automatically. Which means the params interceptor is called by default. In the second case..however, when I mentioned the workflow interceptor, I noticed that the params interceptor was not getting called automatically; because the values were not getting transferred.

My question is :
In Struts 2, the params interceptor will be called by default, but only if there is no mention of any other interceptor. If, however, any other interceptor is mentioned, then params also has to be called explicitly. Is my understanding correct?
 
Jesus Mireles
Ranch Hand
Posts: 122
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have the right idea. By default the defaultStack is used. If you look at struts2 core jar you'll find a struts-default.xml where the defaultStack is defined, which is this:



 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jesus, for helping me clear my doubt

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic