On 10/7/05, starki78 <[EMAIL PROTECTED]> wrote:
> Hi, we have a strange Problem
> with logic:equal
>
> Look at the following code:
>
>
>  //-->  first we create a bean
>
>  <bean:define  id="myBeanValue" value="1"/>
>
>   //--> changing the value is this possible in the way???
>
>   <% myBeanValue = "2"; %>

change this to <% pageContext.setAttribute("myBeanValue","2");
the point is, that bean:define puts the defined object in the page scope
AND ties a scripting variable to it. Your <% ... %> line changes the
value of the scripting variable but not the value of the object in the
pageContext (page scope).
The logic:equal tag (and all other tags)  looks in the 4 scopes for
the beans, starting with the page scope, and finds your initially
defined value. Hence the output is correct.

Actually
 <% myBeanValue = "2"; %>
is incorrect usage, if you use tags, you don't script.


>
>
>   // tests with the logic:equals tags
>
>   <logic:equal name="myBeanValue" value="1">
>     <br>is equal</br>
>   </logic:equal>
>
>   <logic:notEqual name="myBeanValue" value="1">
>     <br>is notequal</br>
>   </logic:notEqual>
>
>
> After running the jsp we are getting the result= is equal!!!
>
> But Why??  Is it not possible to redefine the variable
> in the way that we try this in the example!
no, it isn't possible, see above.

> What makes us even more worried is that
> when we debug, it neither jumps in the first nor
> in the second logic:equal tag.

Heh? You have the output "is equal" in your jsps, as you stated above,
so it must have jumped in the first tag. I think your debugging
techniques need tuning.

A general advice, if you don't know why a jsp behaves like it does,
look at the generated source code (which is normally under
TOMCAT_HOME/work for tomcat and
RESIN_HOME/webapps/yourwebapp/WEB-INF/work for resin).

>
> Please help me!
>
> Nice Greetings
> Starki

Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to