• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2: losing form objects through interceptor

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have implemented a simple interceptor but when I use it the values I expect to be in my action class ( they are there when I don't use the in interceptor ) are gone.

So basically the interceptor drops the values I expect in the action

Is there something I have to declare?

thanks
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What was your interceptor stack initially and what did you change it to to run your interceptor. Posting the before and after of your interceptor stack and the code for your interceptor might help.
 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I never atually put a interceptor stack in until now. then i put in
<interceptor name="login" class="com.forum.intercetor.UserInterceptor"/>

<interceptor-stack name="football">
<interceptor-ref name="login" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="football" />

I would assume that I am overriding something that was there previously.

The interceptor gets called OK but when i hit my action the objects that i expect to be there is null.
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you use your own stack you override the default stack. I think what you are missing in your stack is:

<interceptor-ref name="params"/>

I think that interceptor populates the action class.

Since you maybe be excluding other interceptors that you need, if you do this you'll run all of your default intercetors as well as your new one:

<interceptor-stack name="football">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="login" />
</interceptor-stack>

I started like this and then tried copying the individual interceptors from the defualt stack and removed them one at a time so I could avoid using processing time on the ones I didn't need. It was tedious, but now I'm only using 5 of them (params is one of them).
 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that worked.

My first attempt failled because I put the params interceptor below my one, doh.

Thanks for the help. Know a lot more about this stuff than i did before.
reply
    Bookmark Topic Watch Topic
  • New Topic