• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using javascript in Struts

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI

You can use document.forms[0].text1.value="sss"


Thanks
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic