• 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

Display a Form on a button click using struts tags

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 94
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Vidya Gupta
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

My JSP looks like below,

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




 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic