Re: Strange Problem with logic:equals!

2005-10-07 Thread Leon Rosenberg
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
 bris equal/br
   /logic:equal

   logic:notEqual name=myBeanValue value=1
 bris 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]



Re: Strange Problem with logic:equals!

2005-10-07 Thread Aymeric Alibert
Do you have the struts-bean tag library defined in your jsp:?
Something like %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %

Aymeric.

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


 // tests with the logic:equals tags

 logic:equal name=myBeanValue value=1
 bris equal/br
 /logic:equal

 logic:notEqual name=myBeanValue value=1
 bris 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!
 What makes us even more worried is that
 when we debug, it neither jumps in the first nor
 in the second logic:equal tag.

 Please help me!

 Nice Greetings
 Starki














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




Re: Strange Problem with logic:equals!

2005-10-07 Thread Nicolas De Loof


bean:define creates BOTH 
- a script variable (a Java variable you can use in % ... % java blocs)

- a bean in specified scope (defaults to page)


So you have a myBeanValue variable set to 1 and a myBeanValue String 
put into page scope.


% myBeanValue = 2; % changes value of script variable. myBeanValue bean in 
page scope is not impacted

logic:equal name=myBeanValue value=1 checks the bean in page scope, witch equals 
1.

To solve this, you may :

- use scriptlet, not logic tag, to check script variables (NOT RECOMENDED) :
 % if (1.equals(myBeanValue)) { % ...% } %

- reuse bean:define to change myBeanValue, but be carreful some servlet 
container don't accept multiple use of this tag with the same id, - so NOT RECOMENDED

- not use scriptlets anymore ! Change myBeanValue by using tags, especially use 
EL struts tags and JSTL :
 c:set var=myBeanValue value=1/
 ...
 c:set var=myBeanValue value=2/
 ...
 c:choose
   c:when test=${myBeanValue == '1'}.../c:when
   c:otherwise.../c:otherwise
/c:choose


Nico.


Aymeric Alibert a écrit :


Do you have the struts-bean tag library defined in your jsp:?
Something like %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %

Aymeric.

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


// tests with the logic:equals tags

logic:equal name=myBeanValue value=1
bris equal/br
/logic:equal

logic:notEqual name=myBeanValue value=1
bris 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!
What makes us even more worried is that
when we debug, it neither jumps in the first nor
in the second logic:equal tag.

Please help me!

Nice Greetings
Starki














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


   



 



This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.


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



Re: Strange Problem with logic:equals!

2005-10-07 Thread starki78
Thank you all for your help!
Now I've understood the problem


-- Initial Header ---

From  : Nicolas De Loof [EMAIL PROTECTED]
To  : Struts Users Mailing List user@struts.apache.org
Cc  :
Date  : Fri, 07 Oct 2005 11:07:16 +0200
Subject : Re: Strange Problem with logic:equals!








 bean:define creates BOTH
 - a script variable (a Java variable you can use in % ... % java blocs)
 - a bean in specified scope (defaults to page)


 So you have a myBeanValue variable set to 1 and a myBeanValue String
 put into page scope.

 % myBeanValue = 2; % changes value of script variable. myBeanValue bean 
 in page scope is not impacted

 logic:equal name=myBeanValue value=1 checks the bean in page scope, 
 witch equals 1.

 To solve this, you may :

 - use scriptlet, not logic tag, to check script variables (NOT RECOMENDED) :
   % if (1.equals(myBeanValue)) { % ...% } %
 
 - reuse bean:define to change myBeanValue, but be carreful some servlet 
 container don't accept multiple use of this tag with the same id, - so NOT 
 RECOMENDED

 - not use scriptlets anymore ! Change myBeanValue by using tags, especially 
 use EL struts tags and JSTL :
   c:set var=myBeanValue value=1/
   ...
   c:set var=myBeanValue value=2/
   ...
   c:choose
 c:when test=${myBeanValue == '1'}.../c:when
 c:otherwise.../c:otherwise
  /c:choose


 Nico.


 Aymeric Alibert a écrit :

 Do you have the struts-bean tag library defined in your jsp:?
 Something like %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
 
 Aymeric.
 
 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; %
 
 
 // tests with the logic:equals tags
 
 logic:equal name=myBeanValue value=1
 bris equal/br
 /logic:equal
 
 logic:notEqual name=myBeanValue value=1
 bris 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!
 What makes us even more worried is that
 when we debug, it neither jumps in the first nor
 in the second logic:equal tag.
 
 Please help me!
 
 Nice Greetings
 Starki
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 

 This message contains information that may be privileged or confidential and 
 is the property of the Capgemini Group. It is intended only for the person to 
 whom it is addressed. If you are not the intended recipient,  you are not 
 authorized to read, print, retain, copy, disseminate,  distribute, or use 
 this message or any part thereof. If you receive this  message in error, 
 please notify the sender immediately and delete all  copies of this message.


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




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