Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Redirect by button

Ivan Babanin

2007-03-26


Hi All!

I have a simple button. It may be <html:button /> or <html:submit />.
If user click this button it will redirect to page /add.jsp. So how
can i do this? At this time i know only one way..
1) Create Action
2) Create ActionBean
3) Write in struct-config.xml such thing:

<struts-config>
  <form-beans>
    <form-bean name="RedirectActionBean" type="ru.RedirectActionBean"/>
  </form-beans>
 
  <global-exceptions>
  </global-exceptions>

  <global-forwards>
  </global-forwards>

  <action-mappings>
    <action input="/list.jsp" name="RedirectActionBean"
    path="/addNewPerson" scope="request" type="ru.RedirectPersonAction">
       <forward name="successDelete" path="/add.jsp"/>
    </action>
  </action-mappings>

</struts-config>
4) Write such form:
<html:form action="/addNewPerson" method="POST">
      <html:button value="Add"/>
</html:form>

But it is bad way. Please advice me a good way? Thank you.

---
One must be something in order to do something. (Johann Wolfgang von Goethe)
by SkyStar.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.