-
1. Re: Scoping - finding the sweetspot
fhh Apr 25, 2007 4:29 AM (in response to sammy8306)Use a page action for the restful url.
Regards
Felix -
2. Re: Scoping - finding the sweetspot
sammy8306 Apr 25, 2007 5:08 AM (in response to sammy8306)Isn't this the same as using a PAGE scoped component en doing the initialization stuff in @Create ? The problem is that a (Seam/JSF) postback action loses all the information from the original url... But may be I'm wrong, could you elaborate a bit?
-
3. Re: Scoping - finding the sweetspot
pmuir Apr 25, 2007 6:43 AM (in response to sammy8306)Not quite the same - @Create on a PAGE scoped component will be run when the view is accessed from another view (but not when it is refreshed/reloaded), a page action will be run each time it is accessed/refresed etc.
As for your original question: I would suggest something likeprivate Integer storedId; @RequestParameter private Integer id; public int getId() { if (id !=null) { storedId = id; } return id; }
You'll want to adjust the algorithm a bit so its suits your exact architecture. As your bean is in PAGE scope, storedId will be remembered -
4. Re: Scoping - finding the sweetspot
sammy8306 Apr 25, 2007 7:15 AM (in response to sammy8306)Thanks, that looks like a workable solution.
Another problem I encounter is this: I'm passing an object to a delete action method in the PAGE scoped component. I'm merging this incoming object explicitly with the seam managed entity manager, and then call en.remove() on this object. However, I still get java.lang.IllegalArgumentException: Removing a detached instance org.blog.domainclasses.BlogEntry#1 on this call... shouldn't the merge call guarantee that the object is managed by this em again? -
5. Re: Scoping - finding the sweetspot
mariuszs Apr 25, 2007 7:55 AM (in response to sammy8306)you should make somthing like this:
em.remove(em.merge(object)); -
6. Re: Scoping - finding the sweetspot
sammy8306 Apr 25, 2007 8:23 AM (in response to sammy8306)great, thanks!