This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Creating an edit action in Stripes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Creating an edit action in Stripes" Watch "Creating an edit action in Stripes" New topic
Author

Creating an edit action in Stripes

Gerard Kelly
Greenhorn

Joined: Mar 22, 2009
Posts: 11
Hi,

I'm trying to implement what I thought would be a very simple action with the Stripes framework. I used the @Wizard annotation to perform my "Create" action and it works well but when I try to use this for the edit action (ie. pass in the ID of the object to edit), I get the following error:

"Submission of a wizard form in Stripes absolutely requires that the hidden field Stripes writes containing the names of the fields present on the form is present and encrypted (as Stripes write it). This is necessary to prevent a user from spoofing the system and getting around any security/data checks."

Does anyone know a way around this? I'd love to keep using wizard as there are a LOT of inputs in my create/edit actions and it handles a lot of the hard work ;)

Thanks in advance,
-ger
Frederic Daoud
author
Ranch Hand

Joined: May 22, 2008
Posts: 71
Hi Gerard,

Just add the "edit" action to the list of startEvents in the @Wizard annotation:



Cheers,

Frederic Daoud
Author, Stripes...and Java Web Development is Fun Again
Stripes book
Gerard Kelly
Greenhorn

Joined: Mar 22, 2009
Posts: 11
Hi Frederic,

thanks for that and congrats on a great book!

I'm still having a little trouble with my edit action though.

For starters, my edit action is for a model which references other objects. Although your Stripes book says "If your model objects use other model objects, that’s no problem either—Stripes happily uses deeply nested properties," I can't find an example into how this is implemented.

What I'm trying to do is the following:



And then in the jsp, I'd like to do the following:



The above jsp code is used for both the create and edit actions (same code, but different files if you know what I mean). However, the values for Manufacturer id or the product categories will not get passed through this way. But when I change the above code to look like this:



They will get passed through. Unfortunately, when I go to edit my product the product name and description get populated but the other fields do not (ie. the dropdown defaults to the first option and the multi-select box does not highlight any of the previous entries.

I'd really appreciated it if you could help me out here.

Many thanks,
-ger
Frederic Daoud
author
Ranch Hand

Joined: May 22, 2008
Posts: 71
Ger, could you paste the Product class and the rest of your action bean? It will be easier to try and determine why it's not working.
Gerard Kelly
Greenhorn

Joined: Mar 22, 2009
Posts: 11
Sure, here is Product.java




And here is productEditActionBean.java in full:


The above actionBean extends ProductBaseActionBean which looks like the following:


Thanks again for helping with this!
Gerard Kelly
Greenhorn

Joined: Mar 22, 2009
Posts: 11
Bump. Can anyone help me out with this?
 
 
subject: Creating an edit action in Stripes
 
Similar Threads
Looking for framework that can generate html forms from java objects
One of My Favorite Stripes Features (A Complex Example)
Few questions on Stripes
What combination of frameworks most closely resemles WebOjects
Frameworks? Do I need one? want one?