File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 addActionError problem

 
shashi wagh
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my struts 2 application when I set any action error in interceptor Like this

ValidationAware action = (ValidationAware)invocation.getAction();
action.getActionErrors().clear();
action.addActionError( errorMsg );

for next onward All request goes to Input result and not for searches for success or even not goes into Action class


I m using Struts 2, Tiles
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI..

I am not sure about this but you can invoke addAction error in Action class and set error message there.

Thanks,
Nishan Patel.
 
Tom Rispoli
Ranch Hand
Posts: 349
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by this:


for next onward All request goes to Input result and not for searches for success or even not goes into Action class


Since you're saying you aren't getting to your action class I'm wondering if you are not calling invocation.invoke(); or are calling it conditionaly.
 
shashi wagh
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Steps I m folloeing
1. When first time I hit Login page
(It does not thro' inteceptor direct action class) it works fine.
2. For validating user I have written Interceptor. If invalid login then I am setting actionError message and redirect to Login page with action error. It also works fine.
3. But after I set action error If any other user tries to login page It does not hit my action class and Looks for result name=input in my struts.xml file



Even I m setting actionError in Action facing the same problem.
 
Tom Rispoli
Ranch Hand
Posts: 349
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have any class level data members definded for your interceptor? Seeing the code for the interceptor might help. particulary how it decides if it should return a result itself or continue on to the next interceptor.
 
shashi wagh
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom, Thnaks for replya

Didn't get U but I have the My interceptor like This
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic