Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use javascript in struts jsp

 
Nilesh Shekokar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am using struts tags for jsp
like<html:text property="name">
i want to use the javascript for this form
in general we are using name ir id for getting the elements
but in these tags there is no name field
i found somewhere that i have to use the property for that
so can someone explain how can i use that
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using JavaScript in a Struts application it is important to bear in mind the following:

1-Struts tags such as <html:text> are evaluated on the server-side and converted to regular HTML tags before the response is sent back to the browser.

2-A "property" attribute in an <html:xxx> tag is translated to "name" in the HTML tag that it is converted to. Also, specifying a "styleId" attribute will translate to an "id" attribute in regular HTML. For example:

<html:text property="foo" styleId="bar" />

translates to:

<input type="text" name="foo" id="bar">

3-JavaScript operates on the regular HTML tags, not on the struts tags. It's therefore important to know what the rendered HTML tags look like. To do this, use your browser's "view source" function. This will show you the actual HTML that was rendered by your struts tags.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic