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 using same name for many buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using same name for many buttons" Watch "using same name for many buttons" New topic
Author

using same name for many buttons

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

Hi,

my application/module contains 5 jsps running in struts and in which i have around 10 buttons. i declared only one variable in formbean and used same name for most of the buttons. will it create any problemin real time using by client?.

I do not want to create getters and setters for each and every button.. so i have done like this.

regards,

rahul.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It's fine to use the same property for multiple buttons. When the form is submitted, whatever is in the value attrubute of the <html:submit> tag will populate the property, so make sure you specify a different value for each button.


Merrill
Consultant, Sima Solutions
Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

thank you very much for the prompt reply.

the module i am working on contains 5 jsp pages and all of them have next and back buttons and i have to use the same value name in order to show the name required according to the usertrequirement.

[ means, if first contains next, cancel buttons i have to use same names and my second jsp contais all three next, back, cancel and so on]
for cancel i used <html:cancel/><html:submit for both next and back in all pages>
can you please tell me, if i have to change some thing in my code.

rahul
[ June 21, 2007: Message edited by: Rauhl Roy ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When I said you had to specify a different value for each button, I meant within the same JSP. There's no problem with having the same value in one JSP as that used in another JSP even if you're using the same form bean.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using same name for many buttons