Tag Library problem

W

WJ

I am having a problem putting a <jsp:getProperty. . ./> as a param
in one of my own custom tags.

I am putting a bean on the request and defining in the jsp:

<jsp:useBean id="user" class="User" scope="request"/>

and I can get the properties as well:

<input type="text" name="state" size="2" maxlength="2" class="textbox"
value="<jsp:getProperty name="user" property="state"/>">

However, I want to pass the output of the "state" property into one of my
taglibs, like:

<mytag:render name="state" selectedValues="<jsp:getProperty name="user"
property="state"/>" />

this fails. The error I get is "equal symbol expected"

If I pass a hard coded String, like:

<mytag:render name="state" selectedValues="CA" />

it works fine.

I am running JDK 1.4.2_06 on Tomcat 5.0.28. Now, the <jsp:getProperty />
gets the
property and writes it to the response buffer and I think that's causing the
problem; the
string is not available to the input of the taglib.

I can make this work by putting a value on the request when I put the user
obj on the request.
Then in the tag, I can pull that value off. But I'm really trying to make
this generic.

I've been reading through a JavaServer Pages book this afternoon and am not
finding an
answer. Any input would be greatly appreciated.
 
C

Chris Smith

WJ said:
I am having a problem putting a <jsp:getProperty. . ./> as a param
in one of my own custom tags.

I am putting a bean on the request and defining in the jsp:

<jsp:useBean id="user" class="User" scope="request"/>

and I can get the properties as well:

<input type="text" name="state" size="2" maxlength="2" class="textbox"
value="<jsp:getProperty name="user" property="state"/>">

However, I want to pass the output of the "state" property into one of my
taglibs, like:

<mytag:render name="state" selectedValues="<jsp:getProperty name="user"
property="state"/>" />

That definitely will not work. See the <jsp:attribute> standard action,
which was introduced in JSP 2.0.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Unbalanced tag 0
Unbalanced tag 0
End tag is unbalanced 0
Unbalance end tag 0
Style Tag Problem 1
jsp:getProperty question 5
Is JavaBeans able to store an array? 6
HTML Anchor tag not working 2

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top