Re: Editing a JPA entity
> I'm using an action to retrieve a list of entities and render these as a > list, the user can then select an edit button that calls an action that > retrieves the individual entity and renders the edit page. Once the user has > completed editing they hit the save button which calls the action that calls > the entity manager's merge method to update the db. Each of these actions > call methods of the same action class, but the entity ends up in a detached > state so merge will fail. I could just retrieve the entity again and then > update each data member but this seems like a very messy way to do it. Is > there a better way to do this with struts? > > > > I'm using struts 2.3.20 with hibernate 4.3.11 > > Well, that is basic http. When data is SELECTed from DB and the html page is rendered the server is done. That means at this point there are no more references to attached jpa objects. In terms of http: the handling of GET request is completed. When the user hits save the browser issues another http request, usually a POST request. On the server side there is no more state or information that there has been a GET request before and entities had been loaded. So yes, you have to retrieve the entity again and update it. Regards, Christoph This Email was scanned by Sophos Anti Virus
Re: Struts 1 & Struts 2 coexist question
2016-01-04 20:52 GMT+01:00 Xu, Hui@DCSS : > Question modified: > We are planning to migrate our application written in Struts 1 to Struts 2. > We want to have Struts 1 and Struts 2 coexist as we migrate our application. > We have a few pages that need to share state. Currently this is implemented > in Struts 1 by defining a conversation. > > 1. How do we implement this in Struts 2? You ask how to implement conversation pattern? You can use the Struts 2 Conversation plugin https://cwiki.apache.org/confluence/display/S2PLUGINS/Conversation+Plugin or the Struts 2 ActionFlow plugin https://cwiki.apache.org/confluence/display/S2PLUGINS/ActionFlow+Plugin > 2. If we create some new pages in Struts 2 and older pages use Struts > 1, can Struts1 and Struts2 can share/pass session information between them? Yes, it is possible. I have no experience but you should be able to check what S1 stores in session and use the same keys in S2 - you can add a custom interceptor to translate those or handle user/pass. Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Editing a JPA entity
I'm using an action to retrieve a list of entities and render these as a list, the user can then select an edit button that calls an action that retrieves the individual entity and renders the edit page. Once the user has completed editing they hit the save button which calls the action that calls the entity manager's merge method to update the db. Each of these actions call methods of the same action class, but the entity ends up in a detached state so merge will fail. I could just retrieve the entity again and then update each data member but this seems like a very messy way to do it. Is there a better way to do this with struts? I'm using struts 2.3.20 with hibernate 4.3.11
Re: Chain a global result to an action?
Im facing the same issue, has anybody arrived at a solution or found a way to resolve this issue ??? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Struts 1 & Struts 2 coexist question
Question modified: We are planning to migrate our application written in Struts 1 to Struts 2. We want to have Struts 1 and Struts 2 coexist as we migrate our application. We have a few pages that need to share state. Currently this is implemented in Struts 1 by defining a conversation. 1. How do we implement this in Struts 2? 2. If we create some new pages in Struts 2 and older pages use Struts 1, can Struts1 and Struts2 can share/pass session information between them? From: Xu, Hui@DCSS Sent: Monday, January 04, 2016 11:30 AM To: 'user@struts.apache.org' Subject: Struts 1 & Struts 2 coexist question We are planning to migrate our application written in Struts 1 to Struts 2. We want to have Struts 1 and Struts 2 coexist as we migrate our application. We have a few pages that need to share state. Currently this is implemented in Struts 1 by defining a conversation. How do we implement this in Struts 2? Can Struts1 and Struts2 can share/pass session information between them? CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.
Struts 1 & Struts 2 coexist question
We are planning to migrate our application written in Struts 1 to Struts 2. We want to have Struts 1 and Struts 2 coexist as we migrate our application. We have a few pages that need to share state. Currently this is implemented in Struts 1 by defining a conversation. How do we implement this in Struts 2? Can Struts1 and Struts2 can share/pass session information between them? CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.