File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes display text in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display text in jsp" Watch "display text in jsp" New topic

display text in jsp

Suma Rangaraj
Ranch Hand

Joined: Feb 02, 2005
Posts: 50

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

Joined: Feb 15, 2005
Posts: 4864
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.


Consultant, Sima Solutions
Suma Rangaraj
Ranch Hand

Joined: Feb 02, 2005
Posts: 50
Thanks Merill. I tried and it works.
I agree. Here's the link:
subject: display text in jsp
It's not a secret anymore!