struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <stephen.chamb...@verizon.net>
Subject Re: Re: Problem with logic:equal and bean:define
Date Thu, 11 Apr 2002 17:03:56 GMT
Pawel,

I appreciate the suggestion, but I couldn't get it to work somehow. It keeps coming back with
compile errors that java.lang.String is already defined. I put exactly the same bean:define
tag, albeit with a different value outside and above the logic:equal tag.

Which struts are you using 1.0.2 or 1.1 b1?

Stephen
============================================================
From: Pawel Rzepa <rzepa@agh.edu.pl>
Date: 2002/04/11 Thu AM 02:38:45 CDT
To: Struts Users Mailing List <struts-user@jakarta.apache.org>
Subject: Re: Problem with logic:equal and bean:define

Hi Stephen,
  If you are interested in why it is happening look at the .java file that is
created by jsp compiler. I've spent some time doing it but eventually I had given
up because there were too many lines of code to analyze. Nevertheless I'm sure
there is an important reason :-).
Despite I don't know why it is happening, I know how to solve the problem and
that is why I'm replying to your email. What you have to do is to define a bean
with the same name outside of any <logic:...> tag. When you repeat <bean:define
...> inside <logic:..> tag bean's value just changes. And that is all. You can
then use bean as you want.
What you must remember is to keep the same classname of the bean in each
<bean:define ...> statement. When you use "value" attribute it is done
automatically, assuming that the classname is java.lang.String. If you use
another attribute (name, property and so on) don't forget to add "type" attribute
as well.

Regards,
  Pawel

"stephen.chambers" wrote:

>  All,
>
>  When I use the bean:define tag inside a logic:equal, why doesn't the
> scriptinh variable created stay in scope outside of the logic tags? What am
> I doing wrong?
>
>  Code snippet below:
>
>  <logic:equal name="myattribute" value="5">
>    <bean:define id="myvar" value="50"/>
>  </logic:equal>
>
>  Once outside of the logic tags, even out.print(myvar); results in null.
>
>  Thanks, Steve
>
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>

--
Pawel Rzepa                           Department of Computer Science
rzepa@agh.edu.pl           University of Mining and Metallurgy (AGH)
tel: +48 (12) 617 39 82                      fax: +48 (12) 617 39 66



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

============================================================



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


Mime
View raw message