RE: Problem with logic:equal?
You have defined the user bean between the logic:equal tag this will visible if it is out of scope. Like If(something==true) { User userName = someUser; } if(something!=true){ userName } if you try to use user it is out of scope logic:equal name=elem property=status value=10 bean:define id=username name=UserContainer scope=session property=user.username / logic:equal name=elem property=caseworker value=%= (String) username % td class=text bean:write name=elem property=annCreated //td td class=text bean:write name=elem property=filnavn //td td class=text html:radio property=checked idName=elem value=annID//td /logic:equal logic:notEqual name=elem property=caseworker value=%= (String) username % td class=textdis bean:write name=elem property=annCreated //td Thanks Nazeer -Original Message- From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] Sent: Sunday, September 14, 2003 7:46 AM To: Struts Users Mailing List Subject: Problem with logic:equal? I have this code in my jsp page: logic:iterate id=elem name=annList tr logic:equal name=elem property=status value=0 td class=text bean:write name=elem property=annCreated //td td class=text bean:write name=elem property=filnavn //td td class=text html:radio property=checked idName=elem value=annID//td /logic:equal logic:equal name=elem property=status value=10 bean:define id=username name=UserContainer scope=session property=user.username / logic:equal name=elem property=caseworker value=%= (String) username % td class=text bean:write name=elem property=annCreated //td td class=text bean:write name=elem property=filnavn //td td class=text html:radio property=checked idName=elem value=annID//td /logic:equal logic:notEqual name=elem property=caseworker value=%= (String) username % td class=textdis bean:write name=elem property=annCreated //td td class=textdis bean:write name=elem property=filnavn //td td class=textdis bean:write name=elem property=caseworker //td /logic:notEqual /logic:equal /tr /logic:iterate But this just gives me an error message telling me that cannot resolve symbol symbol : variable username But this variable has been defined, hasn't it?? Any suggestions? Regards, BTJ
Re: Problem with logic:equal is actually a problem with bean:define and Weblogic 8.1
I tried just running bean:define id=username name=UserContainer property=user.username / Test: %= username % in a jsp file under Tomcat and that works ok, but doing the same under Weblogic 8.1 with SP 1, generates a cannot resolve symbol error. Is this a bug in WL or am I doing something wrong? BTJ On Sun, 2003-09-14 at 13:46, Bjørn T Johansen wrote: I have this code in my jsp page: logic:iterate id=elem name=annList tr logic:equal name=elem property=status value=0 td class=text bean:write name=elem property=annCreated //td td class=text bean:write name=elem property=filnavn //td td class=text html:radio property=checked idName=elem value=annID//td /logic:equal logic:equal name=elem property=status value=10 bean:define id=username name=UserContainer scope=session property=user.username / logic:equal name=elem property=caseworker value=%= (String) username % td class=text bean:write name=elem property=annCreated //td td class=text bean:write name=elem property=filnavn //td td class=text html:radio property=checked idName=elem value=annID//td /logic:equal logic:notEqual name=elem property=caseworker value=%= (String) username % td class=textdis bean:write name=elem property=annCreated //td td class=textdis bean:write name=elem property=filnavn //td td class=textdis bean:write name=elem property=caseworker //td /logic:notEqual /logic:equal /tr /logic:iterate But this just gives me an error message telling me that cannot resolve symbol symbol : variable username But this variable has been defined, hasn't it?? Any suggestions? Regards, BTJ
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:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Pawel Rzepa Department of Computer Science [EMAIL PROTECTED] University of Mining and Metallurgy (AGH) tel: +48 (12) 617 39 82 fax: +48 (12) 617 39 66 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Re: Problem with logic:equal and bean:define
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 [EMAIL PROTECTED] Date: 2002/04/11 Thu AM 02:38:45 CDT To: Struts Users Mailing List [EMAIL PROTECTED] 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:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Pawel Rzepa Department of Computer Science [EMAIL PROTECTED] University of Mining and Metallurgy (AGH) tel: +48 (12) 617 39 82 fax: +48 (12) 617 39 66 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem with logic:equal tag
One time I had this problem. Double check to make sure that you have the %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % at the top of the page. Chuck At 11:41 AM 4/4/2002 +0900, you wrote: I have some code in a jsp page logic:equal name=pageBean property=picExists value=false/ logic:equal tag returned true /logic:equal logic:notEqual name=pageBean property=picExists value=false/ logic:notEqual tag returned true /logic:notEqual When I access this page, I get the following logic:equal tag returned true logic:notEqual tag returned true Am I missing the point about the logic:equal and logic:notEqual tags, or is there a reason this might be happening? How can I make it print out only if value=false ? Regards Antony _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Problem with logic:equal tag
Make sure you have included the logic taglib in your page %@ taglib uri="WEB-INF/struts-logic.tld" prefix="logic" % If you dont have this, the logic tags are just ignored and you will get the output you described. HTH, JC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 8:41 PM To: [EMAIL PROTECTED] Subject: Problem with logic:equal tag I have some code in a jsp page logic:equal name="pageBean" property="picExists" value="false"/ logic:equal tag returned true /logic:equal logic:notEqual name="pageBean" property="picExists" value="false"/ logic:notEqual tag returned true /logic:notEqual When I access this page, I get the following logic:equal tag returned true logic:notEqual tag returned true Am I missing the point about the "logic:equal" and "logic:notEqual" tags, or is there a reason this might be happening? How can I make it print out only if value="false" ? Regards Antony _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem with logic:equal tag
Found it!!! I have a / at the end of logic:equal name=pageBean property=picExists value=false/ I have some code in a jsp page logic:equal name=pageBean property=picExists value=false/ logic:equal tag returned true /logic:equal logic:notEqual name=pageBean property=picExists value=false/ logic:notEqual tag returned true /logic:notEqual _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]