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 how to define functionality for 2 buttons in an action form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to define functionality for 2 buttons in an action form" Watch "how to define functionality for 2 buttons in an action form" New topic
Author

how to define functionality for 2 buttons in an action form

Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey guys i want to ask lets i have 2 buttons

1) Add
2) Delete on my jsp page

then how do i define my fnctionality for both of them in my page

please tell me

thank you
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

<action name="uploadColorLogosEdit" class="com.javaranch.cms.ColorLogos" method="load">
<action name="uploadColorLogosEdit" class="com.javaranch.cms.ColorLogos" method="upDate">

Here we are calling the different method's depending on user request. Provide these methods in action class it will execute that method directly.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks for your reply but how can we define in this way

in struts we define it as <form action=".do" method=post>

so how can we do it here
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

The above process is applicable for struts2 and we achieve this using dynamic method invocation also. I'm not sure about struts1.x.
Sriram Ture
Greenhorn

Joined: Aug 20, 2010
Posts: 23
In struts 1.x, the DispatchAction class should be used to achieve the action based method invocation.

In action tag of config xml you can define an attribute 'method' and this will decide the method to be invoked. The value for this attribute is passed on from the button click.


Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to define functionality for 2 buttons in an action form
 
Similar Threads
do I have to use javascript to put multiple buttons on one JSP page ?
Customizable buttons( see attached image) spring MVC
how to remove max/restore options from portlet
intermediate submit and validation of a form
radio button in struts 2