| Author |
can javascript and Struts work together ?
|
alfred jones
Ranch Hand
Joined: Apr 19, 2005
Posts: 279
|
|
can javascript and Struts work together ? in html <input type=text size=20 name=address> javascript works this way.. document.personal.address="someValue"; Now, how do i use javascript in Struts ? <html:text property="firstname"/> How do i set the value of first name using javascript now ?
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Alfred, Yes, Javascript and Struts work together well. document.personal.address="someValue"; If you know the value at the time you paint the page, you can do: <html:text property="firstname" value="someValue" /> If not, you can do: document.formName.firstname="someValue"; The form name is whatever you defined in the Struts config. You can also find this by looking at the rendered HTML page.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
alfred jones
Ranch Hand
Joined: Apr 19, 2005
Posts: 279
|
|
ummm...i am confused. in html we have <input type=text size=20 name=address> ... "name" field, so javascript works fine. but in Struts there is no "name" fields rather there is "property" field! , so how javascript will work now ? because javascript works when there is "name" field only.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Alfred, Struts converts the property field into an HTML name field. You can verify this by doing a "view source" in your browser on a page created by Struts.
|
 |
Pranav Sharma
Ranch Hand
Joined: Oct 27, 2003
Posts: 254
|
|
|
Maybe you should look at some basic struts tutorials. google gives many options on a search struts search
|
 |
 |
|
|
subject: can javascript and Struts work together ?
|
|
|