You don't need the getIsActive method in your bean. If you have isActive, you can use the line:
<logic:equal name="myBean" property="active" value="true">


According to the bean spec any boolean attributes should use "isFoo" instead of "getFoo".

BAL

From: "Khalid K." <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: Struts Dilemma
Date: Thu, 6 Nov 2003 19:48:53 -0800

I do the following:

// in the bean
Public boolean isActive() {
        if (blah)
                return true;
        return false;
}
// if I know that this method will be used in jsp, I also write the
following:
Public boolean getIsActive() {
        if (isActive())
           return true;
        return false;
}

// in jsp
<logic:equal name="myBean" property="isActive" value="true">
  printout whatever...
</logic:equal>

It works...

Khalid


-----Original Message----- From: Srinivas Gunturu [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 9:30 AM Subject: Struts Dilemma


Often when writing a bean for use by a tag, I seem to be writing a equivalent method that returns a string value for a boolean property.

For example:

If I mean to pass a boolean property isInactive, I am also writing a
getInactiveFlag which returns "N" or "Y" based on isInactive.

I use inactiveFlag in my tag definition and inside my tag I check for
"Y" or "N".

Am I totally missing something or is there a better way to do this?

TIA



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



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 11/3/2003


--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.536 / Virus Database: 331 - Release Date: 11/3/2003



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


_________________________________________________________________
Frustrated with dial-up? Get high-speed for as low as $26.95. https://broadband.msn.com (Prices may vary by service area.)



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



Reply via email to