tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Sand" <rs...@vgalleries.com>
Subject cannot update page variable for use with xtags?
Date Thu, 08 Nov 2001 01:27:52 GMT
Hi all-

The problem I am encountering is that when I use an xtags tag with a
variable from the request or page scope, I cannot alter the variable in my
JSP code.

I'm trying to do the following:

I have a help page generator called help.jsp which uses xtags to display the
selected help topic from an xml file (each topic is a tree such as:
<topic><topic-key>mytopic</topic-key>....</topic>).  The page gets
invoked
with the desired topic on the query string, such as:

/help.jsp?topic=changepassword

When my xtag usage is as follows, to get the variable directly from the
request, it works fine, i.e.:

<xtags:forEach select="/help/topic[topic-key=$topic][1]">

However, what I want to do is make sure that the "topic" is provided, so I
check the value of topic and if its missing, I set it, as follows:

<xtags:variable id="helptopic" select="$topic"/>

<%
   if ("".equals(helptopic)) helptopic = "nohelp";
   if (helptopic == null) helptopic = "nohelp";  // wasn't sure if i'd see
an empty string or null
%>

<xtags:forEach select="/help/topic[topic-key=$helptopic][1]">

However, this doesn't work!  The xtags treats helptopic as null and exits
immediately.  I've also tried other hacks like creating a new page variable,
but that doesn't work either.  Basically, what I am seeing is that xtags
allows me to see variables in my page, but it won't pick up on any changes
to those variables in the page.

Is this the expected behavior?

Thank!

Best regards,

Richard


--
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