Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating an edit action in Stripes

 
Gerard Kelly
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gerard,

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



Cheers,
 
Gerard Kelly
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bump. Can anyone help me out with this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic