I do this using JSTL but I am sure there is a better way:

<c:if test="${actionBean.context.user != null}”>
        // do stuff
</c:if>

You could also do this:

<c:choose>
    <c:when test="${actionBean.context.user != null}”>
       // do something...
    </c:when>
    <c:when test="${actionBean.context.user == null}”>
       // do another thing…
    </c:when>
    <c:otherwise>
       // or do something completely different.
    </c:otherwise>
</c:choose>
-Joaquin





> On Nov 21, 2014, at 2:12 PM, William Krick <kr...@3feetunder.com> wrote:
> 
> In a JSP, I can do something like this to display a value from the action 
> bean...
> 
> <h2>Hello ${actionBean.person.name <http://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 <http://actionbean.person.name/> != 
> null) ? actionBean.person.name <http://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
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
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
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to