I do the same as the example here
http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html

<http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html>basically
1 form and a method input that tests an ID, if the id is given, then its a
edit form and its filled automatically with the data from teh old object to
be edited, otherwise it just shows an empty form.

in struts.xml
...
<result name="input">form.jsp</result>
...

in action class
public String input() {
  if(id != null) {
    pig = pigService.find(id);
  }
  return INPUT;
}


On Tue, May 18, 2010 at 21:02, Stephane Cosmeur <cosm...@gmail.com> wrote:

> Hello,
>
> My question is quite simple : what are the best practices to manage the
> edit
> and create form who often are exactly the same. Do you usualy create two
> jsp
> ? Do you call an action who check if the object is in the DB or not. Maybe
> some people use two diffrent action with two submit (seems difficult to
> me).
> I know it's not a such important requirment but my application is barely
> only composed of form and save / edit so i would to do it the best way.
>
> Regards,
>
> --
> Stéphane Cosmeur
>



-- 
Ing. Luis Martín Canaval Sánchez
Keep it small and simple.

Reply via email to