In my index.jsp I have a link that goes to a registration.jsp page. The book I am reading (
Struts 2 in Action) says best practice is to route simple requests through actions. Ok, so in my index.jsp I have a link:
And in my struts-config.xml I have a simple action to act as a passthrough
In Register.jsp I display a form:
The action is Register and I define that in struts-config.xml
So far so good. In my Register action (RegisterAction.class), I do some validation:
If there are validation errors, the error gets printed - great.
If there are no validation errors, the page is *redirected* to the homePage action.
If the user ends up on the Register.jsp page and bookmarks it, when he returns to that page via the bookmark, an NPE is generated because emailAddress is null. But in all examples I've seen with validation, I do not see any checks for null when validating a field.
How does one prevent bookmarking this page, (because that kind of breaks the workflow of the pages anyway) or is there a way not to validate if the page is being rendered for the first time?
Thanks,
Billy