File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
dhaval tamboli
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.




 
chris locke
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can the action attribute prevent the buttons from being on different rows?
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic