Peter,

> The expression :
>
>  <%=
> inputparams.getAreatype().equals("Nativeforest")?"Checked" :
> "Notchecked" %>
>
> compiles OK but crashes the JSP

I assmune the jsp crashing you are getting is a NullPointerException being
thrown?

If so, the most likely cause of this is inputparams.getAreatype() returning
a null value.  In the first sample code you are attempting to call a method
from a null object (the method being .equals("something")) which throws a
NullPointerException in the jsp.  In the second example, you are correctly
calling the equals() method on a String object, so that if
inputparams.getAreaType() returns a null, the method returns false, which
causes the appropriate "else" to be executed.

> BUT
>
> <%=
> "Nativeforest".equals(inputparams.getAreatype())?"Checked" :
> "Notchecked" %>
>
> works OK !
>
> Any suggestions?

I prefer using the second method you describe as it allows me the luxury of
skipping one sanity check in my code.  If you want to use the first method,
you should try something like:

<%= inputparams.getAreatype() != null &&
inputparams.getAreatype().equals("Nativeforest")? "Checked" : "Not Checked"
%>


> Peter

Hope this helps, take care,

Jeff

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to