• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Call a forward or a redirect inside an interceptor

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

Is there a way using the struts 2 API to forward or redirect to a url
inside an interceptor instead of making a actionInvocation.invoke()?

Any one please help me how to do this?

Thanks,
Kalyan G.

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You *could* just do a forward or redirect. But if you're hitting something within your application it'd be much, much cleaner to just return a result name.
 
kalyan narra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply David, Yes you are right but my interceptors not every time call the forward Action. Based on users request it should dynamically knows that is this request should be forward to action or it should be normal invoke..

currently i am return the invocation.invoke(); how can i do it dinamically?

Please let me know your thoughts for the same.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Return the name of a result? I don't really know what you're asking.
 
kalyan narra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What my requirement is that.. I have written one Interceptor and this works normally like for each and every request its get the data form session and check with DB and based on users request it should go to that particular action class and execute normally.

Currently what I am going to change this interceptor like in that session details matches with DB details then I need to directly forward that user to his account page.. if the session data not matches with DB then I will do the normal process same as above..

For this how can I do this dynamically? And in this interceptor I will get the user account path form db.. so I need to forward that user to his account path.

So could you please help me how can I forward action inside my interceptor?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is "his account path"? Is it a path inside the application? An action? Does it require parameters? TellTheDetails.
 
kalyan narra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes is the path inside the application, and the path contains parameters also but i was get those parameters from the session. just i need to forward that path.. it look like "http://localhost:8080/test/ContractDetails.action?contract.contractId=188&contractId=188".

if the user is valid then i need to forwad to this action.

please help me how do i do it?
 
Quick! Before anybody notices! Cover it up with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic