| Author |
html:hidden
|
Gayatri Sinha
Ranch Hand
Joined: Feb 13, 2006
Posts: 34
|
|
Hi, Is it possible to have a <html:hidden name="text" value="<bean:write name='messageText' property='messageText'/>" /> Also, do I have the single and double quotes right? Does the strust tag take single quotes ? Thanks
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Mangesh, No. You can't have a tag within a tag. It doesn't have to do with the quotes though. The tags only get evaluated in one pass. So the second set of tags never gets expanded.
|
[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
|
 |
Brent Sterling
Ranch Hand
Joined: Feb 08, 2006
Posts: 948
|
|
As pointed out, the nested tag syntax will not work, but you can probably do what you are trying to accomplish with the hidden tag. I am not sure if you are getting the value from your Action Form or what your bean and property names are. Maybe one of the following will work: Look at the documentation for the hidden tag (http://struts.apache.org/struts-taglib/tagreference-struts-html.html#html:hidden) and see what combination of name, property and value are right for your case. You can also use a scriptlet to set the value. - Brent
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
If you're not setting the value of a hidden field from an ActionForm property, you may as well just use the <input> tag instead of the <html:hidden> tag. The following should work: <input type="hidden" value="<bean:write name='messageText' property='messageText'/>" > Since Struts uses the name property of an <input> tag to match to the same property on the ActionForm, it will get set properly when the form is submitted.
|
Merrill
Consultant, Sima Solutions
|
 |
Gayatri Sinha
Ranch Hand
Joined: Feb 13, 2006
Posts: 34
|
|
Thanks for the replies, I had one more question <html:hidden property="text" value="myname" /> Is this same as <input type="hidden" name="text" value="myname"> The "text" is no bean, its a new value that I am creatign in a form to be passed to the servlet. for html:hidden I know that the "property" is compulsory, so in the above case is the property same as the name in html hidden tag? Thanks once again
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
Yes, the property attribute of an <html:hidden> tag is equivalent to the name attribute of an <input> tag. If you use the view source function of your browser to see the rendered HTML of your pages, you'll see that your <html:xxx property="YYY"> tags have been translated to <input name="YYY"> tags.
|
 |
 |
|
|
subject: html:hidden
|
|
|