Re: Dynamic form fields on ActionForm
I thought there was something slightly awry in your thinking. I guess that's where examples really do help. Good luck with it, Adam On 10/09/2003 03:15 AM Cornellious Mann wrote: Adam, I missed the point about adding the index to the input field name. I was simply naming the field the same thing. It actually worked, but it worried me. Thansk for all of the help! :) --- Adam Hardy [EMAIL PROTECTED] wrote: They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e. the order they went out with remains the same when they come back in. I think you must be missing the point here somewhere On 10/08/2003 10:34 PM Cornellious Mann wrote: This worked. :) Do you know if the order is guaranteed? From my testing it looks like the values appear in the array in the same order the parameters in the URL line. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
This worked. :) Do you know if the order is guaranteed? From my testing it looks like the values appear in the array in the same order the parameters in the URL line. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e. the order they went out with remains the same when they come back in. I think you must be missing the point here somewhere On 10/08/2003 10:34 PM Cornellious Mann wrote: This worked. :) Do you know if the order is guaranteed? From my testing it looks like the values appear in the array in the same order the parameters in the URL line. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
I just did this, maybe an example will help Read the database and stuff the data into an arraylist. Stuff the arraylist into the form. Call the page and get something like this tr td class=datainput type=checkbox name=feelistinfo[0].associated value=Y checked=checked class=checkbox/td td class=datainput type=text name=feelistinfo[0].feeTypeDescription value=Application Fee/td td class=datainput type=text name=feelistinfo[0].price value=1300.0/td /tr tr td class=datainput type=checkbox name=feelistinfo[1].associated value=Y class=checkbox/td td class=datainput type=text name=feelistinfo[1].feeTypeDescription value=Appraisal Fee/td td class=datainput type=text name=feelistinfo[1].price value=0.0/td /tr change the data and submit.. Back in the action you can access the array in your form and loop through the values returned. Watch out for the checkboxes though since they dont return a value unless checked. If you want the detailed code for the different pieces let me know. --- Adam Hardy [EMAIL PROTECTED] wrote: They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e. the order they went out with remains the same when they come back in. I think you must be missing the point here somewhere On 10/08/2003 10:34 PM Cornellious Mann wrote: This worked. :) Do you know if the order is guaranteed? From my testing it looks like the values appear in the array in the same order the parameters in the URL line. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com
Re: Dynamic form fields on ActionForm
I guess my question about order was more of HTML/submit question than a question about arrays. I just want to guarantee that the order of the values being sumitted stay in the order they are on the page. I was simply giving every input field the same name such as product and catching the values in a String array in the ActionForm. I needed to worry about sort order in order to associate the values to their ids. Great example, I didn't think of creating an array of object like you to keep all of the data on one record together. --- Lynn Guy [EMAIL PROTECTED] wrote: I just did this, maybe an example will help Read the database and stuff the data into an arraylist. Stuff the arraylist into the form. Call the page and get something like this tr td class=datainput type=checkbox name=feelistinfo[0].associated value=Y checked=checked class=checkbox/td td class=datainput type=text name=feelistinfo[0].feeTypeDescription value=Application Fee/td td class=datainput type=text name=feelistinfo[0].price value=1300.0/td /tr tr td class=datainput type=checkbox name=feelistinfo[1].associated value=Y class=checkbox/td td class=datainput type=text name=feelistinfo[1].feeTypeDescription value=Appraisal Fee/td td class=datainput type=text name=feelistinfo[1].price value=0.0/td /tr change the data and submit.. Back in the action you can access the array in your form and loop through the values returned. Watch out for the checkboxes though since they dont return a value unless checked. If you want the detailed code for the different pieces let me know. --- Adam Hardy [EMAIL PROTECTED] wrote: They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e. the order they went out with remains the same when they come back in. I think you must be missing the point here somewhere On 10/08/2003 10:34 PM Cornellious Mann wrote: This worked. :) Do you know if the order is guaranteed? From my testing it looks like the values appear in the array in the same order the parameters in the URL line. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Adam, I missed the point about adding the index to the input field name. I was simply naming the field the same thing. It actually worked, but it worried me. Thansk for all of the help! :) --- Adam Hardy [EMAIL PROTECTED] wrote: They're indexed! 0 becomes 0, 1 becomes 1 etc., i.e. the order they went out with remains the same when they come back in. I think you must be missing the point here somewhere On 10/08/2003 10:34 PM Cornellious Mann wrote: This worked. :) Do you know if the order is guaranteed? From my testing it looks like the values appear in the array in the same order the parameters in the URL line. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes, but because they're indexed, you will see the result as an array. On 10/08/2003 07:45 PM Cornellious Mann wrote: I'm not sure about one thing though. If I name all of my inputs on the HTML page the same name, when I submit the form, won't only one of the inputs be passed along? --- Adam Hardy [EMAIL PROTECTED] wrote: I think I see what you mean. If all you want is a list of product Id's and the number of units per id, then your priority is to use indexed properties, rather than DynaForm or normal Form. If you are using indexed properties, you just name the field one name, e.g. productId, and the indexing gives the field unique names when in a list, e.g. productId[0], productId[1] etc. Similarly with units[0], units[1] On 10/08/2003 04:47 PM Cornellious Mann wrote: Currently, we are a stateless application. So on each request we will read the database and get a list of products. Then our JSP will generate a from a list of products. Each product will have an input that can accept the number of units per product. The problem I have is that each input field needs a different name. How can I map these different names back to a list on a ActionForm? Also, I don't really see how DynaForm helps this problem. --- Adam Hardy [EMAIL PROTECTED] wrote: Yes you can have indexed properties dynaforms. I do not use them, I prefer nested properties. But I think the docs are quite good on this topic. Re: your problem, I was just asking about categories because I have no concept of how your database stores your products. Looking at your database should give you ideas how to design the data model in your business view layers. Do you store / 'persist' your products somehow? Or do they only last as long as the user's session? Do you use a database? On 10/08/2003 03:01 PM Cornellious Mann wrote: All we have is a product ID. There is no category. How do you think category could help? Also, have you used an indexed property and DynaForm? --- Adam Hardy [EMAIL PROTECTED] wrote: Still it depends. How does the database handle the new products? Can you at least categorise them? On 10/08/2003 06:19 AM Cornellious Mann wrote: Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From === message truncated === = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic form fields on ActionForm
I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form fields on ActionForm
Indexed form property is what you want.. I'll avoid any clever explanations, grandiose meta language or to try and sell you a book.. And give you an example.. form-bean name=productForm form-property name=product type=java.util.ArrayList / .. action name=productForm path=/products scope=session... ... DynaActionForm theForm = (DynaActionForm) form; ArrayList productList = theForm.set(product,productList); //and for some stange reason.. try without the following first session.setAttribute(product,productList); ... logic:iterate id=product name=productForm property=product html:text name=product property=price / ... DynaActionForm theForm = (DynaActionForm) form; ArrayList productList = (ArrayList) theForm.get(product); for(int i = 0;i productList.size();i++) { Product prod = (Product) productList.get(i); System.out.println( prod.getPrice() ); } ... This should help.. Cheers Mark On Tuesday, October 7, 2003, at 08:48 PM, Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - 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: Dynamic form fields on ActionForm
Unfortunately, products can be added at runtime and therefore I don't know what the full set is. From the research I have done it sounds like ActionForms can not handle this situation and I will need to handle it myself in the Action. Do you agree? --- Adam Hardy [EMAIL PROTECTED] wrote: Hi Cornellious, it depends whether you know beforehand what the full set of possible fields could be, or whether the fields themselves are not limited in name or type. If the former, then it would be easy to make a form that defined them all, and to use logic tags to display the needed fields or not in JSP. Adam On 10/07/2003 09:48 PM Cornellious Mann wrote: I am wondering what is the best approach to handle dynamic form fields within an ActionForm. I have a JSP page that will display quantity input fields for a dynamic list of products. I don't know how many products will be in the list until runtime. How can I set up my ActionForm to handle the list in input parameters? Thanks for any help. = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Best Regards, Cornellious Mann __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]