Revision history [back]

click to hide/show revision 1
initial version

asked 2008-09-03 15:10:51 +0800

zuzsso gravatar image zuzsso

Logical Operators

Hi there. I have a problem with Java scripts. I have this piece of code:

<zscript language="Java">
void aMethod() Source Code
   {//Method starts
      //Declarations--------------------------
         String logVal;
         String pasVal;
      //Sentences-----------------------------     
         logVal="a Value";
         pasVal= "otherValue";
         //Let check if values are the same
         if (logVal.equals(pasVal) & (logVal!=null))
            {//If Block starts
               //Entry Condition: Two values match and logVal is not null
               alert ("You're Logged in")
            }//If Block endss
         else
            {//Else block starts
               //Entry Condition: Two values don't macth or logVal is null
               alert ("You aren't logged in, try again");
            }//Else block endss
   }//Method endss
</zscript>

I built the application and load the page onto the browser. Tomcat reply with an error message: "The entity name must inmediately follow the '&' in the entity reference"

The error is caused by the use of "&" operator in "if" sentence. However, if I used the "|" operator, rewriting like this, the page works fine:

if (!logVal.equals(pasVal) | (!logVal!=null)))

The question is: What is the AND operator? That's "&" in Java, but it doesn't works in the script Tank you in advance!!!

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More