Re: Re: populate data for edit form
Thank you everyone. The problem is solved. Now i set the same attribute for both action. My codes in SetUpCategoryEditAction: CategoryEditForm categoryEditForm = (CategoryEditForm) form; categoryEditForm.setName("testing"); request.setAttribute("categoryEditForm", form); Dody. >I'll be! Never used "attribute" either. Thanks. > >Jack > > >On Wed, 12 Jan 2005 08:19:25 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote: >> The problem is that you are specifying the "attribute" value for one >> of your action mappings, but not for the other. For the first (setup >> action), because no "attribute" value is set in the ActionMapping, >> Struts looks in the request for a bean under the form's name >> "categoryEditForm". If it doesn't find one, it creates one and puts >> it there, so that by the time your Action's execute method is called, >> the ActionForm passed in the signature is also in the request under >> that attribute name. >> >> Then, when the JSP renders, the html:form tag uses its action >> attribute to look up the ActionMapping for the submission >> ("/categoryEdit"). This ActionMapping specifies that its form bean >> should be stored under the attribute name "val_categoryEdit". There >> is nothing in the request under that name, so Struts creates a new >> form, which is not initialized, and uses it for prepopulating form >> field values. >> >> Again, if you do not specify an "attribute" in an element, >> the value defaults to the form's name (as specified in the 's >> "name" attribute). I have never had a reason to specify "attribute" >> in the element, but if you do, you need it to be consistent >> between the actions that are cooperating. >> >> Hope this helps, >> Joe >> >> >> At 4:19 PM +0700 1/12/05, Dody Rachmat Wicaksono wrote: >> >I'm trying to create an edit page. I think I already in the right >> >direction, but still unable to populate data even with a direct >> >value via action class. Please let me what's wrong here. I've spend >> >3 days alone with this problem. >> >Thank you. >> > >> > >> >I created two action file: >> >- SetUpCategoryEditAction.java (this action will populate data from >> >db to form) >> >- CategoryEditAction.java (this action will save the data) >> > >> >My formbean: CategoryEditForm.java >> >-- >> >public class CategoryEditForm extends ValidatorForm { >> > private String name; >> > private String categoryId; >> > >> > public void setName(String s) { >> > this.name = s; >> > } >> > public String getName() { >> > return name; >> > } >> > public void setcategoryId(String s) { >> > this.categoryId = s; >> > } >> > public String getcategoryId() { >> > return categoryId; >> > } >> >} >> > >> > >> >My struts-config.xml >> >-- >> >> >type="com.strutsgen.garuda.CategoryEditForm"/> >> > >> > > > type="com.strutsgen.garuda.SetUpCategoryEditAction" >> > name="categoryEditForm" >> > scope="request" >> > validate="false" >> > > >> > > > name="continue" >> > path="/categoryEditForm.jsp"/> >> > >> > >> > > > type="com.strutsgen.garuda.CategoryEditAction" >> > name="categoryEditForm" >> > attribute="val_categoryEdit" >> > scope="request" >> > validate="true" >> > input="/categoryEditForm.jsp" >> > > >> > > > name="success" >> > path="/categoryEditOk.jsp"/> >> > >> > >> > >> >SetUpCategoryEditAction.java: >> >-- >> >public final class SetUpCategoryEditAction extends Action { >> > >> > public ActionForward execute(ActionMapping mapping, >> > ActionForm form, >> > HttpServletRequest request, >> > HttpServletResponse response) >> > throws Exception { >> > >> > CategoryEditForm categoryEditForm = (CategoryEditForm)form; >> > categoryEditForm.setName("testing"); >> > >> > return (mapping.findForward("continue")); >> > } >> >} >> > >> > >> > >> >- >> >To unsubscribe, e-mail: [EMAIL PROTECTED] >> >For additional commands, e-mail: [EMAIL PROTECTED] >> >> -- >> Joe Germuska >> [EMAIL PROTECTED] >> http://blog.germuska.com >> "Narrow minds are weapons made for mass destruction" -The Ex >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > >-- >-- > >"You can lead a horse to water but you cannot make it float
Re: Re: populate data for edit form
Thank you everyone. The problem is solved. Now i set the same attribute for both action. My codes in SetUpCategoryEditAction: CategoryEditForm categoryEditForm = (CategoryEditForm) form; categoryEditForm.setName("testing"); request.setAttribute("categoryEditForm", form); Dody. >I'll be! Never used "attribute" either. Thanks. > >Jack > > >On Wed, 12 Jan 2005 08:19:25 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote: >> The problem is that you are specifying the "attribute" value for one >> of your action mappings, but not for the other. For the first (setup >> action), because no "attribute" value is set in the ActionMapping, >> Struts looks in the request for a bean under the form's name >> "categoryEditForm". If it doesn't find one, it creates one and puts >> it there, so that by the time your Action's execute method is called, >> the ActionForm passed in the signature is also in the request under >> that attribute name. >> >> Then, when the JSP renders, the html:form tag uses its action >> attribute to look up the ActionMapping for the submission >> ("/categoryEdit"). This ActionMapping specifies that its form bean >> should be stored under the attribute name "val_categoryEdit". There >> is nothing in the request under that name, so Struts creates a new >> form, which is not initialized, and uses it for prepopulating form >> field values. >> >> Again, if you do not specify an "attribute" in an element, >> the value defaults to the form's name (as specified in the 's >> "name" attribute). I have never had a reason to specify "attribute" >> in the element, but if you do, you need it to be consistent >> between the actions that are cooperating. >> >> Hope this helps, >> Joe >> >> >> At 4:19 PM +0700 1/12/05, Dody Rachmat Wicaksono wrote: >> >I'm trying to create an edit page. I think I already in the right >> >direction, but still unable to populate data even with a direct >> >value via action class. Please let me what's wrong here. I've spend >> >3 days alone with this problem. >> >Thank you. >> > >> > >> >I created two action file: >> >- SetUpCategoryEditAction.java (this action will populate data from >> >db to form) >> >- CategoryEditAction.java (this action will save the data) >> > >> >My formbean: CategoryEditForm.java >> >-- >> >public class CategoryEditForm extends ValidatorForm { >> > private String name; >> > private String categoryId; >> > >> > public void setName(String s) { >> > this.name = s; >> > } >> > public String getName() { >> > return name; >> > } >> > public void setcategoryId(String s) { >> > this.categoryId = s; >> > } >> > public String getcategoryId() { >> > return categoryId; >> > } >> >} >> > >> > >> >My struts-config.xml >> >-- >> >> >type="com.strutsgen.garuda.CategoryEditForm"/> >> > >> > > > type="com.strutsgen.garuda.SetUpCategoryEditAction" >> > name="categoryEditForm" >> > scope="request" >> > validate="false" >> > > >> > > > name="continue" >> > path="/categoryEditForm.jsp"/> >> > >> > >> > > > type="com.strutsgen.garuda.CategoryEditAction" >> > name="categoryEditForm" >> > attribute="val_categoryEdit" >> > scope="request" >> > validate="true" >> > input="/categoryEditForm.jsp" >> > > >> > > > name="success" >> > path="/categoryEditOk.jsp"/> >> > >> > >> > >> >SetUpCategoryEditAction.java: >> >-- >> >public final class SetUpCategoryEditAction extends Action { >> > >> > public ActionForward execute(ActionMapping mapping, >> > ActionForm form, >> > HttpServletRequest request, >> > HttpServletResponse response) >> > throws Exception { >> > >> > CategoryEditForm categoryEditForm = (CategoryEditForm)form; >> > categoryEditForm.setName("testing"); >> > >> > return (mapping.findForward("continue")); >> > } >> >} >> > >> > >> > >> >- >> >To unsubscribe, e-mail: [EMAIL PROTECTED] >> >For additional commands, e-mail: [EMAIL PROTECTED] >> >> -- >> Joe Germuska >> [EMAIL PROTECTED] >> http://blog.germuska.com >> "Narrow minds are weapons made for mass destruction" -The Ex >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > >-- >-- > >"You can lead a horse to water but you cannot make it float
Re: Re: populate data for edit form
Here is my jsp part: Category Name: The code above is the same with the code for insert. Perhaps I'm forgetting something here. :( Dody. >Hello, Dody, > >This looks okay to me. What does your JSP page look like? > >Jack > > >On Wed, 12 Jan 2005 16:19:43 +0700, Dody Rachmat Wicaksono ><[EMAIL PROTECTED]> wrote: >> I'm trying to create an edit page. I think I already in the right direction, >> but still unable to populate data even with a direct value via action class. >> Please let me what's wrong here. I've spend 3 days alone with this problem. > > >Jack > >-- >-- > >"You can lead a horse to water but you cannot make it float on its back." > >~Dakota Jack~ > >"You can't wake a person who is pretending to be asleep." > >~Native Proverb~ > >"Each man is good in His sight. It is not necessary for eagles to be crows." > >~Hunkesni (Sitting Bull), Hunkpapa Sioux~ > >--- > >"This message may contain confidential and/or privileged information. >If you are not the addressee or authorized to receive this for the >addressee, you must not use, copy, disclose, or take any action based >on this message or any information herein. If you have received this >message in error, please advise the sender immediately by reply e-mail >and delete this message. Thank you for your cooperation." > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > = = = = = = = = = = = = = = = = = = = = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: populate data for edit form
Here is my jsp part: Category Name: The code above is the same with the code for insert. Perhaps I'm forgetting something here. :( Dody. >Hello, Dody, > >This looks okay to me. What does your JSP page look like? > >Jack > > >On Wed, 12 Jan 2005 16:19:43 +0700, Dody Rachmat Wicaksono ><[EMAIL PROTECTED]> wrote: >> I'm trying to create an edit page. I think I already in the right direction, >> but still unable to populate data even with a direct value via action class. >> Please let me what's wrong here. I've spend 3 days alone with this problem. > > >Jack > >-- >-- > >"You can lead a horse to water but you cannot make it float on its back." > >~Dakota Jack~ > >"You can't wake a person who is pretending to be asleep." > >~Native Proverb~ > >"Each man is good in His sight. It is not necessary for eagles to be crows." > >~Hunkesni (Sitting Bull), Hunkpapa Sioux~ > >--- > >"This message may contain confidential and/or privileged information. >If you are not the addressee or authorized to receive this for the >addressee, you must not use, copy, disclose, or take any action based >on this message or any information herein. If you have received this >message in error, please advise the sender immediately by reply e-mail >and delete this message. Thank you for your cooperation." > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > = = = = = = = = = = = = = = = = = = = = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: populate data for edit form
I'll be! Never used "attribute" either. Thanks. Jack On Wed, 12 Jan 2005 08:19:25 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote: > The problem is that you are specifying the "attribute" value for one > of your action mappings, but not for the other. For the first (setup > action), because no "attribute" value is set in the ActionMapping, > Struts looks in the request for a bean under the form's name > "categoryEditForm". If it doesn't find one, it creates one and puts > it there, so that by the time your Action's execute method is called, > the ActionForm passed in the signature is also in the request under > that attribute name. > > Then, when the JSP renders, the html:form tag uses its action > attribute to look up the ActionMapping for the submission > ("/categoryEdit"). This ActionMapping specifies that its form bean > should be stored under the attribute name "val_categoryEdit". There > is nothing in the request under that name, so Struts creates a new > form, which is not initialized, and uses it for prepopulating form > field values. > > Again, if you do not specify an "attribute" in an element, > the value defaults to the form's name (as specified in the 's > "name" attribute). I have never had a reason to specify "attribute" > in the element, but if you do, you need it to be consistent > between the actions that are cooperating. > > Hope this helps, > Joe > > > At 4:19 PM +0700 1/12/05, Dody Rachmat Wicaksono wrote: > >I'm trying to create an edit page. I think I already in the right > >direction, but still unable to populate data even with a direct > >value via action class. Please let me what's wrong here. I've spend > >3 days alone with this problem. > >Thank you. > > > > > >I created two action file: > >- SetUpCategoryEditAction.java (this action will populate data from > >db to form) > >- CategoryEditAction.java (this action will save the data) > > > >My formbean: CategoryEditForm.java > >-- > >public class CategoryEditForm extends ValidatorForm { > > private String name; > > private String categoryId; > > > > public void setName(String s) { > > this.name = s; > > } > > public String getName() { > > return name; > > } > > public void setcategoryId(String s) { > > this.categoryId = s; > > } > > public String getcategoryId() { > > return categoryId; > > } > >} > > > > > >My struts-config.xml > >-- > > >type="com.strutsgen.garuda.CategoryEditForm"/> > > > > > type="com.strutsgen.garuda.SetUpCategoryEditAction" > > name="categoryEditForm" > > scope="request" > > validate="false" > > > > > > name="continue" > > path="/categoryEditForm.jsp"/> > > > > > > > type="com.strutsgen.garuda.CategoryEditAction" > > name="categoryEditForm" > > attribute="val_categoryEdit" > > scope="request" > > validate="true" > > input="/categoryEditForm.jsp" > > > > > > name="success" > > path="/categoryEditOk.jsp"/> > > > > > > > >SetUpCategoryEditAction.java: > >-- > >public final class SetUpCategoryEditAction extends Action { > > > > public ActionForward execute(ActionMapping mapping, > > ActionForm form, > > HttpServletRequest request, > > HttpServletResponse response) > > throws Exception { > > > > CategoryEditForm categoryEditForm = (CategoryEditForm)form; > > categoryEditForm.setName("testing"); > > > > return (mapping.findForward("continue")); > > } > >} > > > > > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > -- > Joe Germuska > [EMAIL PROTECTED] > http://blog.germuska.com > "Narrow minds are weapons made for mass destruction" -The Ex > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ "You can't wake a person who is pretending to be asleep." ~Native Proverb~ "Each man is good in His sight. It is not necessary for eagles to be crows." ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- "This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any informa
Re: populate data for edit form
The problem is that you are specifying the "attribute" value for one of your action mappings, but not for the other. For the first (setup action), because no "attribute" value is set in the ActionMapping, Struts looks in the request for a bean under the form's name "categoryEditForm". If it doesn't find one, it creates one and puts it there, so that by the time your Action's execute method is called, the ActionForm passed in the signature is also in the request under that attribute name. Then, when the JSP renders, the html:form tag uses its action attribute to look up the ActionMapping for the submission ("/categoryEdit"). This ActionMapping specifies that its form bean should be stored under the attribute name "val_categoryEdit". There is nothing in the request under that name, so Struts creates a new form, which is not initialized, and uses it for prepopulating form field values. Again, if you do not specify an "attribute" in an element, the value defaults to the form's name (as specified in the 's "name" attribute). I have never had a reason to specify "attribute" in the element, but if you do, you need it to be consistent between the actions that are cooperating. Hope this helps, Joe At 4:19 PM +0700 1/12/05, Dody Rachmat Wicaksono wrote: I'm trying to create an edit page. I think I already in the right direction, but still unable to populate data even with a direct value via action class. Please let me what's wrong here. I've spend 3 days alone with this problem. Thank you. I created two action file: - SetUpCategoryEditAction.java (this action will populate data from db to form) - CategoryEditAction.java (this action will save the data) My formbean: CategoryEditForm.java -- public class CategoryEditForm extends ValidatorForm { private String name; private String categoryId; public void setName(String s) { this.name = s; } public String getName() { return name; } public void setcategoryId(String s) { this.categoryId = s; } public String getcategoryId() { return categoryId; } } My struts-config.xml -- SetUpCategoryEditAction.java: -- public final class SetUpCategoryEditAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CategoryEditForm categoryEditForm = (CategoryEditForm)form; categoryEditForm.setName("testing"); return (mapping.findForward("continue")); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: populate data for edit form
Hello, Dody, This looks okay to me. What does your JSP page look like? Jack On Wed, 12 Jan 2005 16:19:43 +0700, Dody Rachmat Wicaksono <[EMAIL PROTECTED]> wrote: > I'm trying to create an edit page. I think I already in the right direction, > but still unable to populate data even with a direct value via action class. > Please let me what's wrong here. I've spend 3 days alone with this problem. Jack -- -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ "You can't wake a person who is pretending to be asleep." ~Native Proverb~ "Each man is good in His sight. It is not necessary for eagles to be crows." ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- "This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation." - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: populate data for edit form
Doesn't the framework do the setting of this attribute, Pedro? Jack On Wed, 12 Jan 2005 10:23:10 +0100, Pedro Salgado <[EMAIL PROTECTED]> wrote: > request.setAttribute("categoryEditForm", form); > -- -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ "You can't wake a person who is pretending to be asleep." ~Native Proverb~ "Each man is good in His sight. It is not necessary for eagles to be crows." ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- "This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation." - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: populate data for edit form
Thank you for your help, but the form still blank. I also tried using session (in struts-config.xml and session.setAttribute()) but still blank. request.setAttribute("categoryEditForm", form); Dody. >> CategoryEditForm categoryEditForm = (CategoryEditForm)form; >> categoryEditForm.setName("testing"); >> > >request.setAttribute("categoryEditForm", form); > >> return (mapping.findForward("continue")); > > I think that will do ;) > >Pedro Salgado > >On 12/1/05 10:19 am, "Dody Rachmat Wicaksono" <[EMAIL PROTECTED]> wrote: > >> I'm trying to create an edit page. I think I already in the right direction, >> but still unable to populate data even with a direct value via action class. >> Please let me what's wrong here. I've spend 3 days alone with this problem. >> Thank you. >> >> >> I created two action file: >> - SetUpCategoryEditAction.java (this action will populate data from db to >> form) >> - CategoryEditAction.java (this action will save the data) >> >> My formbean: CategoryEditForm.java >> -- >> public class CategoryEditForm extends ValidatorForm { >> private String name; >> private String categoryId; >> >> public void setName(String s) { >> this.name = s; >> } >> public String getName() { >> return name; >> } >> public void setcategoryId(String s) { >> this.categoryId = s; >> } >> public String getcategoryId() { >> return categoryId; >> } >> } >> >> >> My struts-config.xml >> -- >> > type="com.strutsgen.garuda.CategoryEditForm"/> >> >> > type="com.strutsgen.garuda.SetUpCategoryEditAction" >> name="categoryEditForm" >> scope="request" >> validate="false" >>> >> > name="continue" >> path="/categoryEditForm.jsp"/> >> >> >> > type="com.strutsgen.garuda.CategoryEditAction" >> name="categoryEditForm" >> attribute="val_categoryEdit" >> scope="request" >> validate="true" >> input="/categoryEditForm.jsp" >>> >> > name="success" >> path="/categoryEditOk.jsp"/> >> >> >> >> SetUpCategoryEditAction.java: >> -- >> public final class SetUpCategoryEditAction extends Action { >> >> public ActionForward execute(ActionMapping mapping, >>ActionForm form, >>HttpServletRequest request, >>HttpServletResponse response) >> throws Exception { >> >> CategoryEditForm categoryEditForm = (CategoryEditForm)form; >> categoryEditForm.setName("testing"); >> >> return (mapping.findForward("continue")); >> } >> } >> >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > = = = = = = = = = = = = = = = = = = = = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: populate data for edit form
Thank you for your help, but the form still blank. I also tried using session (in struts-config.xml and session.setAttribute()) but still blank. request.setAttribute("categoryEditForm", form); Dody. >> CategoryEditForm categoryEditForm = (CategoryEditForm)form; >> categoryEditForm.setName("testing"); >> > >request.setAttribute("categoryEditForm", form); > >> return (mapping.findForward("continue")); > > I think that will do ;) > >Pedro Salgado > >On 12/1/05 10:19 am, "Dody Rachmat Wicaksono" <[EMAIL PROTECTED]> wrote: > >> I'm trying to create an edit page. I think I already in the right direction, >> but still unable to populate data even with a direct value via action class. >> Please let me what's wrong here. I've spend 3 days alone with this problem. >> Thank you. >> >> >> I created two action file: >> - SetUpCategoryEditAction.java (this action will populate data from db to >> form) >> - CategoryEditAction.java (this action will save the data) >> >> My formbean: CategoryEditForm.java >> -- >> public class CategoryEditForm extends ValidatorForm { >> private String name; >> private String categoryId; >> >> public void setName(String s) { >> this.name = s; >> } >> public String getName() { >> return name; >> } >> public void setcategoryId(String s) { >> this.categoryId = s; >> } >> public String getcategoryId() { >> return categoryId; >> } >> } >> >> >> My struts-config.xml >> -- >> > type="com.strutsgen.garuda.CategoryEditForm"/> >> >> > type="com.strutsgen.garuda.SetUpCategoryEditAction" >> name="categoryEditForm" >> scope="request" >> validate="false" >>> >> > name="continue" >> path="/categoryEditForm.jsp"/> >> >> >> > type="com.strutsgen.garuda.CategoryEditAction" >> name="categoryEditForm" >> attribute="val_categoryEdit" >> scope="request" >> validate="true" >> input="/categoryEditForm.jsp" >>> >> > name="success" >> path="/categoryEditOk.jsp"/> >> >> >> >> SetUpCategoryEditAction.java: >> -- >> public final class SetUpCategoryEditAction extends Action { >> >> public ActionForward execute(ActionMapping mapping, >>ActionForm form, >>HttpServletRequest request, >>HttpServletResponse response) >> throws Exception { >> >> CategoryEditForm categoryEditForm = (CategoryEditForm)form; >> categoryEditForm.setName("testing"); >> >> return (mapping.findForward("continue")); >> } >> } >> >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > = = = = = = = = = = = = = = = = = = = = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: populate data for edit form
I think you could also try this... I think it will also work (maybe you should then switch from request.setAttribute to session.setAttribute... but I donĀ¹t remember). Pedro Salgado - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: populate data for edit form
> > CategoryEditForm categoryEditForm = (CategoryEditForm)form; > categoryEditForm.setName("testing"); > request.setAttribute("categoryEditForm", form); > return (mapping.findForward("continue")); I think that will do ;) Pedro Salgado On 12/1/05 10:19 am, "Dody Rachmat Wicaksono" <[EMAIL PROTECTED]> wrote: > I'm trying to create an edit page. I think I already in the right direction, > but still unable to populate data even with a direct value via action class. > Please let me what's wrong here. I've spend 3 days alone with this problem. > Thank you. > > > I created two action file: > - SetUpCategoryEditAction.java (this action will populate data from db to > form) > - CategoryEditAction.java (this action will save the data) > > My formbean: CategoryEditForm.java > -- > public class CategoryEditForm extends ValidatorForm { > private String name; > private String categoryId; > > public void setName(String s) { > this.name = s; > } > public String getName() { > return name; > } > public void setcategoryId(String s) { > this.categoryId = s; > } > public String getcategoryId() { > return categoryId; > } > } > > > My struts-config.xml > -- > type="com.strutsgen.garuda.CategoryEditForm"/> > > type="com.strutsgen.garuda.SetUpCategoryEditAction" > name="categoryEditForm" > scope="request" > validate="false" >> > name="continue" > path="/categoryEditForm.jsp"/> > > > type="com.strutsgen.garuda.CategoryEditAction" > name="categoryEditForm" > attribute="val_categoryEdit" > scope="request" > validate="true" > input="/categoryEditForm.jsp" >> > name="success" > path="/categoryEditOk.jsp"/> > > > > SetUpCategoryEditAction.java: > -- > public final class SetUpCategoryEditAction extends Action { > > public ActionForward execute(ActionMapping mapping, >ActionForm form, >HttpServletRequest request, >HttpServletResponse response) > throws Exception { > > CategoryEditForm categoryEditForm = (CategoryEditForm)form; > categoryEditForm.setName("testing"); > > return (mapping.findForward("continue")); > } > } > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]