Re: array of indexed html:text values not submitting
I've never looked at the DynaForm code too closely, but it must do this, because I use DynaForms with indexed properties all over the place. Matt [EMAIL PROTECTED] wrote: Not sure how the dyna forms work, but you will need to check it generates a getItem(int num) method - this will be called when populating item[0].quantity ie getItem(0).setQuantity(value). cheers, David |-+> | | [EMAIL PROTECTED]| | | net | | || | | 09/21/2004 12:50 | | | PM | | | Please respond to| | | "Struts Users| | | Mailing List"| | || |-+> >| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: Re: array of indexed html:text values not submitting | >| I caught the DynaValidatorActionForm/DynaValidatorForm problem too after I sent out the email and corrected it but it didn't help. Here are a few lines of my JSP (which should explain the item/items question): and here's the resulting html: BTW: I tried updating my struts libs to 1.2.4 but that didn't help. I also put a String into the Items formbean and a corresponding textfield on the page and that data passes through just fine. It's only the item[x] changes that fail. Thanks, Brady I see 2 things wrong right now - first is that you are using a DynaValidatorActionForm in your form-bean definition, but a DynaValidatorForm to cast the form in your loader and action code. This is not the cause of your problem I think, just something to watch out for. The second is that I'm not entirely sure how those form variables got generated - based on what I see in your form-bean definition and in your java code, the form property you are loading with this data is called "items" - the form is apparently generating input tags with "item[x].ID" (etc.) as the name, instead of "items[x].ID" (etc.) as the name. This would most explain why when you read the form data it is just reading the default instead of what you changed it to in the form. If neither of these helped, I would say that we also need to see a cut/paste of the JSP for the form, and a cut/paste of what gets generated to the brower. Matt [EMAIL PROTECTED] wrote: Thanks for the reply. Here are the relevant sections of LoadAction and PersistAction: LoadAction: public ActionForward execute( >> ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm)form; SimpleItem[] itemsArray = new SimpleItem[2]; itemsArray[0] = new SimpleItem(); itemsArray[0].setQuantity("10"); itemsArray[0].setPrice("45.0"); itemsArray[1] = new SimpleItem(); itemsArray[1].setQuantity(""); itemsArray[1].setPrice("225.0"); passForm.set( "items", itemsArray ); return mapping.findForward( "success" ); } PersistAction: public ActionForward execute( >> ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm) form; SimpleItem[] itemArray = (SimpleItem[])passForm.get("items"); return mapping.findForward(forward); } I'm working from the examples here: http://www.developer.com/java/ejb/article.php/3321521 I have an array of values that are sent to a page for editing. The page is coming up ok with the correct text box values as seen below (item[0].xxx, etc). But when the form is submitted the changes don't show up in PersistEditAction. The form contains the original data just as it was before the forward from LoadEditAction. Thanks for any help, Brady Is it possible you can post the relevant parts of LoadEditAction and PersistEditAction? Without those I don't think anybody will be able to help. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c
Re: array of indexed html:text values not submitting
Not sure how the dyna forms work, but you will need to check it generates a getItem(int num) method - this will be called when populating item[0].quantity ie getItem(0).setQuantity(value). cheers, David |-+> | | [EMAIL PROTECTED]| | | net | | || | | 09/21/2004 12:50 | | | PM | | | Please respond to| | | "Struts Users| | | Mailing List"| | || |-+> >| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: Re: array of indexed html:text values not submitting | >| I caught the DynaValidatorActionForm/DynaValidatorForm problem too after I sent out the email and corrected it but it didn't help. Here are a few lines of my JSP (which should explain the item/items question): and here's the resulting html: BTW: I tried updating my struts libs to 1.2.4 but that didn't help. I also put a String into the Items formbean and a corresponding textfield on the page and that data passes through just fine. It's only the item[x] changes that fail. Thanks, Brady > I see 2 things wrong right now - first is that you are using a > DynaValidatorActionForm in your form-bean definition, but a > DynaValidatorForm to cast the form in your loader and action code. This > is not the cause of your problem I think, just something to watch out for. > > The second is that I'm not entirely sure how those form variables got > generated - based on what I see in your form-bean definition and in your > java code, the form property you are loading with this data is called > "items" - the form is apparently generating input tags with "item[x].ID" > (etc.) as the name, instead of "items[x].ID" (etc.) as the name. This > would most explain why when you read the form data it is just reading > the default instead of what you changed it to in the form. > > If neither of these helped, I would say that we also need to see a > cut/paste of the JSP for the form, and a cut/paste of what gets > generated to the brower. > > Matt > > > > > > > [EMAIL PROTECTED] wrote: > >> Thanks for the reply. Here are the relevant sections of LoadAction and >> PersistAction: >> >> LoadAction: >> public ActionForward execute( >> ActionMapping mapping, >>ActionForm form, >>HttpServletRequest request, >>HttpServletResponse response) >>throws Exception { >> >>DynaValidatorForm passForm = (DynaValidatorForm)form; >> >>SimpleItem[] itemsArray = new SimpleItem[2]; >> >>itemsArray[0] = new SimpleItem(); >>itemsArray[0].setQuantity("10"); >>itemsArray[0].setPrice("45.0"); >> >>itemsArray[1] = new SimpleItem(); >>itemsArray[1].setQuantity(""); >>itemsArray[1].setPrice("225.0"); >> >>passForm.set( "items", itemsArray ); >> >>return mapping.findForward( "success" ); >> } >> >> >> PersistAction: >> public ActionForward execute( >> ActionMapping mapping, >>ActionForm form, >>HttpServletRequest request, >>HttpServletResponse response) >>throws Exception { >> >>DynaValidatorForm passForm = (DynaValidatorForm) form; >> >>SimpleItem[] itemArray = (SimpleItem[])passForm.get("items"); >> >>return mapping.findForward(forward); >> } >> >> >>>>I'm working from the examples here: >>>>http://www.developer.com/java/ejb/article.php/3321521 >>>> >>>>I have an array of values that are sent to a page for editing. The >>>> page >>>>is coming up ok with the correct text box values as seen below >>>>(item[0].xxx, etc). But when the form is submitted the changes do
Re: array of indexed html:text values not submitting
Matt Bathje wrote: I really think the inconsistent usage of item/items is your problem here. Try changing the c:forEach var="item" to be var="items" and then change your html:text name="item" to have name="items". The name for the html:text needs to generate the form-property from your form bean definition for this to work correctly. I just realized this sentence makes no sense...so...The name for the html:text needs to match what is in the form-property from your form bean definition for this to work correctly. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: array of indexed html:text values not submitting
I really think the inconsistent usage of item/items is your problem here. Try changing the c:forEach var="item" to be var="items" and then change your html:text name="item" to have name="items". The name for the html:text needs to generate the form-property from your form bean definition for this to work correctly. Matt [EMAIL PROTECTED] wrote: I caught the DynaValidatorActionForm/DynaValidatorForm problem too after I sent out the email and corrected it but it didn't help. Here are a few lines of my JSP (which should explain the item/items question): and here's the resulting html: BTW: I tried updating my struts libs to 1.2.4 but that didn't help. I also put a String into the Items formbean and a corresponding textfield on the page and that data passes through just fine. It's only the item[x] changes that fail. Thanks, Brady I see 2 things wrong right now - first is that you are using a DynaValidatorActionForm in your form-bean definition, but a DynaValidatorForm to cast the form in your loader and action code. This is not the cause of your problem I think, just something to watch out for. The second is that I'm not entirely sure how those form variables got generated - based on what I see in your form-bean definition and in your java code, the form property you are loading with this data is called "items" - the form is apparently generating input tags with "item[x].ID" (etc.) as the name, instead of "items[x].ID" (etc.) as the name. This would most explain why when you read the form data it is just reading the default instead of what you changed it to in the form. If neither of these helped, I would say that we also need to see a cut/paste of the JSP for the form, and a cut/paste of what gets generated to the brower. Matt [EMAIL PROTECTED] wrote: Thanks for the reply. Here are the relevant sections of LoadAction and PersistAction: LoadAction: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm)form; SimpleItem[] itemsArray = new SimpleItem[2]; itemsArray[0] = new SimpleItem(); itemsArray[0].setQuantity("10"); itemsArray[0].setPrice("45.0"); itemsArray[1] = new SimpleItem(); itemsArray[1].setQuantity(""); itemsArray[1].setPrice("225.0"); passForm.set( "items", itemsArray ); return mapping.findForward( "success" ); } PersistAction: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm) form; SimpleItem[] itemArray = (SimpleItem[])passForm.get("items"); return mapping.findForward(forward); } I'm working from the examples here: http://www.developer.com/java/ejb/article.php/3321521 I have an array of values that are sent to a page for editing. The page is coming up ok with the correct text box values as seen below (item[0].xxx, etc). But when the form is submitted the changes don't show up in PersistEditAction. The form contains the original data just as it was before the forward from LoadEditAction. Thanks for any help, Brady Is it possible you can post the relevant parts of LoadEditAction and PersistEditAction? Without those I don't think anybody will be able to help. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: array of indexed html:text values not submitting
I caught the DynaValidatorActionForm/DynaValidatorForm problem too after I sent out the email and corrected it but it didn't help. Here are a few lines of my JSP (which should explain the item/items question): and here's the resulting html: BTW: I tried updating my struts libs to 1.2.4 but that didn't help. I also put a String into the Items formbean and a corresponding textfield on the page and that data passes through just fine. It's only the item[x] changes that fail. Thanks, Brady > I see 2 things wrong right now - first is that you are using a > DynaValidatorActionForm in your form-bean definition, but a > DynaValidatorForm to cast the form in your loader and action code. This > is not the cause of your problem I think, just something to watch out for. > > The second is that I'm not entirely sure how those form variables got > generated - based on what I see in your form-bean definition and in your > java code, the form property you are loading with this data is called > "items" - the form is apparently generating input tags with "item[x].ID" > (etc.) as the name, instead of "items[x].ID" (etc.) as the name. This > would most explain why when you read the form data it is just reading > the default instead of what you changed it to in the form. > > If neither of these helped, I would say that we also need to see a > cut/paste of the JSP for the form, and a cut/paste of what gets > generated to the brower. > > Matt > > > > > > > [EMAIL PROTECTED] wrote: > >> Thanks for the reply. Here are the relevant sections of LoadAction and >> PersistAction: >> >> LoadAction: >> public ActionForward execute( >> ActionMapping mapping, >> ActionForm form, >> HttpServletRequest request, >> HttpServletResponse response) >> throws Exception { >> >> DynaValidatorForm passForm = (DynaValidatorForm)form; >> >> SimpleItem[] itemsArray = new SimpleItem[2]; >> >> itemsArray[0] = new SimpleItem(); >> itemsArray[0].setQuantity("10"); >> itemsArray[0].setPrice("45.0"); >> >> itemsArray[1] = new SimpleItem(); >> itemsArray[1].setQuantity(""); >> itemsArray[1].setPrice("225.0"); >> >> passForm.set( "items", itemsArray ); >> >> return mapping.findForward( "success" ); >> } >> >> >> PersistAction: >> public ActionForward execute( >> ActionMapping mapping, >> ActionForm form, >> HttpServletRequest request, >> HttpServletResponse response) >> throws Exception { >> >> DynaValidatorForm passForm = (DynaValidatorForm) form; >> >> SimpleItem[] itemArray = (SimpleItem[])passForm.get("items"); >> >> return mapping.findForward(forward); >> } >> >> I'm working from the examples here: http://www.developer.com/java/ejb/article.php/3321521 I have an array of values that are sent to a page for editing. The page is coming up ok with the correct text box values as seen below (item[0].xxx, etc). But when the form is submitted the changes don't show up in PersistEditAction. The form contains the original data just as it was before the forward from LoadEditAction. Thanks for any help, Brady >>>name="Items" type="org.apache.struts.validator.DynaValidatorActionForm"> >>>type="com.litriusgroup.cart.hibernate.SimpleItem[]" /> >>>type="com.stuff.struts.LoadEditAction" name="Items" scope="session" validate="false"> >>>type="com.stuff.struts.PersistEditAction" name="Items" scope="session" validate="false"> >>> >>>Is it possible you can post the relevant parts of LoadEditAction and >>>PersistEditAction? Without those I don't think anybody will be able to >>>help. >>> >>>Matt >>> >>> >>> >>>- >>>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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: array of indexed html:text values not submitting
I see 2 things wrong right now - first is that you are using a DynaValidatorActionForm in your form-bean definition, but a DynaValidatorForm to cast the form in your loader and action code. This is not the cause of your problem I think, just something to watch out for. The second is that I'm not entirely sure how those form variables got generated - based on what I see in your form-bean definition and in your java code, the form property you are loading with this data is called "items" - the form is apparently generating input tags with "item[x].ID" (etc.) as the name, instead of "items[x].ID" (etc.) as the name. This would most explain why when you read the form data it is just reading the default instead of what you changed it to in the form. If neither of these helped, I would say that we also need to see a cut/paste of the JSP for the form, and a cut/paste of what gets generated to the brower. Matt [EMAIL PROTECTED] wrote: Thanks for the reply. Here are the relevant sections of LoadAction and PersistAction: LoadAction: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm)form; SimpleItem[] itemsArray = new SimpleItem[2]; itemsArray[0] = new SimpleItem(); itemsArray[0].setQuantity("10"); itemsArray[0].setPrice("45.0"); itemsArray[1] = new SimpleItem(); itemsArray[1].setQuantity(""); itemsArray[1].setPrice("225.0"); passForm.set( "items", itemsArray ); return mapping.findForward( "success" ); } PersistAction: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm) form; SimpleItem[] itemArray = (SimpleItem[])passForm.get("items"); return mapping.findForward(forward); } I'm working from the examples here: http://www.developer.com/java/ejb/article.php/3321521 I have an array of values that are sent to a page for editing. The page is coming up ok with the correct text box values as seen below (item[0].xxx, etc). But when the form is submitted the changes don't show up in PersistEditAction. The form contains the original data just as it was before the forward from LoadEditAction. Thanks for any help, Brady Is it possible you can post the relevant parts of LoadEditAction and PersistEditAction? Without those I don't think anybody will be able to help. Matt - 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: array of indexed html:text values not submitting
Thanks for the reply. Here are the relevant sections of LoadAction and PersistAction: LoadAction: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm)form; SimpleItem[] itemsArray = new SimpleItem[2]; itemsArray[0] = new SimpleItem(); itemsArray[0].setQuantity("10"); itemsArray[0].setPrice("45.0"); itemsArray[1] = new SimpleItem(); itemsArray[1].setQuantity(""); itemsArray[1].setPrice("225.0"); passForm.set( "items", itemsArray ); return mapping.findForward( "success" ); } PersistAction: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm passForm = (DynaValidatorForm) form; SimpleItem[] itemArray = (SimpleItem[])passForm.get("items"); return mapping.findForward(forward); } >> I'm working from the examples here: >> http://www.developer.com/java/ejb/article.php/3321521 >> >> I have an array of values that are sent to a page for editing. The page >> is coming up ok with the correct text box values as seen below >> (item[0].xxx, etc). But when the form is submitted the changes don't >> show up in PersistEditAction. The form contains the original data just >> as it was before the forward from LoadEditAction. >> >> Thanks for any help, >> Brady >> >> >> >> >> >> >> >> >> > name="Items" >> type="org.apache.struts.validator.DynaValidatorActionForm"> >> > type="com.litriusgroup.cart.hibernate.SimpleItem[]" /> >> >> >> > type="com.stuff.struts.LoadEditAction" >> name="Items" >> scope="session" >> validate="false"> >> >> >> > type="com.stuff.struts.PersistEditAction" >> name="Items" >> scope="session" >> validate="false"> >> >> >> >> > > > Is it possible you can post the relevant parts of LoadEditAction and > PersistEditAction? Without those I don't think anybody will be able to > help. > > Matt > > > > - > 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: array of indexed html:text values not submitting
[EMAIL PROTECTED] wrote: I'm working from the examples here: http://www.developer.com/java/ejb/article.php/3321521 I have an array of values that are sent to a page for editing. The page is coming up ok with the correct text box values as seen below (item[0].xxx, etc). But when the form is submitted the changes don't show up in PersistEditAction. The form contains the original data just as it was before the forward from LoadEditAction. Thanks for any help, Brady Is it possible you can post the relevant parts of LoadEditAction and PersistEditAction? Without those I don't think anybody will be able to help. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]