Pat Farrell wrote:
Freddy Daoud wrote:
I've written a Stripes article which has been published on The Server Side:

Question for Freddy, which may be answered by the real code, but the
link on the TTS site is still 404

In the  ActivateActionBean, there is code such as

User existingUser = Database.getUser(user.getUsername());

Which throws the expected null pointer exception because the variable
user has not been initialized.

Where should that happen?

On initial activation, has a User been put in the Session or
FlashRequest? Where does that happen, because I don't see that in my flow.

Thanks
Pat


Pat,
I'll take a stab at it. The form that hits the event handler probably has a field like <s:text name="user.username"/>. Stripes would hit your ActionBean and if user is null it would call the default no-arg constructor for User and then call the setter for username as long as the field wasn't left blank. I'm guessing that you're either leaving the field blank or calling the event from somewhere other than the correct form.

Adding a @ValidateNestedProperties([EMAIL PROTECTED](field="username",required=true,on="myEvent")}) to the user declaration in your ActionBean (changing myEvent to match the event that is being called) should at least get rid of the NPE.

Aaron
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to