Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PROB: Chaining Interceptor - Struts 2

 
Pranay Karmakar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've tried the following,

I've a welcome page which has 2 text fields name i1 & i2. The action name is "action1" which moving to action2 in case of success. The success page of action2 is result.jsp where I don't want to see the excluded value by Chaining Interceptor. The Code is as follows:

index.jsp



Class1.java


Class2.java


result.jsp


struts.xml



After the above coding, both the i1 & i2 are visible on Result page. I want 'i1' to be excluded.

Please help.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, see the chain interceptor docs.

Defining both includes and excludes leads to undefined behavior. And you seem to be passing in essentially random maps for those--so secondly, check your logs, because there will be an exception there. It's like you're trying to combine the "alias" interceptor or something.

In any case... action chaining is almost always a Bad Idea.
 
Pranay Karmakar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David.

I've rectified my code above. Please check.

The link http://struts.apache.org/2.1.8/docs/chaining-interceptor.html is very brief and not having example with "include" or "exclude"

Could you please let me know that how to write the <param> tags with "include" or "exclude" and with some variable names in the struts.xml file.

I may not use it in my application but I want to learn this Chaining Interceptor practically.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic