File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts 2 addActionError problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 addActionError problem" Watch "Struts 2 addActionError problem" New topic
Author

Struts 2 addActionError problem

shashi wagh
Ranch Hand

Joined: Oct 30, 2008
Posts: 38
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

Joined: Sep 07, 2008
Posts: 689

HI..

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

Thanks,
Nishan Patel.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
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

Joined: Oct 30, 2008
Posts: 38
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

Joined: Aug 29, 2008
Posts: 349
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

Joined: Oct 30, 2008
Posts: 38
Hi Tom, Thnaks for replya

Didn't get U but I have the My interceptor like This
 
 
subject: Struts 2 addActionError problem