struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Vanzin <>
Subject Newbie question: bean values in pages
Date Wed, 22 Aug 2001 20:54:51 GMT

	Hi, this is not particularly a question about Struts, but about JSP, and 
since I haven't found any answers in the literature I've been reading, 
and my tests have failed, I decided to ask.

	Let's say I have some value stored in the request so I can use it in my 
JSP page. Generally, I'd do something like:

<bean:write name="myKey"/>

	Using the Struts bean tag library. Now let's say that I want to write 
that same thing, but inside quotes, so as to pass it as a value to a 
tag's attribute:


	I haven't found how to do this with the taglib syntax. Is there any way?

	I was able to use a scriptlet to do it:

<anytag attribute='<%= (String) request.getAttribute("myKey") %>'>

	But it is pretty ugly, and if the bean is not in the request but in 
another scope, it would get worse to write a general case...

	The taglib way (if there's a way to do it with taglibs) is not that 
beautiful (that's one thing i like about template engines), but much better.

	Any help with that?

Marcelo Vanzin
Touch Tecnologia
"We're an underground revolution working overtime"

View raw message