• 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

Forward Problem in Struts

 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I am developing an application using Struts.
I have problem when I want to forward my process from one dispatch action to another dispatch action.

I have mypage.jsp, MyForm.java, MyFirstDispatchAction.java and MySecondDispatchAction.java
When user clicks on submit button on mypage.jsp, all properties inside html:form will be copied into MyForm.java by Struts Framework and after that send request to MyFirstDispatchAction.java.
The code of MyFirstDispatchAction.java and MySecondDispatchAction.java like :

My struts-config.xml likes :

And the problem is when I print the values of form..
I cannot get the new values which is inserted or updated in MyFirstDispatchAction...
I always get the values which are same with the value from mypage.jsp
Why does it happen? Are there something wrong with my process?

Correct me if I am wrong...

thank you very much
daniel
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

//method in MyFirstDispatchAction
public ActionForward show(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
//some code here
MyForm frm = (MyForm) form;

//I update some values in MyForm

// I forward to MySecondDispatchAction
mapping.findForward("mySecondDispatchAction");
}



In this code above, you have to store frm value( with same name as referenced in your next form tag name) in request after you update it.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be as simple as a missing return statement? You have to return the mapping.findForward bit from the execute function
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic