Yes, you can do that. Personally I'd write
<h2>Hello ${ empty actionBean.person.name ? "valued customer" :
actionBean.person.name }</h2>
Of course you want to prevent XSS attacks too:
<h2>Hello ${ empty actionBean.person.name ? "valued customer" :
fn:escapeXml(actionBean.person.name) }</h2>
On Fri, Nov 21, 2014 at 4:12 PM, William Krick <[email protected]> wrote:
> In a JSP, I can do something like this to display a value from the action
> bean...
>
> <h2>Hello ${actionBean.person.name} </h2>
>
>
> I'm trying to figure out how to display alternate text in the jsp if the
> value from the actionBean is null, but I can't figure out any syntax that
> works. I was expecting something like this to work, but that doesn't seem
> to be the case...
>
>
> <h2>Hello ${ (actionBean.person.name != null) ? actionBean.person.name :
> 'valued customer'} </h2>
>
>
> Is something like this possible, or do I need to write a method in the
> actionBean that does this logic and returns the appropriate string?
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users