tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen, Gin" <Gin_C...@tvratings.com>
Subject RE: setProperty
Date Tue, 26 Nov 2002 20:21:05 GMT
Thanks Hans,
I realized after I set the first post that the c:set section only showed the
basic attributes.
I should have checked the appendix before posting. :-P
Thanks again :)
-Tim

-----Original Message-----
From: Hans Bergsten [mailto:hans@gefionsoftware.com]
Sent: Tuesday, November 26, 2002 3:12 PM
To: Tag Libraries Users List
Subject: Re: setProperty


Chen, Gin wrote:
> Hi all,
> 	I was wondering if there was a way using JSTL to set a property on a
> bean?
> For example:
> 	I have a page that shows the country.
> If the country is null then I want to use USA as the default.
> My code looks like:
> 
> 	<c:if test="${empty applForm.country}">
> 		... i want to set it to USA but ...
> 		... i dont know what to use here ...
> 		... c:set only sets a scoped var but cant use the bean (if
> i'm reading Shawn's book right)...
> 	</c:if>
> 
> 	is this possible using jstl or struts? i looked at the struts doc
> but dont see anything there either.

Use <c:set>:

   <c:set target="${applForm}" property="country" value="USA" />

Hans
-- 
Hans Bergsten                                <hans@gefionsoftware.com>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


--
To unsubscribe, e-mail:
<mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:taglibs-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message