wood burning stoves 2.0*
The moose likes Struts and the fly likes button focus problem with multiple <html:submit> buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "button focus problem with multiple <html:submit> buttons" Watch "button focus problem with multiple <html:submit> buttons" New topic
Author

button focus problem with multiple <html:submit> buttons

Mohit Jain
Ranch Hand

Joined: Jun 04, 2007
Posts: 74
Hi Ranchers

I have a JSP having two textbox with "Cancel" and "Submit" buttons. Both buttons are <html:submit> type.

After typing in textbox if we press <Enter> key, the Cancel button is executed. This is because the cancel button is the first button on page and is by default focussed on pressing <Enter> key.

I want the second button ("Submit") to be focussed by default.

My Code is something like -

<html:password property="newPassword"/>
<html:password property="reenterPassword"/>

<html:submit property="bipSubmit" value="Cancel"/>
<html:submit property="bipSubmit" value="Submit"/>

Please suggest how to implement this, I prefer not to use JAVASCRIPT.

Its urgent.


SCJP 5.0, SCWCD in progress
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: button focus problem with multiple <html:submit> buttons
 
Similar Threads
Stale Value
Multiple Submit Buttons?
DispatchAction and html:cancel
LookupDispatchAction + html:cancel
textbox - onBlur, fire off a Struts action