Re: Re: how to get data from http get / url?
Thank you, it's true that creating formbean for simple task such as http://localhost/detail.do?id=99 is too much efford. i'd like to use your suggession. thanks. === At 2005-01-13, 08:58:16 you wrote: === There might be a few ways, but from my exprience.. String sid = request.getParameter(id); or editFormsform = (editForm)form; String sid = sform.getUserid(); - Original Message - From: Dody Rachmat Wicaksono [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, January 13, 2005 2:42 AM Subject: how to get data from http get / url? What should i do to get the value from url? ex: http://localhost:8080/st/editForm.do?id=99 how to get the id value? Thank you in advance. Dody - 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: how to get data from http get / url?
Thank you, it's true that creating formbean for simple task such as http://localhost/detail.do?id=99 is too much efford. i'd like to use your suggession. thanks. === At 2005-01-13, 08:58:16 you wrote: === There might be a few ways, but from my exprience.. String sid = request.getParameter(id); or editFormsform = (editForm)form; String sid = sform.getUserid(); - Original Message - From: Dody Rachmat Wicaksono [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, January 13, 2005 2:42 AM Subject: how to get data from http get / url? What should i do to get the value from url? ex: http://localhost:8080/st/editForm.do?id=99 how to get the id value? Thank you in advance. Dody - 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]
populate data for edit form
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 -- form-bean name=categoryEditForm type=com.strutsgen.garuda.CategoryEditForm/ action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /action 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]
populate data for edit form
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 -- form-bean name=categoryEditForm type=com.strutsgen.garuda.CategoryEditForm/ action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /action 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]
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 -- form-bean name=categoryEditForm type=com.strutsgen.garuda.CategoryEditForm/ action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /action 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 -- form-bean name=categoryEditForm type=com.strutsgen.garuda.CategoryEditForm/ action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /action 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
Here is my jsp part: html:form action=categoryEdit focus=name table tr td Category Name:/td tdhtml:text property=name//td /tr /table html:submitbean:message key=button.submit//html:submit /html:form 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 snip 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. /snip 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: html:form action=categoryEdit focus=name table tr td Category Name:/td tdhtml:text property=name//td /tr /table html:submitbean:message key=button.submit//html:submit /html:form 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 snip 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. /snip 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
Thank you everyone. The problem is solved. Now i set the same attribute for both action. action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /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 action element, the value defaults to the form's name (as specified in the action's name attribute). I have never had a reason to specify attribute in the action 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 -- form-bean name=categoryEditForm type=com.strutsgen.garuda.CategoryEditForm/ action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /action 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
Re: Re: populate data for edit form
Thank you everyone. The problem is solved. Now i set the same attribute for both action. action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /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 action element, the value defaults to the form's name (as specified in the action's name attribute). I have never had a reason to specify attribute in the action 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 -- form-bean name=categoryEditForm type=com.strutsgen.garuda.CategoryEditForm/ action path=/setUpCategoryEditForm type=com.strutsgen.garuda.SetUpCategoryEditAction name=categoryEditForm scope=request validate=false forward name=continue path=/categoryEditForm.jsp/ /action action path=/categoryEdit type=com.strutsgen.garuda.CategoryEditAction name=categoryEditForm attribute=val_categoryEdit scope=request validate=true input=/categoryEditForm.jsp forward name=success path=/categoryEditOk.jsp/ /action 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
how to get data from http get / url?
What should i do to get the value from url? ex: http://localhost:8080/st/editForm.do?id=99 how to get the id value? Thank you in advance. Dody - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to get data from http get / url?
What should i do to get the value from url? ex: http://localhost:8080/st/editForm.do?id=99 how to get the id value? Thank you in advance. Dody - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re:how to get data from http get / url?
Thank you, it work. Dody. === At 2005-01-13, 01:46:52 you wrote: === just use the getter method of your formBean. Depend on u use dynaactionform or not.If u do not ,use getId() of your formBean. regards -- Initial Header --- From : Dody Rachmat Wicaksono [EMAIL PROTECTED] To : Struts Users Mailing List user@struts.apache.org Cc : Date : Thu, 13 Jan 2005 01:42:53 +0700 Subject : how to get data from http get / url? What should i do to get the value from url? ex: http://localhost:8080/st/editForm.do?id=99 how to get the id value? Thank you in advance. Dody - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Libero ADSL: 3 mesi gratis e navighi a 1.2 Mega. E poi hai l'Adsl senza limiti a meno di 1 euro al giorno. Abbonati subito senza costi di attivazione su http://www.libero.it - 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:how to get data from http get / url?
Thank you, it work. Dody. === At 2005-01-13, 01:46:52 you wrote: === just use the getter method of your formBean. Depend on u use dynaactionform or not.If u do not ,use getId() of your formBean. regards -- Initial Header --- From : Dody Rachmat Wicaksono [EMAIL PROTECTED] To : Struts Users Mailing List user@struts.apache.org Cc : Date : Thu, 13 Jan 2005 01:42:53 +0700 Subject : how to get data from http get / url? What should i do to get the value from url? ex: http://localhost:8080/st/editForm.do?id=99 how to get the id value? Thank you in advance. Dody - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Libero ADSL: 3 mesi gratis e navighi a 1.2 Mega. E poi hai l'Adsl senza limiti a meno di 1 euro al giorno. Abbonati subito senza costi di attivazione su http://www.libero.it - 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]