| Author |
Using javascript in Struts
|
dina raj
Greenhorn
Joined: Dec 06, 2005
Posts: 17
|
|
|
In my application, which uses struts, the javascript refers to window.document.frmReset.pin.value where frmReset is the name of the form. But since I am using Struts I cannot use the Name attribute for the form. So how do I rewrite the javascript? Or can I specify the name of the form while using <html:form>
|
 |
alec stewart stewart
Ranch Hand
Joined: Dec 23, 2003
Posts: 71
|
|
yes of course you can specify name as follows <%@ page language="java" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <html> <head> <title>Sample Struts Application</title> </head> <body> <html:form action="Name" name="nameForm" type="example.NameForm"> <table width="80%" border="0"> <tr> <td>Name:</td> <td><html:text property="name" /></td> </tr> <tr> <td><html:submit /></td> </tr> </table> </html:form> </body> </html>
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
If you don't specify a name in the html:form tag, the name of the form will be the name of the actionForm associated with the action in the struts-config.xml file. It's easy to see what name struts has given the form by using the "view source" function of your browser when the page is being displayed.
|
Merrill
Consultant, Sima Solutions
|
 |
pax smith
Ranch Hand
Joined: Dec 13, 2005
Posts: 45
|
|
HI You can use document.forms[0].text1.value="sss" Thanks
|
 |
 |
|
|
subject: Using javascript in Struts
|
|
|