HI, I have a form with 3 buttons on my jsp. in struts config i have put the <forward name="validate" path"/validatefile"/>
validatefile path is to go to another action-jsp. is something wrong? the name is name of button on jsp. In actionclass i have just execute method. when user clicks on button1 how do we take him to another jsp?
you need an html:form tag with an attribute action="yourActionPath" or alternately an html:link with an attribute action="yourActionPath"
the action path should take your program to an action class where processing is done then after that action class returns a value which determines what jsp or page definition you go to next (these are the forward tags nested inside the action tags in the struts-config file).
This pretty fundamental to the way struts works, form/link submission -> action class -> page/jsp(with forms/links) -> action. Just all the parts represented by -> are maintained inside the struts-config.
I'd recommend spending 2-3 hours just reading a book/website.
ok. Do i need to put any code for each button in action class? Or just forward tag in struts will take name of button and path to the action or jsp i mention. I have got it until here, however i am not sure if i need to add code to hnadle each button in actionclass.
page 1 has 3 buttons, each should go to different paths(action-form-jsp)
can you please tell me more about button names and forward action if i have to write in struts-config.
Example: I have 3 buttons each are submit type and if I have different names for them. How do we generally wrtie this code to mention these buttons with struts tags and html:link ? can I do this way mentioning in struts-config.
Do we generally write any methods inside action class to foward the buttons to another path?