wood burning stoves*
The moose likes Struts and the fly likes OGNL if test throws null stacktrace error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "OGNL if test throws null stacktrace error" Watch "OGNL if test throws null stacktrace error" New topic
Author

OGNL if test throws null stacktrace error

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
I have a login page that uses OGNL to display errors from a Action when the login fails. The page that is initially loaded and the failure page are the same:



On the initial load of the page before the action has run and given a variable back to OGNL I get a stack trace error like attached.

Is there as simple way to check for a null with OGNL so I wont get this stack trace error?

Thanks,
Earl


[Thumbnail for targetNull.jpg]

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

try this..it will work.




Good luck!!
A small leak can sink a Gigantic ship.>
E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Raza Mohd wrote:try this..it will work.




Thanks Raza but the code above throws the following error in struts:

Struts has detected an unhandled exception:

Messages: /login/index.jsp(14,13) quote symbol expected
JSPException including path '/login/index.jsp'.
javax.servlet.jsp.JspException: IO Error executing tag: JSPException including path '/login/index.jsp'.
ServletException including path '/tiles/login_layout.jsp'.
ServletException including path '/tiles/login_layout.jsp'.

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Raza I experimented with the idea you gave me. This works without throwing a null pointer exception to the stack trace when there is no variable from the Action. Thanks for your help
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

your welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: OGNL if test throws null stacktrace error