• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display text in jsp

 
Suma Rangaraj
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I want to know if there is a html tag way to display text on the jsp page using a form (read only, no input).

Example, we use <html:text for an input field. Likewise, do we have any <html:label property="name" /> tag to display the text?

Thanks for your time.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a property called "foo" on a form bean called "MyForm", you can display this property as text on a jsp by writing the following:

<bean:write name="MyForm" property="foo" />

provided you have a <html:form name="MyForm"> tag prior to this statement.

You can also set up any javaBean for use by <bean:write> by including a <bean efine> tag prior to the statement.

If you wish it to look like a text box but not allow input, you can use the "readonly" attribute of the <html:text> tag.

Merrill
 
Suma Rangaraj
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merill. I tried and it works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic