cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Painter-Wakefield <paint...@mc.duke.edu>
Subject Re: XSP logic if failing
Date Thu, 20 Nov 2003 18:08:45 GMT




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" <users@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


Mime
View raw message