On Mon, Mar 7, 2011 at 4:17 PM, Anjib Mulepati <anji...@hotmail.com> wrote:
> I have following:
>
> 1. A form accessible only after successful login.
> 2. Action(<form action="send.do"...>) on the form i.e. it send form data to
> server after user click submit
>
> Now I am getting
>
> java.lang.NullPointerException
>        mypkg.myForm.validate(MyForm.java:108)
>
> when I am giving http://localhost:8080/myapp/send.do directly in address bar.
>
> It is because it try to validate the form field which are obviously null
> since user is trying to send directly.
>
> So how can I prevent this suitation where user will get meaningful error or
> stop such request on first place itself. Can someone help me in this?

Either use one of the suggestions already provided, or fix your
validation method to return an actual error rather than throwing an
exception. I don't think anyone mentioned ActionForm's reset() method
either, which might be another option.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to