Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Struts 2 addActionError problem

 
Ranch Hand
Posts: 38
  • 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
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • 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.
 
Ranch Hand
Posts: 349
  • 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
  • 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
  • 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
  • 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
 
    Bookmark Topic Watch Topic
  • New Topic