0

I have a JSP with a Struts <html:hidden property="message"> field and I want to display it in the generated HTML to the enduser.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
Mercer
  • 9,298
  • 27
  • 91
  • 154

3 Answers3

3

You're not giving many details on what exactly you are trying to do but I am assuming that you have a field

<input type="hidden" ... />

which you would like to change to something like

<input type="text" ... />

If this is the case you can use JQuery to modify the type of the field, or even create a new field with the hidden field's value. Maybe this can help you change type of input field with jQuery I might be able to help more if you give me some more details.

Edit: The Struts hidden tag gets rendered as an <input type="hidden"> element (you can browse the resulting html code to see that for yourself), so you can indeed use JQuery to display it. Assuming your hidden element's id is "hiddenElement" you can use

$("#hiddenElement").val() 

in your javascript to get its value and display it wherever you wish. There are a lot of interesting things you can do with JQuery, so you can read the documentation to get a few more ideas on how to use it.

Community
  • 1
  • 1
Christina
  • 3,084
  • 2
  • 19
  • 31
1

(using Struts 1.x)

If you want your hidden elemnt to be displayed be still be accessible for your form you could use the write attribute ( see struts documentation ):

<html:hidden property="message" write="true">

That way, your element will be visible but still accessible from your form.

thib_b
  • 119
  • 1
  • 8
0

You can always change this (in Struts):

<html:hidden property="message">

To

<bean:write property="message" /> <!-- Creates the "message" as text -->

OR

<html:text property="message"> <!-- Creates a text box that with a populated message -->
Buhake Sindi
  • 82,658
  • 26
  • 157
  • 220