File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Display a Form on a button click using struts tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Display a Form on a button click using struts tags" Watch "Display a Form on a button click using struts tags" New topic
Author

Display a Form on a button click using struts tags

Vidya Gupta
Ranch Hand

Joined: Mar 18, 2012
Posts: 96
Hi,

I am having a small doubt , that is in my page am having 3 buttons and i want to display a different form when i click on each button. I want to do this by single jsp. Am having a little bit confusion in doing this.

<table align="left" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<input type="button" value="button1" onclick="action"/>
<input type="button" value="button2" onclick="action"/>
<input type="button" value="button3" onclick="action"/>
<input type="button" value="button4" onclick="action"/>
</td>
</tr>
</table>

Here for each button it is going to different action methods, in that action method i am writing "return mapping.findForward("") " statement. This statement will forward the action to the same jsp again that contains buttons. Now i want to create a form on button click in the same jsp. am little bit confused that where to write the code to create a form in theis jsp..


Thanks In Advance,
Vidya
Yogesh Lonkar
Ranch Hand

Joined: Jul 17, 2012
Posts: 94

from what ever i understood you want to display a form respected to the button clicked by user.
you can add this to your JSP


and inside your struts.xml file



inside your action class


Learning some thing New Every Day
Vidya Gupta
Ranch Hand

Joined: Mar 18, 2012
Posts: 96

No.. i don't want to use multiple form:acion attributes in jsp..

My JSP looks like below,

display.jsp
-------------




 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display a Form on a button click using struts tags
 
Similar Threads
How to Change path of JSP from script
how to hide and show iframe withen form ?
problem with Visibility of a frame after actionPerformed
Interupting a submit button call
Adding rows to Jtable