struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Re: Present formbean value on jsp page.
Date Fri, 18 Mar 2005 20:48:48 GMT
Scott Purcell wrote the following on 3/18/2005 3:32 PM:
> Well, as normal, I have once again ran into a new snag while building my app.
> Up until today, I have pulled out my form-param values in my jsp like so into a textfield.
>        <html:text property="email" size="30" maxlength="50" />
> And this is great if you want to display it in a text field. But how can I just display
it in html. I have some fields that I just want to show, as uneditable, so therefore just
html. The values are in the form-bean, but I cannot figure out which tag to use for this mission.

You might want to look at some of the tons of struts examples that are 
out there. This is such a common thing that all the examples will show 
it. (Not that it's a bad question, just that a quick look at any of the 
struts examples will show displaying properties).

To answer your question there are several ways...

Using struts tags:
<bean:write property="userBean.someField"/>

JSTL (prefered over bean:write):
<c:out value="${userBean.someField}"/>


Preferred consesus is to use JSTL approach.

> Should I just start using <jsp:useBean?

You shouldn't need to if your bean is already in scope, which it should 
be since you should set into scope in your Action class (or if it's a 
form bean it will automatically be in scope).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message