wood burning stoves 2.0*
The moose likes Struts and the fly likes click on button-->save data-->go to another page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "click on button-->save data-->go to another page?" Watch "click on button-->save data-->go to another page?" New topic
Author

click on button-->save data-->go to another page?

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Hi,
If I have a go button like this:
<html:submit><bean:message
key="button.go"/><html:submit>
once I click on this button on sample1.jsp, I want to save some data to
database, then go to another jsp page sample2.jsp. I definne
an action class to handle data saving.
Thus, once user clicks on go button, user should be directed to
the data saving action class first to save data, then go to
sample.jsp page. In struts-config, I define mapping as the following:
<action path="/saveData.do"
type="SaveDataAction"
input="/sample.jsp"
name="saveDataForm"
......
<forward
name="sample2"
path="/sample2.jsp"
</action>
Will that work?
And I am not sure how I can make "go" button go to action class first and save data, then go to sample12.jsp?

regards,
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4456
    
    6

Will that work?

It should.

And I am not sure how I can make "go" button go to action class first and save data, then go to sample12.jsp?

The action to which the request will be submitted is specified in your html:form tag, i.e. <html:form action="/saveData.do">. Is this not the case then?
[ September 08, 2003: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Thanks,
Its not the case. sample1.jsp has its own action class (LoadValuesAction) for loading values.
Then, once "go" button is clicked, user will be directed to SaveDataAction to
save data, and next to sample2.jsp page.
regards,

Originally posted by Junilu Lacar:

The action to which the request will be submitted is specified in your html:form tag, i.e. <html:form action="/saveData.do">. Is this not the case then?
[ September 08, 2003: Message edited by: Junilu Lacar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: click on button-->save data-->go to another page?