• 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

html:hidden

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
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'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.
 
Gayatri Sinha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic