Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 reditect to same URL

 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am developing a web app using struts 2.

I have a module where the admin can add categories which are unique.

Assuming there are four categories - "bike","car","truck" and "bus".

Suppose the admin tries the to edit the category "bus" and tries to give the name "car" which already exists.

In that case, i want the user to redirect to the same url and show the error message.

is there any simple way in struts to redirect the user to the same URL from where the request came or i have to dynamically create the URL like "editCategory.action?catID=3"?
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your action declaration, just include an additional result element of type "input". In the action code, if you notice validation errors on the input values, just return Action.INPUT ("input") and the framework will forward to the input page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic