struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hardee, Tony" <>
Subject RE: Default Button
Date Thu, 09 May 2002 12:10:08 GMT

I have a tag that generates java script.  Below is the relevant code from
the tag

            out.println("<!-- Map Enter Key - BEGIN -->");
            out.println("<SCRIPT LANGUAGE=\"JavaScript\">");
            out.println("  function getKey(keyStroke) {");
            out.println("    isNetscape=(document.layers);");
            out.println("    eventChooser = (isNetscape) ? keyStroke.which :
=>>>        out.println("    if (eventChooser == 13) {");
            out.println("      window.location=\"" + location + "\";");
            out.println("    }");
            out.println("  }");
            out.println("  document.onkeypress = getKey;");
            out.println("<!-- Map Enter Key - END -->");

To use the code/tag in the jsp I simply type

	<ccom:MapEnterKey location="javascript:submitForm()"/>

The line preceded with =>>> maps the enter key.  The location in the tag can
be any uri or in the above example, the submit of the form.  Instead of
using a tag you could just inline the javascript in your page.

Hope this helps.


-----Original Message-----
From: Rich Reese []
Sent: Tuesday, May 07, 2002 11:18 AM
Subject: Default Button

How do you make a submit button a default button on a JSP, so when the user
hits the 'Enter' key the button is submitted?  I think it has something to
do with the accesskey attribute, but I do not know what value to assign to

Any suggestions are appreciated,

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message