• 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

how to add 2 submit buttons of different form actions in same row in jsp page in struts2

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to put 2 submit buttons in same form and they both calls different actions from struts.xml
My problem is I want to put that buttons in same row. but, I am not able to do that.

my code is



I tried many ways to put in same row but as such they both belongs to different actions, I am not able to put in same row.
Let me know if any of you have idea to accomplish it

Thanks,
Dhaval
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use simple theme with both forms, that way Struts won't generate any tables so you can have both buttons in the same row. More info on themes can be found here...
 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

first of all let me tell you about this form. This form fetches agency information from database and we can edit information from here and also it shows users of this agency through another submit button.

Here I tried to use simple theme but still it gives me button at different rows.

Here is the whole code.




 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm running into the same problem as well. Does anyone have a solution to this?

Is there maybe another way of invoking an action via a button without using the <s:form> tag?
 
Ranch Hand
Posts: 182
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chris locke wrote:Is there maybe another way of invoking an action via a button without using the <s:form> tag?


Yup. Using action attribute. Have you tried this.
 
chris locke
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can the action attribute prevent the buttons from being on different rows?
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chris locke wrote:How can the action attribute prevent the buttons from being on different rows?


As 'Ankit Garg' said use simple theme for this issue. Use action attribute of submit button for calling different actions from same form.
 
chris locke
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I tried the simple theme as was originally suggested back on August 10...I wouldn't have responded to this thread otherwise. The issue is that when adding 'theme="simple"' to the form tag, tables are no longer generated but that still won't bring the buttons into the same row.
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chris locke wrote:The issue is that when adding 'theme="simple"' to the form tag, tables are no longer generated but that still won't bring the buttons into the same row.

Can you please post your code
 
chris locke
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chris locke wrote:

Main question is usign two buttons in a form, which are supposed to call different actions.

For this using two different forms are NOT an solution.

use one form with theme as 'simple' and keep two buttons inside the same form and use the action attribute of those buttons to call respective actions.
 
chris locke
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm.. Okay, I found another example on google which supported the original code (2 forms) with a simple theme, but it had as an addendum that you must manipulate the css stylesheet to incorporate the generated ID and add the line "display: inline;"

I tried it out and found that it works, but I like your way better. Thank you
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic