You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christopher Painter-Wakefield <pa...@mc.duke.edu> on 2003/11/20 19:08:45 UTC

Re: XSP logic if failing




You can't do String equality this way in Java.  Try this instead:
      if (!("Manager".equals(type))) { ... }

The = for Strings is an Object identity test, not a value comparison test.

-Christopher



|---------+---------------------------->
|         |           "JD Daniels"     |
|         |           <jd...@datatrio.com>|
|         |                            |
|         |           11/20/2003 01:58 |
|         |           PM               |
|         |           Please respond to|
|         |           users            |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------|
  |                                                                                                              |
  |       To:       "Cocoon Users" <us...@cocoon.apache.org>                                                     |
  |       cc:                                                                                                    |
  |       Subject:  XSP logic if failing                                                                         |
  >--------------------------------------------------------------------------------------------------------------|




<xsp:logic>
String str="";
String type = session.getAttribute("userRole").toString();
if ( type != "Manager")
{
             str=" AND tasks.assignedTo='" + session.getAttribute("userId")
+ "'";
}
             <xsp:attribute name="title">Tasks :: Role =
<xsp:expr>type</xsp:expr></xsp:attribute>
</xsp:logic>

For some reason, this if block will ALWAYS fail... even when the session
attribute IS Manager. (The xsp:attribute gets put into my page title, and
"Manager" comes out properly.. but the if block stills fails...


Any Ideas?

JD


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: XSP logic if failing

Posted by Tony Collen <co...@umn.edu>.
JD Daniels wrote:
> Thanks !!
> 
> PHP background :S:S heh heh

Heheh, take your advanced topics such as "operator overloading" and get 
right outta here! :)


Tony


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: XSP logic if failing

Posted by JD Daniels <jd...@datatrio.com>.
Thanks !!

PHP background :S:S heh heh

-----Original Message-----
From: Christopher Painter-Wakefield [mailto:paint007@mc.duke.edu]
Sent: Thursday, November 20, 2003 10:09 AM
To: users@cocoon.apache.org
Subject: Re: XSP logic if failing






You can't do String equality this way in Java.  Try this instead:
      if (!("Manager".equals(type))) { ... }

The = for Strings is an Object identity test, not a value comparison test.

-Christopher



|---------+---------------------------->
|         |           "JD Daniels"     |
|         |           <jd...@datatrio.com>|
|         |                            |
|         |           11/20/2003 01:58 |
|         |           PM               |
|         |           Please respond to|
|         |           users            |
|         |                            |
|---------+---------------------------->

>---------------------------------------------------------------------------
-----------------------------------|
  |
|
  |       To:       "Cocoon Users" <us...@cocoon.apache.org>
|
  |       cc:
|
  |       Subject:  XSP logic if failing
|

>---------------------------------------------------------------------------
-----------------------------------|




<xsp:logic>
String str="";
String type = session.getAttribute("userRole").toString();
if ( type != "Manager")
{
             str=" AND tasks.assignedTo='" + session.getAttribute("userId")
+ "'";
}
             <xsp:attribute name="title">Tasks :: Role =
<xsp:expr>type</xsp:expr></xsp:attribute>
</xsp:logic>

For some reason, this if block will ALWAYS fail... even when the session
attribute IS Manager. (The xsp:attribute gets put into my page title, and
"Manager" comes out properly.. but the if block stills fails...


Any Ideas?

JD


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org