You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Yizu <li...@gmail.com> on 2014/03/04 09:30:07 UTC

How to catch OgnlException.

Hi,

I am a beginner at both Strust2 and English, please allow me to explain my
question with a simple example:

1. profile.jsp

<form>
...
Job: <input name="user.job" type="text" value="" id="txtJob"
class="input_text">
...
</form>

2. UserAction.java

public String editProfile(){
  userService.save(user);
}

3. User.java

private String job;//this can be NULL.


My question is, if submit the form normally, everything is fine.
But if users change name="user.job" to name="user.job111" inadvertently or
purposely,
will get "ognl.NoSuchPropertyException",
I don't know where and how to catch this exception, and the transaction is
still committed.
Could anyone please help me, thanks.



--
View this message in context: http://struts.1045723.n5.nabble.com/How-to-catch-OgnlException-tp5715377.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org