Dynamic form Generation using Struts FrameWork..............
Hi All, I am a new Bie at Struts Application. I want to develop a dynmic form by using Struts Framework.How shall I proceed in that ? It will be always appericiable to put your valuable Suggestion to it. Thankx in advance best regds, Amol - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic form, initial value for String[] property?
I'm trying to use a String[] property and preselect the none option which corresponds to an empty String. If it were a simple string property, I could do: form-property name=account type=java.lang.String initial= / What do I put in the 'initial' attribute for this one? form-property name=accounts type=java.lang.String[] initial=??? / Essentially, I need this: new String[] { }; -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamic form
Hi all I have a form which has as many fields as are informed in a previous form. For instance: form 1 asks the number of fields i want in form 2. After inputting that number, i go to form 2, and there I must find the number of fields (same fields, they are going to be indexed=true). What should I implement in the ActionForm class to handle such fields? How to catch such fields in the ActionForm class and in the Action class? Thanks a lot Otávio Augusto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: dynamic form
Use indices properties... Danny Trieu Internet Business Group Downey Savings and Loan Association, F.A. [EMAIL PROTECTED] (949) 509-4564 The beginning of knowledge is the discovery of something we do not understand. - Frank Herbert (1920-1986) The essence of knowledge is, having it, to apply it; not having it, to confess your ignorance. - Confucius (551-479 BC) -Original Message- From: Otávio Augusto [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 7:29 AM To: [EMAIL PROTECTED] Subject: dynamic form Hi all I have a form which has as many fields as are informed in a previous form. For instance: form 1 asks the number of fields i want in form 2. After inputting that number, i go to form 2, and there I must find the number of fields (same fields, they are going to be indexed=true). What should I implement in the ActionForm class to handle such fields? How to catch such fields in the ActionForm class and in the Action class? Thanks a lot Otávio Augusto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message and any attachments are for the intended recipient(s) only and may contain privileged, confidential and/or proprietary information about Downey Savings or its customers, which Downey Savings does not intend to disclose to the public. If you received this message by mistake, please notify the sender by reply e-mail and delete the message and attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic form
I don't understand what you mean. I know how to index the properties inside the iterator tag.but how to declare those properties dynamically in the ActionForm class? Thanks Otávio Augusto On Fri, 16 Jan 2004 08:56:16 -0800 Trieu, Danny [EMAIL PROTECTED] wrote: Use indices properties... Danny Trieu Internet Business Group Downey Savings and Loan Association, F.A. [EMAIL PROTECTED] (949) 509-4564 The beginning of knowledge is the discovery of something we do not understand. - Frank Herbert (1920-1986) The essence of knowledge is, having it, to apply it; not having it, to confess your ignorance. - Confucius (551-479 BC) -Original Message- From: Otávio Augusto [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 7:29 AM To: [EMAIL PROTECTED] Subject: dynamic form Hi all I have a form which has as many fields as are informed in a previous form. For instance: form 1 asks the number of fields i want in form 2. After inputting that number, i go to form 2, and there I must find the number of fields (same fields, they are going to be indexed=true). What should I implement in the ActionForm class to handle such fields? How to catch such fields in the ActionForm class and in the Action class? Thanks a lot Otávio Augusto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message and any attachments are for the intended recipient(s) only and may contain privileged, confidential and/or proprietary information about Downey Savings or its customers, which Downey Savings does not intend to disclose to the public. If you received this message by mistake, please notify the sender by reply e-mail and delete the message and attachments. - 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]
Whats the best way to handle a dynamic form with lots of radio buttons
Hi, Im working on an online questionnaire and am fairly new to java web dev and struts. What I already have is a dynamically generated questionnaire that has topics, sub-topics then offers 5 choices to the user. The 5 options are a single radio group with the values 0-4 So my generated html looks something like this td id=choice7_1_1 input type=radio id=7_1 value=0Choice 1 /td td id=choice7_1_2 input type=radio id=7_1 value=1Choice 2 /td etc . the id choice7_1_1 identifies that it is the 7th topic, 1st sub topic and 1st option What Im currently trying to figure out is if it is possible to have a dynaActionForm that will allow me to set/get the properties for this form given that the number of topics and subtopics varies depending on the questionnaire selected from db. What Im currently looking at doing is just having the action process the request and parse the values posted and from that create an arrayList of subtopics with the results but this doesnt really seem the most elegant or simplest solution. Cheers Murdo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form property names
Anyone got any ideas? Thanks, Paul Paul-J Woodward paul-j.woodward+exterTo: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED] cc: Subject: Dynamic form property names 29/12/2003 19:55 Please respond to Struts Users Mailing List Dear All, I have been struggling with this all day, It'll take a bit of background to explain what I am trying to do: I am creating an online wizard to populate templatised web pages, and hence create a dynamic struts/tiles-based site. Each template has various containers for content, each container can be filled by a set of different tiles. The templates are defined in a database. The definition for a template associates each container with the category of tile that it can hold, for instance a template may have containers for navigation and menu tiles. The database also contains a list of tiles that fit into each category of container. I would like to create a single form that lists the categories, that has radio button for every tile in each category. My code looks like this: logic:iterate id=elementCategory name=selectedTemplate property=elementCategories type=com.db.gci.ge.epg.actions.addcontent.TemplateElementCategory p bbean:write name=elementCategory property=category //b bean:write name=elementCategory property=description / Compatible elements in this category:br ul logic:iterate id=compatibleElement name=elementCategory property=compatibleElements type=com.db.gci.ge.epg.actions.addcontent.TemplateElement html:radio property=value(%= elementCategory.getName() %) idName=compatibleElement value=name bbean:write name=compatibleElement property=name //bbr bean:write name=compatibleElement property=description / /html:radio /logic:iterate /ul /p /logic:iterate The issue is this: I need to make the action form map-backed (I think) because the number of radio buttons is only know at runtime, but I can't find any way to name the radio buttons by the name of the category that is being selected. What I would like to use is value(%= elementCategory.getName() %) where my action form has a map and a setValue(String key, Object object) function. Thanks in advance, Paul -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Dynamic form property names
Sorry but I haven't quite catch what you looking for... Do you want to create a form in runtime? Is that it? If you're using a DynaForm it already has map. You can't set new properties to the form (it was built based on a DynaClass) but, if you extend DynaForm to a XDynaForm and make XDynaForm implement Map maybe you can set new properties on your new form. I used this approach (the DynaBean/Map extension) to start using DynaBeans with JSTL and, maybe... just maybe it can help you set new properties on your form. I can send you the class, if you want. As I said, I haven't tried this (the runtime form approach) and I don't know if this is what you are looking for... Pedro Salgado On 30/12/2003 13:34, Paul-J Woodward [EMAIL PROTECTED] wrote: Anyone got any ideas? Thanks, Paul Paul-J Woodward paul-j.woodward+exterTo: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED] cc: Subject: Dynamic form property names 29/12/2003 19:55 Please respond to Struts Users Mailing List Dear All, I have been struggling with this all day, It'll take a bit of background to explain what I am trying to do: I am creating an online wizard to populate templatised web pages, and hence create a dynamic struts/tiles-based site. Each template has various containers for content, each container can be filled by a set of different tiles. The templates are defined in a database. The definition for a template associates each container with the category of tile that it can hold, for instance a template may have containers for navigation and menu tiles. The database also contains a list of tiles that fit into each category of container. I would like to create a single form that lists the categories, that has radio button for every tile in each category. My code looks like this: logic:iterate id=elementCategory name=selectedTemplate property=elementCategories type=com.db.gci.ge.epg.actions.addcontent.TemplateElementCategory p bbean:write name=elementCategory property=category //b bean:write name=elementCategory property=description / Compatible elements in this category:br ul logic:iterate id=compatibleElement name=elementCategory property=compatibleElements type=com.db.gci.ge.epg.actions.addcontent.TemplateElement html:radio property=value(%= elementCategory.getName() %) idName=compatibleElement value=name bbean:write name=compatibleElement property=name //bbr bean:write name=compatibleElement property=description / /html:radio /logic:iterate /ul /p /logic:iterate The issue is this: I need to make the action form map-backed (I think) because the number of radio buttons is only know at runtime, but I can't find any way to name the radio buttons by the name of the category that is being selected. What I would like to use is value(%= elementCategory.getName() %) where my action form has a map and a setValue(String key, Object object) function. Thanks in advance, Paul -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - 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 property names
Hi Pedro, I would be very grateful if you could send me the code. Thanks, Paul Pedro Salgado [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] .comcc: Subject: Re: Dynamic form property names 30/12/2003 16:39 Please respond to Struts Users Mailing List Sorry but I haven't quite catch what you looking for... Do you want to create a form in runtime? Is that it? If you're using a DynaForm it already has map. You can't set new properties to the form (it was built based on a DynaClass) but, if you extend DynaForm to a XDynaForm and make XDynaForm implement Map maybe you can set new properties on your new form. I used this approach (the DynaBean/Map extension) to start using DynaBeans with JSTL and, maybe... just maybe it can help you set new properties on your form. I can send you the class, if you want. As I said, I haven't tried this (the runtime form approach) and I don't know if this is what you are looking for... Pedro Salgado On 30/12/2003 13:34, Paul-J Woodward [EMAIL PROTECTED] wrote: Anyone got any ideas? Thanks, Paul Paul-J Woodward paul-j.woodward+exterTo: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED] cc: Subject: Dynamic form property names 29/12/2003 19:55 Please respond to Struts Users Mailing List Dear All, I have been struggling with this all day, It'll take a bit of background to explain what I am trying to do: I am creating an online wizard to populate templatised web pages, and hence create a dynamic struts/tiles-based site. Each template has various containers for content, each container can be filled by a set of different tiles. The templates are defined in a database. The definition for a template associates each container with the category of tile that it can hold, for instance a template may have containers for navigation and menu tiles. The database also contains a list of tiles that fit into each category of container. I would like to create a single form that lists the categories, that has radio button for every tile in each category. My code looks like this: logic:iterate id=elementCategory name=selectedTemplate property=elementCategories type=com.db.gci.ge.epg.actions.addcontent.TemplateElementCategory p bbean:write name=elementCategory property=category //b bean:write name=elementCategory property=description / Compatible elements in this category:br ul logic:iterate id=compatibleElement name=elementCategory property=compatibleElements type=com.db.gci.ge.epg.actions.addcontent.TemplateElement html:radio property
Dynamic form property names
Dear All, I have been struggling with this all day, It'll take a bit of background to explain what I am trying to do: I am creating an online wizard to populate templatised web pages, and hence create a dynamic struts/tiles-based site. Each template has various containers for content, each container can be filled by a set of different tiles. The templates are defined in a database. The definition for a template associates each container with the category of tile that it can hold, for instance a template may have containers for navigation and menu tiles. The database also contains a list of tiles that fit into each category of container. I would like to create a single form that lists the categories, that has radio button for every tile in each category. My code looks like this: logic:iterate id=elementCategory name=selectedTemplate property=elementCategories type=com.db.gci.ge.epg.actions.addcontent.TemplateElementCategory p bbean:write name=elementCategory property=category //b bean:write name=elementCategory property=description / Compatible elements in this category:br ul logic:iterate id=compatibleElement name=elementCategory property=compatibleElements type=com.db.gci.ge.epg.actions.addcontent.TemplateElement html:radio property=value(%= elementCategory.getName() %) idName=compatibleElement value=name bbean:write name=compatibleElement property=name //bbr bean:write name=compatibleElement property=description / /html:radio /logic:iterate /ul /p /logic:iterate The issue is this: I need to make the action form map-backed (I think) because the number of radio buttons is only know at runtime, but I can't find any way to name the radio buttons by the name of the category that is being selected. What I would like to use is value(%= elementCategory.getName() %) where my action form has a map and a setValue(String key, Object object) function. Thanks in advance, Paul -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
Dynamic Form help
I'm developing some administrative functions for our web app, currently im working on a page where it will list all the permissions available with a checkbox by each, and the ones the current user has will be checked. I'm trying to decide the best way to go about it, becaues the permissions are pulled from a database and so they could change everytime the page is loaded, and obviously every user will have different permissions which need to be checked. It shouldnt be a problem to iterate through a list of permissions, but the question I have is when I go to submit a the form to modify the users permissions, the names of each checkbox (permission) will change, so how would I develop a form to handle that? And is there an easy way to populate all the checkboxes when the page loads? I'm using JSP's to handle it.. would love to use struts html:XXX tags if possible. Reccomendations welcome =) Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic Form help
I guess conceptually I'm just not understanding how this can work. For presentation what I would ideally like is: [X]Permission NamePermission Description [ ]Permission NamePermission Description Where each permission name is unique, the checkbox could be turned on or off depending on a variable linked to the permission name, and also a permission description. So on the display page there would need to be some kind of iterator that iterates through the list of permissions, creating a checkbox with the parameter being the permission name and its value being on or off, the permissions name in a text field, and also a permission description text field. I have classes built that represent a permission and a user, and classes extending vector that hold a list of users and permissions. The user class can retrieve a list of the permissions it has. The permissions class can goto the database and make a vector containing permission elements to represent all the permissions that are capable on the server. Anyway I guess I am having a really hard time designing the form in such a way that something can be iterateable in it, probably the permission name, but also be able to get/store the permission name, description, and if the user has it or not. Sorry if im not more clear... been sitting here for around 3 hours trying to figure out how to even start attacking this and ive read a lot but am drawing a blank. Thanks a ton in advance.. -David - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 12:54 PM Subject: Re: Dynamic Form help You use indexed property. html:text property=permission indexed=true / This stuff i quite well documented, what isn't well documented is how to dynamically change the length of an indexed property. I've been using ArrayList for this.. form-property name=permission type=java.util.ArrayList / You'll need to scope you form to session, as you get null pointers all over the show. ArrayList myList = new ArrayList(); while(myObject.hasMoreStuff()) { myList.add(myObject.next())' } theForm.set(permission, myList); //also put the arraylist in an available context. request.setAttribute(permissions, myList.toArray()); //jsp logic:iterate id=perm name=permissions html:text name=perm property=deleteUser indexed=true / /logic:iterate I'm still working on how to store the properties in the form when the size of the form property is changed. But I think this approach with solve what you're doing. Cheers Mark On Wednesday, August 13, 2003, at 07:22 PM, David Erickson wrote: I'm developing some administrative functions for our web app, currently im working on a page where it will list all the permissions available with a checkbox by each, and the ones the current user has will be checked. I'm trying to decide the best way to go about it, becaues the permissions are pulled from a database and so they could change everytime the page is loaded, and obviously every user will have different permissions which need to be checked. It shouldnt be a problem to iterate through a list of permissions, but the question I have is when I go to submit a the form to modify the users permissions, the names of each checkbox (permission) will change, so how would I develop a form to handle that? And is there an easy way to populate all the checkboxes when the page loads? I'm using JSP's to handle it.. would love to use struts html:XXX tags if possible. Reccomendations welcome =) Thanks - 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: Dynamic Form help
You use indexed property. html:text property=permission indexed=true / This stuff i quite well documented, what isn't well documented is how to dynamically change the length of an indexed property. I've been using ArrayList for this.. form-property name=permission type=java.util.ArrayList / You'll need to scope you form to session, as you get null pointers all over the show. ArrayList myList = new ArrayList(); while(myObject.hasMoreStuff()) { myList.add(myObject.next())' } theForm.set(permission, myList); //also put the arraylist in an available context. request.setAttribute(permissions, myList.toArray()); //jsp logic:iterate id=perm name=permissions html:text name=perm property=deleteUser indexed=true / /logic:iterate I'm still working on how to store the properties in the form when the size of the form property is changed. But I think this approach with solve what you're doing. Cheers Mark On Wednesday, August 13, 2003, at 07:22 PM, David Erickson wrote: I'm developing some administrative functions for our web app, currently im working on a page where it will list all the permissions available with a checkbox by each, and the ones the current user has will be checked. I'm trying to decide the best way to go about it, becaues the permissions are pulled from a database and so they could change everytime the page is loaded, and obviously every user will have different permissions which need to be checked. It shouldnt be a problem to iterate through a list of permissions, but the question I have is when I go to submit a the form to modify the users permissions, the names of each checkbox (permission) will change, so how would I develop a form to handle that? And is there an easy way to populate all the checkboxes when the page loads? I'm using JSP's to handle it.. would love to use struts html:XXX tags if possible. Reccomendations welcome =) Thanks - 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]
Capturing Dynamic Form Elements
Hi all, I am struts newbie. I am stuck with a problem of capturing dynamically growing form elements. I have to know a way to capture recurring data in either DynaValidator or Form bean. My jsp can contain html elements say CoBorrower Information like CoBorrower Name, CoBorrower Address, CoBorrower Phone number for a corresponding Borrower information. A Borrower can have any number of coborrowers associated. So my screen would ideally contain Add More button on click of which will generate another tab for capturing another coborrower information. Since struts mandates the form element names to be defined in struts-config.xml for a dyna action and getters setters for elements in form beans where should i account for dynamic elements I am confused because there can be n number of html elements with same name coborrowerid for example. I welecome any suggestion regarding this. With Regards Ganesh __ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic Form Fields
Hi, Currently, I have a DynaValidatorForm defined in my web app. Some of the properties of this form will be completely dynamic. I will read a database and retrieve an ArrayList. This ArrayList will contain the form field name, and form field value. How do this with a DynaValidatorForm? Can I? Any help would be MUCH appreciated... Thanks, Natalie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dynamic Form Fields
Currently, I have a DynaValidatorForm defined in my web app. Some of the properties of this form will be completely dynamic. I will read a database and retrieve an ArrayList. This ArrayList will contain the If I understand you correctly for (Iterator iter = al.iterator (); iter.hasNext (); ) { Field f = (Field) iter.next (); myForm.set (f.getName (), f.getValue ()); } In this case your form will have to be declared in struts-config.xml Having all the possible f.getName () though, otherwise you will get IllegalArgumentException. There is another method in DynaActionForm called getMap () this is your map of key (name) / value pairs. I am not sure if it is mutable, I can't see any setMap (), but you can try that out too. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iteration to create dynamic form
I have a logic:iterate tag which is supposed to create a dynamic form, filled with a checkbox for every object in a collection. (The checkbox is an option to delete one of those records from the database.) The form itself is a Map-Backed Action form with two methods (public void setValue(String key, Object value) and public Object getValue(String key)). logic:iterate id=record name=user property=siteSection.newRecords % (dataobjects.Record) l = (dataobjects.Record)pageContext.findAttribute(record); String name= new String(value( + r.getID()+)); % tr height=30 td align=center html:checkbox value=off property=%=name% onclick=CheckMBRow(this)/ /td td ..other stuff describing the record../td /tr /logic:iterate Is there a way in Struts to do this without calling the record object from the pageContext? Can't I get the html:checkbox tag to recognize the 'record' bean directly without using that scriptlet and then creating a String to set the appropriate mapped value? Best, Piers
RE: iteration to create dynamic form
try with multibox instead of checkbox: http://jakarta.apache.org/struts/struts-html.html#multibox -jaafar -Original Message- From: Piers Dunleavy [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 2:32 AM To: Struts Users Mailing List Subject: iteration to create dynamic form I have a logic:iterate tag which is supposed to create a dynamic form, filled with a checkbox for every object in a collection. (The checkbox is an option to delete one of those records from the database.) The form itself is a Map-Backed Action form with two methods (public void setValue(String key, Object value) and public Object getValue(String key)). logic:iterate id=record name=user property=siteSection.newRecords % (dataobjects.Record) l = (dataobjects.Record)pageContext.findAttribute(record); String name= new String(value( + r.getID()+)); % tr height=30 td align=center html:checkbox value=off property=%=name% onclick=CheckMBRow(this)/ /td td ..other stuff describing the record../td /tr /logic:iterate Is there a way in Struts to do this without calling the record object from the pageContext? Can't I get the html:checkbox tag to recognize the 'record' bean directly without using that scriptlet and then creating a String to set the appropriate mapped value? Best, Piers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: iteration to create dynamic form.
Dear Piers, Please try the following code. logic:iterate id=record name=user property=siteSection.newRecords html:checkbox name=record value=off property=selectedFlag / /logic:iterate In your Form Bean, - Implement following methods. public Boolean [] getSelectedFlag(); public getSelectedFlag(Boolean [] flags); In your Record class, - Implement the methods. public boolean getSelectedFlag(); public boolean setSelectedFlag(boolean flag). When the JSP is executed, the values for the checkboxes will be retrieved from the collection of Record objects. When the form is submitted, the setSelectedFlag method on Form bean will be called. Please let me know if this works for you. Ajay Ajay Patil Vertex Software Pvt. Ltd. [EMAIL PROTECTED] http://www.vertex.co.in I have a logic:iterate tag which is supposed to create a dynamic form, filled with a checkbox for every object in a collection. (The checkbox is an option to delete one of those records from the database.) The form itself is a Map-Backed Action form with two methods (public void setValue(String key, Object value) and public Object getValue(String key)). logic:iterate id=record name=user property=siteSection.newRecords % (dataobjects.Record) l = (dataobjects.Record)pageContext.findAttribute (record); String name= new String(value( + r.getID()+)); % tr height=30 td align=center html:checkbox value=off property=%=name% onclick=CheckMBRow (this)/ /td td ..other stuff describing the record../td /tr /logic:iterate Is there a way in Struts to do this without calling the record object from the pageContext? Can't I get the html:checkbox tag to recognize the 'record' bean directly without using that scriptlet and then creating a String to set the appropriate mapped value? Best, Piers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Easy way to deal with Dynamic Form elements
I have basically a shopping cart application and I am wondering what is the easiest way of updating the quantity of each item in the shopping cart. Populating the page with the list of cart items is easy. I have no clue how I will process the Dynamic form elements that represent the quantity of each item in the cart. Thanks -Gp
Re: Easy way to deal with Dynamic Form elements
Giampiero De Ciantis wrote: I have basically a shopping cart application and I am wondering what is the easiest way of updating the quantity of each item in the shopping cart. Populating the page with the list of cart items is easy. I have no clue how I will process the Dynamic form elements that represent the quantity of each item in the cart. Presumably whatever class represents a CartItem has, in addition to a property pointing to an selection from your wares, a property to represent the quantity? Then you simply need to update this quantity in the Action when a user specifies a quantity? Or am I just not understanding you. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Easy way to deal with Dynamic Form elements
Sorry, I didn't explain myself. Basically the page that shows the cart contents will have an unknown number (Cardinality 0..*) of items listed. Beside each item there will be a text box where the user can input the quantity of the item that they want to order. When the user hits checkout or updateQuantity I have to be able to figure out what item they are updating. So, How do I know which item they are trying to update once I get to the CartAction that does the processing of the form? Thanks for the reply. -Gp -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED] Sent: June 13, 2003 2:58 PM To: Struts Users Mailing List Subject: Re: Easy way to deal with Dynamic Form elements Giampiero De Ciantis wrote: I have basically a shopping cart application and I am wondering what is the easiest way of updating the quantity of each item in the shopping cart. Populating the page with the list of cart items is easy. I have no clue how I will process the Dynamic form elements that represent the quantity of each item in the cart. Presumably whatever class represents a CartItem has, in addition to a property pointing to an selection from your wares, a property to represent the quantity? Then you simply need to update this quantity in the Action when a user specifies a quantity? Or am I just not understanding you. Erik - 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: Easy way to deal with Dynamic Form elements
Giampiero De Ciantis wrote: Sorry, I didn't explain myself. Basically the page that shows the cart contents will have an unknown number (Cardinality 0..*) of items listed. Beside each item there will be a text box where the user can input the quantity of the item that they want to order. When the user hits checkout or updateQuantity I have to be able to figure out what item they are updating. So, How do I know which item they are trying to update once I get to the CartAction that does the processing of the form? The text box is a text input, right? It has a name attribute. Assign a meaningful name, such as item1Quantity or item32Quantity, so that in your CartAction, you can then extract the HTTP parameters (using getParameter(String)) and you can perform whatever logic you need to perform now that you know (1) the name of the item and (2) the quantity set by the user. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 'dynamic' form elements in a ActionForm
Struts 1.1 supports map-backed forms, but that doesn't resolve the input form issue. I guess the key would be some type of tag that took a map and then generated a column of input fields. (Wouldn't work for everyone, since a lot of forms must be designed just so.) For extra credit, the entry names could (optionally) be resource keys that were used to find the label text. Text fields would be easy. Others would need some type of JavaBean with properties to tell the tag what to output. A bit of work, but obviously doable. I imagine it's possible to use the validator in a non-declarative way, but I don't know anyone whose doing that. If you can do a db query to get the information about the form, I imagine you could also do a query to get the information about validations for the form. It would probably be easier to write your own engine than adopt the validator. (It's not really that complicated to do.) People often ask about this sort of thing, but most of us just can't get our head around the use case. It's hard to understand what you do with the dynamic data when it comes back. Most application don't allow you to input or update an arbitrary (e.g. dynamic) set of fields. -T. Hi Ted, I was looking at the struts mailing list archives for information on generating dynamic forms/pages and came across a response you posted(http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgNo=30062). I'm very interested in this since I'm working on a project that requires me to create an input form that's composed of fields defined dynamically from a database. In this regard, would you mind my asking some questions: In http://jguru.com/forums/view.jsp?EID=567079, you mentioned that the solution doesn't address dynamically writing tags or dynamic validation. Do you have any recommendations in this regard? For ex. if user selects form A, I do a db query to determine what fields are in form A (i.e field name; data type-numeric, date, varchar; widget type-checkbox, text, textarea, etc; and if a selection type widget, what the valid choices are). Since your response was posted last Dec 2001, I was wondering if you know of any new features or if you can point me to any resources that would help me render the proper type of widget and validate based on data type. Is there any way to take advantage of the validator framework in a non-declarative way? On the Jakarta Struts extensions site, there was a link to http://husted.com/struts/resources/DynamicProperties.htm. This code was based on Struts 1.0. Do you know if v1.1 makes creation of the classes mentioned in this URL unnessary? I was just curious since in your response to the 'dynamic' form question, you mentioned that: It's difficult to do this in the 1.0.x release, but simple as pie in the 1.1 beta and nightly build. What feature in 1.1 made it much simpler to do than in 1.0? I'm sorry to bother you with these questions. I'm quite new to Struts. If you can spare the time to answer any of the above or offer any suggestions, I'd really appreciate it. Thanks a lot, -- Ted Husted, Struts in Action http://husted.com/struts/book.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form actions
Mark, Please, correct me if I'm wrong, but I think the action attribute in the html:form tag is a run time expression, so there's no need to extend the FormTag class in order to use a dynamic form action. Regards Jose Mark wrote: I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark - 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 actions
No, its not a runtime expression. If you look at the code in FormTag you'll see that its not results.append(\ action=\); results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); results.append(\); It simply pulls the action mapping from the config. I changed my code to results.append(\ action=\); // check if we have a bean thats exposing a formaction property, if so, use that property, otherwise use our assigned action value in the jsp page try { Object value = RequestUtils.lookup(pageContext, beanName,formaction, null); if (value != null !value.toString().equals()) { this.action=ResponseUtils.filter(value.toString()); System.out.println(value.toString()); } } catch (Exception e) { e.printStackTrace(); } results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); *** REPLY SEPARATOR *** On 03/14/2003 at 9:50 AM Jose Gonzalez Gomez wrote: Mark, Please, correct me if I'm wrong, but I think the action attribute in the html:form tag is a run time expression, so there's no need to extend the FormTag class in order to use a dynamic form action. Regards Jose Mark wrote: I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark - 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: Dynamic form actions
The code you've quoted has no impact on whether or not the html:form tag's action attribute is an rtexpr. Look at struts-html.tld: tag nameform/name tagclassorg.apache.struts.taglib.html.FormTag/tagclass bodycontentJSP/bodycontent attribute nameaction/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute ... Quoting Mark [EMAIL PROTECTED]: No, its not a runtime expression. If you look at the code in FormTag you'll see that its not results.append(\ action=\); results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); results.append(\); It simply pulls the action mapping from the config. I changed my code to results.append(\ action=\); // check if we have a bean thats exposing a formaction property, if so, use that property, otherwise use our assigned action value in the jsp page try { Object value = RequestUtils.lookup(pageContext, beanName,formaction, null); if (value != null !value.toString().equals()) { this.action=ResponseUtils.filter(value.toString()); System.out.println(value.toString()); } } catch (Exception e) { e.printStackTrace(); } results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); *** REPLY SEPARATOR *** On 03/14/2003 at 9:50 AM Jose Gonzalez Gomez wrote: Mark, Please, correct me if I'm wrong, but I think the action attribute in the html:form tag is a run time expression, so there's no need to extend the FormTag class in order to use a dynamic form action. Regards Jose Mark wrote: I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark - 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] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form actions
All that means is you can have mysimpleTag value=%=scripletVariable%/ false means you cannot have a scriplet variable as a value That's not quite what i wanted to do, but in a way accomplishes a similar task without modifying struts. Its not sexy enough for me ;) The whole point of MVC is seperation presentation, business logic, code html:form action=%=request.getAttribute(formaction)!=null?(String)request.getAttribute(formaction):/Default/url% method=post/ If i start putting scriptlets like that in my code, im basically breaking the MVC design pattern. Because now, my JSP page is dependent upon that scriptlet variable being in the environment, and if it used an object, say like this: html:form action=%=request.getAttribute(myForm)!=null?(MyForm)request.getAttribute(formaction).getFormaction():/Default/url% method=post/ The method I used, I believe, is a tad better because the JSP page will still function in the absence of that scriptlet variable, and is cleaner JSP code. Regards, Mark *** REPLY SEPARATOR *** On 03/14/2003 at 9:27 AM Kris Schneider wrote: The code you've quoted has no impact on whether or not the html:form tag's action attribute is an rtexpr. Look at struts-html.tld: tag nameform/name tagclassorg.apache.struts.taglib.html.FormTag/tagclass bodycontentJSP/bodycontent attribute nameaction/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute ... Quoting Mark [EMAIL PROTECTED]: No, its not a runtime expression. If you look at the code in FormTag you'll see that its not results.append(\ action=\); results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); results.append(\); It simply pulls the action mapping from the config. I changed my code to results.append(\ action=\); // check if we have a bean thats exposing a formaction property, if so, use that property, otherwise use our assigned action value in the jsp page try { Object value = RequestUtils.lookup(pageContext, beanName,formaction, null); if (value != null !value.toString().equals()) { this.action=ResponseUtils.filter(value.toString()); System.out.println(value.toString()); } } catch (Exception e) { e.printStackTrace(); } results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); *** REPLY SEPARATOR *** On 03/14/2003 at 9:50 AM Jose Gonzalez Gomez wrote: Mark, Please, correct me if I'm wrong, but I think the action attribute in the html:form tag is a run time expression, so there's no need to extend the FormTag class in order to use a dynamic form action. Regards Jose Mark wrote: I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark - 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] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.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 actions
Right, so you'd put the code to determine the appropriate value for the action attribute in your action, not in a JSP expression. That value could be stored in a request attribute and accessed simply as: html:form action='%= request.getAttribute(formaction) %' html-el:form might even let you do (never used it): html-el:form action=${formaction} Of course, this assumes you're doing the MVC thing of disallowing direct client access to your JSP pages. It just seems confusing to have an attribute that may or may not be used. I'd rather have the attribute value always static or always dynamic. But that's personal preference, I really just wanted to correct the statement about the request-time value. Whether that's of any use in your case is another issue. Quoting Mark [EMAIL PROTECTED]: All that means is you can have mysimpleTag value=%=scripletVariable%/ false means you cannot have a scriplet variable as a value That's not quite what i wanted to do, but in a way accomplishes a similar task without modifying struts. Its not sexy enough for me ;) The whole point of MVC is seperation presentation, business logic, code html:form action=%=request.getAttribute(formaction)!=null?(String)request.getAttribute(formaction):/Default/url% method=post/ If i start putting scriptlets like that in my code, im basically breaking the MVC design pattern. Because now, my JSP page is dependent upon that scriptlet variable being in the environment, and if it used an object, say like this: html:form action=%=request.getAttribute(myForm)!=null?(MyForm)request.getAttribute(formaction).getFormaction():/Default/url% method=post/ The method I used, I believe, is a tad better because the JSP page will still function in the absence of that scriptlet variable, and is cleaner JSP code. Regards, Mark *** REPLY SEPARATOR *** On 03/14/2003 at 9:27 AM Kris Schneider wrote: The code you've quoted has no impact on whether or not the html:form tag's action attribute is an rtexpr. Look at struts-html.tld: tag nameform/name tagclassorg.apache.struts.taglib.html.FormTag/tagclass bodycontentJSP/bodycontent attribute nameaction/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute ... Quoting Mark [EMAIL PROTECTED]: No, its not a runtime expression. If you look at the code in FormTag you'll see that its not results.append(\ action=\); results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); results.append(\); It simply pulls the action mapping from the config. I changed my code to results.append(\ action=\); // check if we have a bean thats exposing a formaction property, if so, use that property, otherwise use our assigned action value in the jsp page try { Object value = RequestUtils.lookup(pageContext, beanName,formaction, null); if (value != null !value.toString().equals()) { this.action=ResponseUtils.filter(value.toString()); System.out.println(value.toString()); } } catch (Exception e) { e.printStackTrace(); } results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); *** REPLY SEPARATOR *** On 03/14/2003 at 9:50 AM Jose Gonzalez Gomez wrote: Mark, Please, correct me if I'm wrong, but I think the action attribute in the html:form tag is a run time expression, so there's no need to extend the FormTag class in order to use a dynamic form action. Regards Jose Mark wrote: I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark
Re: Dynamic form actions
thanks, good ideas *** REPLY SEPARATOR *** On 03/14/2003 at 10:24 AM Kris Schneider wrote: Right, so you'd put the code to determine the appropriate value for the action attribute in your action, not in a JSP expression. That value could be stored in a request attribute and accessed simply as: html:form action='%= request.getAttribute(formaction) %' html-el:form might even let you do (never used it): html-el:form action=${formaction} Of course, this assumes you're doing the MVC thing of disallowing direct client access to your JSP pages. It just seems confusing to have an attribute that may or may not be used. I'd rather have the attribute value always static or always dynamic. But that's personal preference, I really just wanted to correct the statement about the request-time value. Whether that's of any use in your case is another issue. Quoting Mark [EMAIL PROTECTED]: All that means is you can have mysimpleTag value=%=scripletVariable%/ false means you cannot have a scriplet variable as a value That's not quite what i wanted to do, but in a way accomplishes a similar task without modifying struts. Its not sexy enough for me ;) The whole point of MVC is seperation presentation, business logic, code html:form action=%=request.getAttribute(formaction)!=null?(String)request.getAttribute(formaction):/Default/url% method=post/ If i start putting scriptlets like that in my code, im basically breaking the MVC design pattern. Because now, my JSP page is dependent upon that scriptlet variable being in the environment, and if it used an object, say like this: html:form action=%=request.getAttribute(myForm)!=null?(MyForm)request.getAttribute(formaction).getFormaction():/Default/url% method=post/ The method I used, I believe, is a tad better because the JSP page will still function in the absence of that scriptlet variable, and is cleaner JSP code. Regards, Mark *** REPLY SEPARATOR *** On 03/14/2003 at 9:27 AM Kris Schneider wrote: The code you've quoted has no impact on whether or not the html:form tag's action attribute is an rtexpr. Look at struts-html.tld: tag nameform/name tagclassorg.apache.struts.taglib.html.FormTag/tagclass bodycontentJSP/bodycontent attribute nameaction/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute ... Quoting Mark [EMAIL PROTECTED]: No, its not a runtime expression. If you look at the code in FormTag you'll see that its not results.append(\ action=\); results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); results.append(\); It simply pulls the action mapping from the config. I changed my code to results.append(\ action=\); // check if we have a bean thats exposing a formaction property, if so, use that property, otherwise use our assigned action value in the jsp page try { Object value = RequestUtils.lookup(pageContext, beanName,formaction, null); if (value != null !value.toString().equals()) { this.action=ResponseUtils.filter(value.toString()); System.out.println(value.toString()); } } catch (Exception e) { e.printStackTrace(); } results.append(response.encodeURL(RequestUtils.getActionMappingURL(action, pageContext))); *** REPLY SEPARATOR *** On 03/14/2003 at 9:50 AM Jose Gonzalez Gomez wrote: Mark, Please, correct me if I'm wrong, but I think the action attribute in the html:form tag is a run time expression, so there's no need to extend the FormTag class in order to use a dynamic form action. Regards Jose Mark wrote: I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark
Dynamic form actions
I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic form actions
We'll i kind of interested in trying your solution. Can you post some jsp codes in here. I think many people will appreciate it. Thanks. - Original Message - From: Mark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 14, 2003 11:52 AM Subject: Dynamic form actions I just wanted to pass on a tidbit that might help one or two people out there. I have a search page that displays the results with checkboxes. There are two or three different places that i use this same search page, so rather than writing or copying the search results jsp page to several copies (to allow me to post the form thats on the results page to a different forward definition) i made a modifiecation to struts. In the FormTag.java I added some code to peek in the formbean for a property called formaction. If it finds one, it uses this new action instead of the hard coded one in the jsp page. Thus, in my action class i do this: MyBean myBean=(MyBean)actionForm; myBean.setFormaction(/Some/other/url); return mapping.findforward(default); now i have a jsp page which i can reuse its functionality in several places in my code. I had thought about using a hidden field, but the problem really stems from the statically coded form action=/Url part. Since struts doesnt allow us much flexibility here by default, I decided to add my own and it works great! Regards, Mark - 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]
Dynamic form value replacements???
I have a form that is dynamically created as a jsp in xml syntax. There are an arbitrary number of text fields that need to be validated. Could someone point me to an example of how to do this? I have no way of creating the set and get methods in the form class unless I dynamically create the java code and recompile. This is not an option. Thank you for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: louis majanja [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 6:27 PM To: Struts Users Mailing List Subject: [HELP] ActionMessages html:messages / i have this in my actionForm: ActionMessages messages = new ActionMessages(); messages.add(message, new ActionMessage(message.login.confirmation)); saveMessage(request,messages); in my jsp i have html:messages / it doesn't work, i have tried the following options which don't work either html:messages message=true/ html:messages id=msg property=messages message=true c:out value=${msg}/ /html:messages - 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 value replacements???
Can you put them in an array? - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 9:38 PM Subject: Dynamic form value replacements??? I have a form that is dynamically created as a jsp in xml syntax. There are an arbitrary number of text fields that need to be validated. Could someone point me to an example of how to do this? I have no way of creating the set and get methods in the form class unless I dynamically create the java code and recompile. This is not an option. Thank you for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: louis majanja [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 6:27 PM To: Struts Users Mailing List Subject: [HELP] ActionMessages html:messages / i have this in my actionForm: ActionMessages messages = new ActionMessages(); messages.add(message, new ActionMessage(message.login.confirmation)); saveMessage(request,messages); in my jsp i have html:messages / it doesn't work, i have tried the following options which don't work either html:messages message=true/ html:messages id=msg property=messages message=true c:out value=${msg}/ /html:messages - 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: Dynamic form value replacements???
According to this you can. I have not tried though. Makes the other constuctors obsolete. http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionError.ht ml Do you know to use DynaActionForm? I do not understand how to get the values kept when validation fails. It currently loses all changes because I do not know the name of all the text fields beforehand and cannot create get and set methods. Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 8:43 PM To: Struts Users Mailing List Subject: Re: Dynamic form value replacements??? Can you put them in an array? - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 9:38 PM Subject: Dynamic form value replacements??? I have a form that is dynamically created as a jsp in xml syntax. There are an arbitrary number of text fields that need to be validated. Could someone point me to an example of how to do this? I have no way of creating the set and get methods in the form class unless I dynamically create the java code and recompile. This is not an option. Thank you for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: louis majanja [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 6:27 PM To: Struts Users Mailing List Subject: [HELP] ActionMessages html:messages / i have this in my actionForm: ActionMessages messages = new ActionMessages(); messages.add(message, new ActionMessage(message.login.confirmation)); saveMessage(request,messages); in my jsp i have html:messages / it doesn't work, i have tried the following options which don't work either html:messages message=true/ html:messages id=msg property=messages message=true c:out value=${msg}/ /html:messages - 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]
Does struts support validation for dynamic form?
Hi , i have a requirement where user has to fill up some kind of questionaire form. Questions for a user depends on the type of a user. Questions are basically mutiple choice questions and the user can select the correct answer by selecting a radio button ( for each question there are five radio buttons each reparesenting a rating and the user is supposed to select a rating from 1 to 5 ). So the number of elements in the form can change based on the type of user. Now i want to use struts validation frame work for performing validations. If the user leaves any of the answers empty by not selecting the radio button for a question , the system should not accept it and report an error displaying the same form with all the data entered for the form. The question is : How can i use the validation framework to perform validation? Please note that the form fields change (based on the user type) so it is not possible for me to associate them in validator.xml before hand. Does struts provide any means to validate when the form elements are dynamic? Thanks in advance Vishy
Re: Need Dynamic Form Beans feature for Struts1.0.2
Hi, By using 1.0.2 also we can use Dynamic Form. For this we need to add some .zar files. I expermented with 1.0.2 Thnaks Regards, Ashok.D - Original Message - From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 3:03 AM Subject: RE: Need Dynamic Form Beans feature for Struts1.0.2 Thanks, Craig, I got to trust you :-) Saul -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 4:13 PM To: Struts Users Mailing List Subject: Re: Need Dynamic Form Beans feature for Struts1.0.2 On Wed, 8 Jan 2003, Yuan, Saul (TOR-ML) wrote: Date: Wed, 8 Jan 2003 15:55:29 -0500 From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Need Dynamic Form Beans feature for Struts1.0.2 Hi, We really need the Dynamic Form Beans feature in Struts1.1, but we're stuck with Struts1.0.2, just wondering what's the best way to add that feature to Struts1.0.2? Or any existing samples out there? (1) Upgrade to 1.1 -- the easy way :-) (2) Go make about 1000 lines worth of code changes to the o.a.s.u.BeanUtils and o.a.s.u.PropertyUtils classes, along with changes to most of the tags, to implement it yourself. In short, it is not really very practical. Thanks in advance, Saul Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need Dynamic Form Beans feature for Struts1.0.2
Can you give me more details, like what jar files, where to get them and how to use them etc... Thanks a lot, Saul -Original Message- From: ashokd [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 12:55 AM To: Struts Users Mailing List Subject: Re: Need Dynamic Form Beans feature for Struts1.0.2 Hi, By using 1.0.2 also we can use Dynamic Form. For this we need to add some .zar files. I expermented with 1.0.2 Thnaks Regards, Ashok.D - Original Message - From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 3:03 AM Subject: RE: Need Dynamic Form Beans feature for Struts1.0.2 Thanks, Craig, I got to trust you :-) Saul -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 4:13 PM To: Struts Users Mailing List Subject: Re: Need Dynamic Form Beans feature for Struts1.0.2 On Wed, 8 Jan 2003, Yuan, Saul (TOR-ML) wrote: Date: Wed, 8 Jan 2003 15:55:29 -0500 From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Need Dynamic Form Beans feature for Struts1.0.2 Hi, We really need the Dynamic Form Beans feature in Struts1.1, but we're stuck with Struts1.0.2, just wondering what's the best way to add that feature to Struts1.0.2? Or any existing samples out there? (1) Upgrade to 1.1 -- the easy way :-) (2) Go make about 1000 lines worth of code changes to the o.a.s.u.BeanUtils and o.a.s.u.PropertyUtils classes, along with changes to most of the tags, to implement it yourself. In short, it is not really very practical. Thanks in advance, Saul Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need Dynamic Form Beans feature for Struts1.0.2
On Wed, 15 Jan 2003, Yuan, Saul (TOR-ML) wrote: Date: Wed, 15 Jan 2003 10:24:16 -0500 From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: Need Dynamic Form Beans feature for Struts1.0.2 Can you give me more details, like what jar files, where to get them and how to use them etc... I suspect that Ashok.D is talking about the commons-beanutils.jar library, which is what Struts 1.1 uses. You can get it from a nightly Struts 1.1 release, or separately at: http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-beanutils/ You can certainly use this library (and it's embedded support for WrapDynaBean and things like that in a Struts 1.0.2 environment). Howver, you won't be able to use DynaActionForm unless you modify all the Struts code that uses org.apache.struts.util.BeanUtils and org.apache.struts.util.PropertyUtils to use the commons equivalents instead. That is a *lot* of work, and is technically more risky than just migrating to 1.1 (because you'll need to support it all yourself). Thanks a lot, Saul Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need Dynamic Form Beans feature for Struts1.0.2
Yes, I agree. I probably won't do a full DynamicActionForm re-implementation, but part of its functions. Basically we need to define all form fields in a XML file and create a dynamic form bean that'll work in Struts1.0.2 and better yet, with the Validator. I found the following link: http://husted.com/struts/resources/DynamicProperties.htm which is listed under the Contributor's extension in the Struts site, I am wondering if this is something I can base on to build the dynamic forms? Thanks, Saul -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 3:27 PM To: Struts Users Mailing List Subject: RE: Need Dynamic Form Beans feature for Struts1.0.2 On Wed, 15 Jan 2003, Yuan, Saul (TOR-ML) wrote: Date: Wed, 15 Jan 2003 10:24:16 -0500 From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: Need Dynamic Form Beans feature for Struts1.0.2 Can you give me more details, like what jar files, where to get them and how to use them etc... I suspect that Ashok.D is talking about the commons-beanutils.jar library, which is what Struts 1.1 uses. You can get it from a nightly Struts 1.1 release, or separately at: http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-beanuti ls/ You can certainly use this library (and it's embedded support for WrapDynaBean and things like that in a Struts 1.0.2 environment). Howver, you won't be able to use DynaActionForm unless you modify all the Struts code that uses org.apache.struts.util.BeanUtils and org.apache.struts.util.PropertyUtils to use the commons equivalents instead. That is a *lot* of work, and is technically more risky than just migrating to 1.1 (because you'll need to support it all yourself). Thanks a lot, Saul Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Need Dynamic Form Beans feature for Struts1.0.2
Hi, We really need the Dynamic Form Beans feature in Struts1.1, but we're stuck with Struts1.0.2, just wondering what's the best way to add that feature to Struts1.0.2? Or any existing samples out there? Thanks in advance, Saul
Re: Need Dynamic Form Beans feature for Struts1.0.2
On Wed, 8 Jan 2003, Yuan, Saul (TOR-ML) wrote: Date: Wed, 8 Jan 2003 15:55:29 -0500 From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Need Dynamic Form Beans feature for Struts1.0.2 Hi, We really need the Dynamic Form Beans feature in Struts1.1, but we're stuck with Struts1.0.2, just wondering what's the best way to add that feature to Struts1.0.2? Or any existing samples out there? (1) Upgrade to 1.1 -- the easy way :-) (2) Go make about 1000 lines worth of code changes to the o.a.s.u.BeanUtils and o.a.s.u.PropertyUtils classes, along with changes to most of the tags, to implement it yourself. In short, it is not really very practical. Thanks in advance, Saul Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need Dynamic Form Beans feature for Struts1.0.2
Thanks, Craig, I got to trust you :-) Saul -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 4:13 PM To: Struts Users Mailing List Subject: Re: Need Dynamic Form Beans feature for Struts1.0.2 On Wed, 8 Jan 2003, Yuan, Saul (TOR-ML) wrote: Date: Wed, 8 Jan 2003 15:55:29 -0500 From: Yuan, Saul (TOR-ML) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Need Dynamic Form Beans feature for Struts1.0.2 Hi, We really need the Dynamic Form Beans feature in Struts1.1, but we're stuck with Struts1.0.2, just wondering what's the best way to add that feature to Struts1.0.2? Or any existing samples out there? (1) Upgrade to 1.1 -- the easy way :-) (2) Go make about 1000 lines worth of code changes to the o.a.s.u.BeanUtils and o.a.s.u.PropertyUtils classes, along with changes to most of the tags, to implement it yourself. In short, it is not really very practical. Thanks in advance, Saul Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Runtime dynamic form/jsp from XML
project: create an xml-driven set of screens within the struts framework. concept: we're attempting to create a rapid-release framework for rolling out new products. the idea is to have a portion of the framework driven by xml. the xml would contain information on what fields to display to the user, validation rules for the fields, bean routing database mappings for that bean to use. all this fun stuff would be assembled at runtime into a jsp using a dynaForm with a map for all the form data. after form submittal, the validation is run, the map is sent to the bean which uses the db mappings a insert/update/delete parameter to tell it what to do where. question: in searching the archives i've found plenty of references to people wanting to develop similar projects - but very little concrete information on how one might accomplish it =). has anyone built a system similar to this? (especially someone who's code i could have =) any suggestions on better design/methedology? much thanks, andrew _\|/_ andrew b forman aim ph0rman _\|/___ generation-d development andrew b forman aim ph0rman v820-2422 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Runtime dynamic form/jsp from XML
Andrew, You may want to have a look at STXX. It is available at http://www.openroad.ca/opencode/stxx. Here is a generial description from the site: Struts for transforming XML with XSL (stxx) is an extension of the struts framework to support XML and XSL without changing the functionality of struts . stxx sit's on top of struts, extending it's existing functionality to allow Action classes to return XML that will be transformed by an XSL file. The idea of stxx is to remove the need to be use JSP and TagLibs for the presentation layer of this framework. However, stxx does not force you to go the XML/XSL route, both technologies will work side by side. Regards, Todd G. Nist From: Andrew B Forman [EMAIL PROTECTED] Date: 2002/11/21 Thu AM 10:13:42 EST To: List - Struts-User [EMAIL PROTECTED] Subject: Runtime dynamic form/jsp from XML project: create an xml-driven set of screens within the struts framework. concept: we're attempting to create a rapid-release framework for rolling out new products. the idea is to have a portion of the framework driven by xml. the xml would contain information on what fields to display to the user, validation rules for the fields, bean routing database mappings for that bean to use. all this fun stuff would be assembled at runtime into a jsp using a dynaForm with a map for all the form data. after form submittal, the validation is run, the map is sent to the bean which uses the db mappings a insert/update/delete parameter to tell it what to do where. question: in searching the archives i've found plenty of references to people wanting to develop similar projects - but very little concrete information on how one might accomplish it =). has anyone built a system similar to this? (especially someone who's code i could have =) any suggestions on better design/methedology? much thanks, andrew _\|/_ andrew b forman aim ph0rman _\|/___ generation-d development andrew b forman aim ph0rman v820-2422 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Assigning an object(FormFile) to a dynamic form.
Hi, I use dynamic forms in my projects; but this time I want to upload A file and when I use form-property name=myFile type=org.apache.struts.upload.FormFile / An error occurs that says that cannot assign String to FormFile. How can I use dynamic form with this kind of objects? Thanks, reza.
Re: Assigning an object(FormFile) to a dynamic form.
On Mon, 18 Nov 2002, Reza Aliakbari wrote: Hi, I use dynamic forms in my projects; but this time I want to upload A file and when I use form-property name=myFile type=org.apache.struts.upload.FormFile / An error occurs that says that cannot assign String to FormFile. How can I use dynamic form with this kind of objects? FormFile is an interface, so it can't be instantiated. Try using DiskFile instead - it implements FormFile. -- Martin Cooper Thanks, reza. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
data not repopulated after validation using ActionForm for dynamic form fields
HI, I am trying to validate a fully dynamic form populated from the database.The validation works fine with an ActionForm with the following properties: private String[] fieldIdMemberIds; private String questionName; private HashMap hashMap = new HashMap(); The problem is repopulating the dynamic field values back from the hashMap into the dynamic fields.The fields in error are getting highlighted properly with a custom tag but the previously entered data is lost. Is there a way I can populate back the varying fieldIdMemberId fields from the hashMap.(how does DynaForm populate fields back from just form-property names). Pls correct me if I am totally offbase here in using reset() here. Thanx, Vijay Here is the relevant code in the ActionForm class: public void reset(ActionMapping mapping, HttpServletRequest request) { String[] fieldIDMemberIds = getFieldIdMemberIds(); if (fieldIdMemberIds != null) { for (int i = 0; i fieldIDMemberIds.length; i++) { String fieldIdMemberId = fieldIDMemberIds[i]; String answer = request.getParameter(fieldIdMemberId); if (answer != null answer.length() 0) { //TODO:repopulate the dynamic fieldIdMemberId fields with answers from the hashMap ??? } } } } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { boolean validated = true; ActionErrors errors = new ActionErrors(); String[] fieldIDMemberIds = getFieldIdMemberIds(); if (fieldIdMemberIds != null) { for (int i = 0; i fieldIDMemberIds.length; i++) { String fieldIdMemberId = fieldIDMemberIds[i]; String answer = request.getParameter(fieldIdMemberId); if (answer == null || answer.length() 1) { ActionError newError = new ActionError(validate.error.required,fieldIdMemberId); errors.add( fieldIdMemberId, newError); // Return back to the previous state validated = false; } else { hashMap.put(fieldIdMemberId,answer); } } //set selected answers setHashMap(hashMap); } if (validated) { return null; } else { return errors; } } -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
dynamic form field creation from Database with DynaFormBean
HI, I have the following DynaFormBean defined in tiles-def.xml: form-bean name=answerDetailsForm dynamic=true type=org.apache.struts.action.DynaActionForm form-property name=fieldIdMemberIds type=java.lang.String[] / form-property name=questionName type=java.lang.String / /form-bean I am using the following code excerpt from the form which creates the %=name% dynamically based on values returned from the database.I want to use DynaFormBeans or a sub-class of it or DynaValidatorForm to make sure that the field is required and one of the radio buttons for each field is checked. How can I do that ? % for (int i1=0;i1 fields.length; i1++) { Field field = (Field)fields[i1]; long fieldId = field.getFieldId(); String name = fieldValue; String member = memberId + memberId; name = name + fieldId + member; % tr align=right tdinput type=hidden name=fieldIdMemberIds value=%=name % //td html:errors property=%=name% / td%=field.getFieldName()% /td % Collection colFieldValues = FieldValuesHandler.getFieldValues(fieldId); Iterator iterFieldValues = colFieldValues.iterator(); while (iterFieldValues.hasNext()) { FieldValues fieldValue = (FieldValues) iterFieldValues.next(); % tdinput type=radio name=%=name% value=%=fieldValueDflt% %if (fieldValueAnswer.equals(fieldValueDflt)) {%checked %}% /%=fieldValueDflt%/td % } % Thanx in advance, Vijay -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
dynamic form field creation from Database with DynaFormBean
HI, I am not sure if this reached the list the first time round. I have the following DynaFormBean defined in tiles-def.xml: form-bean name=answerDetailsForm dynamic=true type=org.apache.struts.action.DynaActionForm form-property name=fieldIdMemberIds type=java.lang.String[] / form-property name=questionName type=java.lang.String / /form-bean I am using the following code excerpt from the form which creates the %=name% dynamically based on values returned from the database.I want to use DynaFormBeans or a sub-class of it or DynaValidatorForm to make sure that the field is required and one of the radio buttons for each field is checked. How can I do that ? % for (int i1=0;i1 fields.length; i1++) { Field field = (Field)fields[i1]; long fieldId = field.getFieldId(); String name = fieldValue; String member = memberId + memberId; name = name + fieldId + member; % tr align=right tdinput type=hidden name=fieldIdMemberIds value=%=name % //td html:errors property=%=name% / td%=field.getFieldName()% /td % Collection colFieldValues = FieldValuesHandler.getFieldValues(fieldId); Iterator iterFieldValues = colFieldValues.iterator(); while (iterFieldValues.hasNext()) { FieldValues fieldValue = (FieldValues) iterFieldValues.next(); % tdinput type=radio name=%=name% value=%=fieldValueDflt% %if (fieldValueAnswer.equals(fieldValueDflt)) {%checked %}% /%=fieldValueDflt%/td % } % I have the following code in my action class and call validate(..) method from the execute() method: public ActionForward validate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException { boolean validated = true; DynaActionForm dynaForm = (DynaActionForm) form; String[] fieldIDMemberIds = (String[]) dynaForm.get(fieldIdMemberIds); for (int i = 0; i fieldIDMemberIds.length; i++) { String fieldIdMemberId = fieldIDMemberIds[i]; String answer = request.getParameter(fieldIdMemberId); if (answer == null || answer.length()= 0) { ActionErrors errors = new ActionErrors(); ActionError newError = new ActionError(validate.error.required,fieldIdMemberId); errors.add(ActionErrors.GLOBAL_ERROR, newError); saveErrors(request, errors); // Return back to the previous state validated = false; } } if (validated) { return null; } else { return mapping.getInputForward(); } } Unfortunately, when i try to use html:errors /, it just prints out the last error only. Thanx in advance, Vijay -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Dynamic form and Upload
Hi, I want to use struts dynamic form feature. There is form which has an upload file filed and some input text. I used below in struts_config.xml form-bean name=TenderVwcredForm dynamic=true type=org.apache.struts.validator.DynaValidatorForm form-property name=tenderTitle type=java.lang.String/ form-property name=productName type=java.lang.String/ form-property name=tenderFile type=org.apache.struts.upload.FormFile/ /form-bean But I got the classcast exception: error BeanUtils.populate org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'java.lang.String' to property 'tenderFile' of type 'org.apache.struts.upload.F ormFile' Please help. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Dynamic form and Upload
On Sat, 2 Nov 2002, Mr Alireza Fattahi wrote: Date: Sat, 2 Nov 2002 05:21:12 + (GMT) From: Mr Alireza Fattahi [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Dynamic form and Upload Hi, I want to use struts dynamic form feature. There is form which has an upload file filed and some input text. Using form beans (either standard ActionForm subclasses or using DynaActionForm/DynaValidatorActionForm) is not sufficient for supporting file upload functionality. You must explisitly use the file upload support provided by Struts directly (in 1.0) or indirectly via the commons-fileupload module( in 1.1). For an example of the required programming techiques, see the struts-upload example app that is included with the Struts distribution. Craig -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Dynamic form and Upload
Thanks for your reply, I have seen the example and an work with it, But my problem is I can not do that in an dynamic form. How should I do it in dynamic form, and what should I put in struts.config.xml? As I told I got the class cast expetion. Thanks __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Populating dynamic form beans
Drew McAuliffe wrote: Is there a simple way to populate a dynamic form bean with an object whose properties match the names of the configured fields in the form? I have not seen any reply to this question and I have the same related issue. Scenario is as follows: The same DynaValidatorForm is used both for creating and editing the data associated with a user account. For the creation action, nothing special needs to be done to the form since it simply needs to start empty. For the edit action, the form first needs to be populated with the data that already exists for the account to be edited. I thought that the edit action could simply call PropertyUtils.copyProperties(form, account) to populate the DynaValidatorForm prior to forwarding to the JSP page. This unfortunately does not work. What's the proper way to do this? Thanks. __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Problem validating dynamic Form with Validator-Framework
Hi, I've gfot problems with the validation Framework. (Struts 1.1b) If i try to validate a DynaValidatorForm I get the following error: java.lang.NullPointerException at org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:539) at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:357) at org.apache.struts.action.DynaActionForm.reset(DynaActionForm.java:158) at org.apache.struts.validator.DynaValidatorForm.reset(DynaValidatorForm.java:357) at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:618) at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:349) at de.neusta.j2ee.struts.NeustaRequestProcessor.process(Unknown Source) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107) at java.lang.Thread.run(Thread.java:484) My struts-config (extracts): form-bean name=createStandortForm type=org.apache.struts.validator.DynaValidatorActionFormform-property name=name type=java.lang.String initial= /form-property name=street type=java.lang.String initial= /form-property name=city type=java.lang.String initial= /form-property name=zipCode type=java.lang.String initial= /form-property name=description type=java.lang.String initial= /form-property name=phone type=java.lang.String initial= /form-property name=fax type=java.lang.String initial= /form-property name=mobile type=java.lang.String initial= /form-property name=locType type=java.lang.String initial= //form-bean/form-beans action path=/StandortErzeugen name=createStandortForm scope=session validate=true input=/StandortErzeugen type=de.neusta.fortuna.webapp.standort.CreateStandortAction forward name=success path=/Standort/StandortErzeugen.jsp / forward name=created path=/StandortVerwaltung.do / /action plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnamevalue=/WEB-INF/validator-rules.xml/ set-property property=pathname value=/WEB-INF/validator.xml/ /plug-in/struts-config
Re: Problem validating dynamic Form with Validator-Framework
Depending on which version of Struts you are using, you might need to set the dynamic attribute to true like this: form-bean dynamic=true name=createStandortForm type=org.apache.struts.validator.DynaValidatorActionForm !-- Form Property stuff here -- /form-bean I can't remember off the top of my head whether you needed to do this for the DynaValidatorActionForm. I know that this has been changed so the framework can now induce whether the class in the type attribute is a subclass of DynaActionForm, but it hasn't always been that way. If you using the latest nightly and this problem still happens, then this is probably not it. If you are using an older version of 1.1b (maybe a couple of weeks old), then try adding this attribute or getting the latest version. HTH, Chuck -- Sent via jApache.org -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem validating dynamic Form with Validator-Framework
That's it! It's got to be! Yes - you must always specify dynamic=true for these dynamic forms! :-) Bleh - please post things in a nicer format next time you have to post things. Some of us are spoiled to well-formatted configs and just can't read jumbled up messes very well. [EMAIL PROTECTED] wrote: Depending on which version of Struts you are using, you might need to set the dynamic attribute to true like this: form-bean dynamic=true name=createStandortForm type=org.apache.struts.validator.DynaValidatorActionForm !-- Form Property stuff here -- /form-bean I can't remember off the top of my head whether you needed to do this for the DynaValidatorActionForm. I know that this has been changed so the framework can now induce whether the class in the type attribute is a subclass of DynaActionForm, but it hasn't always been that way. If you using the latest nightly and this problem still happens, then this is probably not it. If you are using an older version of 1.1b (maybe a couple of weeks old), then try adding this attribute or getting the latest version. HTH, Chuck -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Dynamic form construction
I have the following problem: I have two forms. The first form has a field which contains the numbers of itens desired for user. The second form will be constructed based on the numbers of itens entered in the first. In struts is very easy to write the first form bean, ie: FirstFormBean.java private String numberOfItens; public void setNumberOfItens(String numberOfItens){ this.numberOfItens = numberOfItens } public String getNumberOfItens(){ return this.numberOfItens; } But i don't know how to write a bean for the second form! Can someone help me?? Below is a 'conceptual' snippet: Page one.jsp ... Number of itens: [ text ] ... Page two.jsp ... for ( i = 0 ; i number of itens ; i++) { Title : [ Text ] Description: [ Text ] Status : [ Radio] } ... Rodrigo Paes Ciência da Computação - UFAL Messenger - [EMAIL PROTECTED] ICQ - 85921785 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: dynamic form properties
Hi, Mark, How can I keep a form bean in a session scope? In addition how can I access a form bean from a jsp page directly, instead of using the jsp tags? Thanks, Daka - Original Message - From: Galbreath, Mark [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, June 06, 2002 5:58 AM Subject: RE: dynamic form properties What do you want to know? I use maps and collections in form beans now to capture multi-select list key-value pairs and checkbox array booleans, respectively. I think it would be a simple extrapolation to map key-values for an entire HTML form, permitting a single action form to capture states for every HTML form in the application if the form bean is kept in session scope with an empty reset(). Mark -Original Message- From: Zhihua Xu [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 2:10 AM In Struts 1.1 beta, a Map can be used instead of individual properties on an ActionForm. In the future, I foresee Struts developers using the same base ActionForm in all their projects, without going through the hassle of defining all these String properites. Does anyone have an example of the above usage? Thanks, Daka -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: dynamic form properties
1. Declare the bean's scope as session as an attribute of the form-bean declaration in struts-config.xml and provide an empty reset() method in the bean class; 2. Use java scriplets (though I do not recommend this) as in % List myBean = (List) session.getAttribute( myBean); Iterator i = myBean.iterator(); while( i.hasNext()) { out.println( td + i.next().toString() + /td); } % Goot Morgdah, Mark -Original Message- From: Zhihua Xu [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 2:38 PM Hi, Mark, How can I keep a form bean in a session scope? In addition how can I access a form bean from a jsp page directly, instead of using the jsp tags? Thanks, Daka -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: dynamic form properties
Mark, My scenario is a database application where the number of properties and the actual property labels, which will be used in an entry form, can only be determined at run time. How can I get the number of properties and the corresponding property labels to the jsp and the form bean? Thanks, Daka - Original Message - From: Galbreath, Mark [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, June 06, 2002 5:58 AM Subject: RE: dynamic form properties What do you want to know? I use maps and collections in form beans now to capture multi-select list key-value pairs and checkbox array booleans, respectively. I think it would be a simple extrapolation to map key-values for an entire HTML form, permitting a single action form to capture states for every HTML form in the application if the form bean is kept in session scope with an empty reset(). Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic form properties
Hi, I have a requirement to create (n number of)radio buttons dynamically.I would like to validate them at form, How would i do this as these are dynamic properties?. Like Administrator has got 3 options to choose against each student name, ex. in MVC it looks like % for (int i=0;ivectSize;i++){ % Name : %certCode[i]% input type=radio name=%= certCode[i] % %= (answer!=null answer.equals(Y))?checked: % value=Y input type=radio name=%= certCode[i] % %= (answer!=null answer.equals(X))?checked: % value=X input type=radio name=%= certCode[i] % %= (answer!=null answer.equals(Z))?checked: % value=Z %}//for ends % TIA yaman -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: dynamic form properties
What do you want to know? I use maps and collections in form beans now to capture multi-select list key-value pairs and checkbox array booleans, respectively. I think it would be a simple extrapolation to map key-values for an entire HTML form, permitting a single action form to capture states for every HTML form in the application if the form bean is kept in session scope with an empty reset(). Mark -Original Message- From: Zhihua Xu [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 2:10 AM In Struts 1.1 beta, a Map can be used instead of individual properties on an ActionForm. In the future, I foresee Struts developers using the same base ActionForm in all their projects, without going through the hassle of defining all these String properites. Does anyone have an example of the above usage? Thanks, Daka -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic form properties
Hi, there, I have learned the following, In Struts 1.1 beta, a Map can be used instead of individual properties on an ActionForm. In the future, I foresee Struts developers using the same base ActionForm in all their projects, without going through the hassle of defining all these String properites. Does anyone have an example of the above usage? Thanks, Daka
RE: dynamic form properties
Are you talking about the DynaActionForm? James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://struts-atlanta.open-tools.org ICQ: 27651409 AOLIM: jmitchtx (and NO I dont use AOL;) -Original Message- From: Zhihua Xu [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 2:10 AM To: [EMAIL PROTECTED] Subject: dynamic form properties Hi, there, I have learned the following, In Struts 1.1 beta, a Map can be used instead of individual properties on an ActionForm. In the future, I foresee Struts developers using the same base ActionForm in all their projects, without going through the hassle of defining all these String properites. Does anyone have an example of the above usage? Thanks, Daka -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Dynamic form in struts 1.0.2
Hi I'm using Struts 1.0.2 and I've been struggling a while with a problem and I still don't know how to find a solution. I have a form filled from a database query. form Some text 1input type=hidden name=publication value=Some text 1input type=text name=ordervalue value=br Some text 2input type=hidden name=publication value=Some text 2input type=text name=ordervalue value=br ... /form The user fills the form with some values in the ordervalue-fields and posts it to a new window. In the new window I have a new form where I want to add the posted values to a hidden field. I'm perfectly satisfied with just a string representation of the name-value-pairs in the first form. But only the rows that are not left blank. I don't know how many fields there will be in the first form as they are generated. How should I do to transfer this information between the two forms to the hidden field Any help is appreciated. Best regards Andreas Guillemot -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: dynamic form using nested:file?
Your first statement, ...I have a form that can have N number of images... Does not warrant the use of nested tag library. Simply use the standard iterator, and indexed properties of the html:file tag, to properly output your file names as file[1], file[2], file[3]. -AP_ http://www.alexparansky.com Java/J2EE Architect/Consultant http://www.myprofiles.com/member/view.do?profileId=127 -Original Message- From: Elijah Jacobs [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 8:49 AM To: Struts Users Mailing List Subject: dynamic form using nested:file? hi all, I have a form that can have N number of images. So in essence it's like the Monkey struts example by Arron Bates except where he has bananas, i have images. The problems is that I have to associate a FormFile for each image, since each image can be updated (hence an image upload is needed for that particular image).. for example if N=3 then a user can update image 2 to another image. A user can also add an image increasing N to 4 I am using the nested tags for struts 1.0 (nested_tags_10.jar). So I have this set up: start of code = FormBean.java pivate ArrayList slideImageList;(with associating set/get methods) .. contains a list of ImageItem ImageItem.java -- what is contained in the slideImageList private Image image; // and image object containing image_name, url, etc... private FormFile file;// the FormFile I want to associate to the image above. Idealy I would want this on my JSP page: nested:iterate property=slideImageList nested:nest property=image nested:write property=url/ /font /nested:nest nested:file property=file/ /td%!-- this is where i get in trouble --% /nested:iterate === end of code Since the nested tag does not have an associating html:file tag then I'm stuck. Does anyone know a way to get around this? thanks, - ej -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic form using nested:file?
hi all, I have a form that can have N number of images. So in essence it's like the Monkey struts example by Arron Bates except where he has bananas, i have images. The problems is that I have to associate a FormFile for each image, since each image can be updated (hence an image upload is needed for that particular image).. for example if N=3 then a user can update image 2 to another image. A user can also add an image increasing N to 4 I am using the nested tags for struts 1.0 (nested_tags_10.jar). So I have this set up: start of code = FormBean.java pivate ArrayList slideImageList;(with associating set/get methods) .. contains a list of ImageItem ImageItem.java -- what is contained in the slideImageList private Image image; // and image object containing image_name, url, etc... private FormFile file;// the FormFile I want to associate to the image above. Idealy I would want this on my JSP page: nested:iterate property=slideImageList nested:nest property=image nested:write property=url/ /font /nested:nest nested:file property=file/ /td%!-- this is where i get in trouble --% /nested:iterate === end of code Since the nested tag does not have an associating html:file tag then I'm stuck. Does anyone know a way to get around this? thanks, - ej -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic form using nested:file?
hi all, (forgive me if this is a duplicate... server problems) I have a form that can have N number of images. So in essence it's like the Monkey struts example by Arron Bates except where he has bananas, i have images. The problems is that I have to associate a FormFile for each image, since each image can be updated (hence an image upload is needed for that particular image).. for example if N=3 then a user can update image 2 to another image. A user can also add an image increasing N to 4 I am using the nested tags for struts 1.0 (nested_tags_10.jar). So I have this set up: start of code = FormBean.java pivate ArrayList slideImageList;(with associating set/get methods) .. contains a list of ImageItem ImageItem.java -- what is contained in the slideImageList private Image image; // and image object containing image_name, url, etc... private FormFile file;// the FormFile I want to associate to the image above. Idealy I would want this on my JSP page: nested:iterate property=slideImageList nested:nest property=image nested:write property=url/ /font /nested:nest nested:file property=file/ /td%!-- this is where i get in trouble --% /nested:iterate === end of code Since the nested tag does not have an associating html:file tag then I'm stuck. Does anyone know a way to get around this? thanks, - ej -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: dynamic form using nested:file?
Elijah, Sorry about the lack of the tag. It's on its way. Pick it up in the next nightly build. Arron. Elijah Jacobs wrote: hi all, I have a form that can have N number of images. So in essence it's like the Monkey struts example by Arron Bates except where he has bananas, i have images. The problems is that I have to associate a FormFile for each image, since each image can be updated (hence an image upload is needed for that particular image).. for example if N=3 then a user can update image 2 to another image. A user can also add an image increasing N to 4 I am using the nested tags for struts 1.0 (nested_tags_10.jar). So I have this set up: start of code = FormBean.java pivate ArrayList slideImageList;(with associating set/get methods) .. contains a list of ImageItem ImageItem.java -- what is contained in the slideImageList private Image image; // and image object containing image_name, url, etc... private FormFile file;// the FormFile I want to associate to the image above. Idealy I would want this on my JSP page: nested:iterate property=slideImageList nested:nest property=image nested:write property=url/ /font /nested:nest nested:file property=file/ /td%!-- this is where i get in trouble --% /nested:iterate === end of code Since the nested tag does not have an associating html:file tag then I'm stuck. Does anyone know a way to get around this? thanks, - ej -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic form using nested:file?
hi all, I have a form that can have N number of images. So in essence it's like the Monkey struts example by Arron Bates except where he has bananas, i have images. The problems is that I have to associate a FormFile for each image, since each image can be updated (hence an image upload is needed for that particular image).. for example if N=3 then a user can update image 2 to another image. A user can also add an image increasing N to 4 I am using the nested tags for struts 1.0 (nested_tags_10.jar). So I have this set up: start of code = FormBean.java pivate ArrayList slideImageList;(with associating set/get methods) .. contains a list of ImageItem ImageItem.java -- what is contained in the slideImageList private Image image; // and image object containing image_name, url, etc... private FormFile file;// the FormFile I want to associate to the image above. Idealy I would want this on my JSP page: nested:iterate property=slideImageList nested:nest property=image nested:write property=url/ /font /nested:nest nested:file property=file/ /td%!-- this is where i get in trouble --% /nested:iterate === end of code Since the nested tag does not have an associating html:file tag then I'm stuck. Does anyone know a way to get around this? thanks, - ej -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Nested Dynamic Form Question
Hi I was wondering if one can nest Dynamic forms. If I have the following: form-bean name=subjectForm type=org.apache.struts.validator.DynaValidatorForm dynamic=true form-property name=id type=java.lang.int/ form-property name=description type=java.lang.String/ /form-bean form-bean name=courseForm type=org.apache.struts.validator.DynaValidatorForm dynamic=true form-property name=nametype=java.lang.String/ form-property name=description type=java.lang.String/ form-property name=subjectstype=X[]/ /form-bean I want to specify that the 'subjectForm' is a property of 'courseForm' and accesible via form-property 'subjects' Thank you in advance Manie Coetzee -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: 'dynamic' form elements in a ActionForm
It's difficult to do this in the 1.0.x release, but simple as pie in the 1.1 beta and nightly build. http://jguru.com/forums/view.jsp?EID=567079 -- Ted Husted, Husted dot Com, Fairport NY US -- Developing Java Web Applications with Struts -- Tel: +1 585 737-3463 -- Web: http://husted.com/about/services Struts Newsgroup (@Basebeans.com) wrote: Subject: 'dynamic' form elements in a ActionForm From: Greg Tillbrook [EMAIL PROTECTED] === Hi Ive been tryig to use an ActionForm bean for a form which can have a variable number of form elements (as defined by a 'meta' configuration file). Ive hit on the problem though that each parameter in a form bean matched to a form element has to declared when implementing the bean. Is it possible to specify a list (i.e. vector or hashtable) in the form bean that will contain all of these 'dynamic' parameters or is there a better way? I have looked at the documentation/web/this newsgroup but have found nothing that seemed appropriate. Apologies if Ive missed something obvious but Im pretty new to struts atm. cheers Greg -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
'dynamic' form elements in a ActionForm
Subject: 'dynamic' form elements in a ActionForm From: Greg Tillbrook [EMAIL PROTECTED] === Hi Ive been tryig to use an ActionForm bean for a form which can have a variable number of form elements (as defined by a 'meta' configuration file). Ive hit on the problem though that each parameter in a form bean matched to a form element has to declared when implementing the bean. Is it possible to specify a list (i.e. vector or hashtable) in the form bean that will contain all of these 'dynamic' parameters or is there a better way? I have looked at the documentation/web/this newsgroup but have found nothing that seemed appropriate. Apologies if Ive missed something obvious but Im pretty new to struts atm. cheers Greg -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Dynamic form fields
I've searched the mail list and cannot find a clear answer to this one! Here is an example of what I need: A user enters the # of Travelers for their vacation in the first jsp of the sequence. In the second jsp I want to display an html:text input field for each traveler's age. what is the simplest way to accomplish this using Struts? Thank you for any response. JBR
collecting parameters from a dynamic form
I have a dynamic form that is built from an ArrayList of objects (see below (b) ). Building the form works great. I get multiple rows of widget names and values. However, I can't seem to collect the data in my Action. The HTML that is rendered just repeats the same named input fields (see below (b)). In my action, my widget ArrayList comes in with the right number of objects, but they are blank (no data has been collected from the form). A request.getParameter(name)); request.getParameter(value)); works, but of course only returns one of the sets of data - the first in the form. So I can't seem to retrieve the multiple values from in my Action class in any way. Am I doing something that can't be done? (a) input type=text name=name input type=text name=value input type=text name=name input type=text name=value (b) html:form action=/saveWidgets logic:iterate id=element name=widgetForm property=widgets table tr th Widget Name /th td html:text name=element property=name /td /tr tr th Widget Value /th td html:text name=element property=value /td /tr /logic:iterate /html:form Thanks Jeff http://www.xns.org/=jeffoberlander -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: collecting parameters from a dynamic form
The issue is one of distinct element names when you use an iterator to create your form. I found the solution by way of the indexed=true property of html:text It produces a parameter name of element[0].name - where element is the name given to the iterator object and the bracket represents the index of the iterator. Apparently this is new though because I had to install the nightly build in order to use it. Jeff -Original Message- From: Marcus Brito [mailto:[EMAIL PROTECTED]] Sent: Monday, February 04, 2002 10:40 AM To: Struts Users Mailing List Subject: Re: collecting parameters from a dynamic form Em Seg, 2002-02-04 às 14:11, Jeff Oberlander escreveu: request.getParameter(name)); request.getParameter(value)); works, but of course only returns one of the sets of data - the first in the form. Take a look at the HttpServletRequest API. If you need to get multiple values for a parameter, you need to use the getParameterValues() method. -- Ja ne, Pazu mailto: [EMAIL PROTECTED] Anime Gaiden: de fãs para fãs, sempre. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: dynamic form action flow
SavePhoneNumberAction.java -- editPhoneNumbers.do It may be that this is looking up the original phone number again. If so, this is also where the recyling message could be coming into it. Do you want to go back through the edit action, or straight to the display page? -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Jeff Oberlander wrote: Ok, I've wasted an embarrassing amount of time on this and would appreciate any help. Its night now and no progress has been made. This is another action flow question. Maybe there is a sample somewhere that does this? I apologize that this is long. I have an action form that contains an ArrayList of items (lets say phone numbers). The form allows me to edit existing numbers or add new ones. When I go to the editPhoneNumbers.jsp page, it displays all of my phone numbers based on the ArrayList with a button to add another and a button to save the form. I start with a single phone number - e.g. my home number. If you hit add, the form should be re-displayed with 2 phone number fields - my home one, and a new blank one - both editable. This is the action flow I currently have: editPhoneNumbers.do -- EditPhoneNumberAction.java (input is PhoneNumberForm - containing an ArrayList of numbers) - this loads my current phone numbers from the data store into the form. EditPhoneNumberAction -- editPhoneNumber.jsp - this displays the form. editPhoneNumber.jsp -- SavePhoneNumberAction.java (action = add | save) SavePhoneNumberAction.java - if the action is add, I add an empty PhoneNumber object to the ActionForm ArrayList, then I want to redisplay the form with the original item, and the blank new one. SavePhoneNumberAction.java -- editPhoneNumbers.do Loop is complete. I thought this would be as simple as adding a new item to the ArrayList in the form and forwarding on the original form. It doesn't work. I keep getting back (in the display) only my home phone number (the original form without the new object) I suspect it is related to this log message: Recycling existing ActionForm bean instance of class . Another interesting point is even though I explicitly set the action property of the form in SavePhoneNumberAction, it always comes into EditPhoneNumberAction as null. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: dynamic form action flow
Actually, it doesn't. I've been through that example pretty thouroughly. To add a new subscription, it puts up a form with only the fields for the new subscription (a separate page). It doesn't dynamically new form fields to an existing page. -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 2:05 AM To: 'Struts Users Mailing List' Subject: RE: dynamic form action flow Hi Jeff, The struts-example.war app does just this, except it uses subscriptions instead of phone numbers. It's part of the struts download, under webapps. Jon. -Original Message- From: Jeff Oberlander [mailto:[EMAIL PROTECTED]] Sent: 01 February 2002 06:08 To: '[EMAIL PROTECTED]' Subject: dynamic form action flow Ok, I've wasted an embarrassing amount of time on this and would appreciate any help. Its night now and no progress has been made. This is another action flow question. Maybe there is a sample somewhere that does this? I apologize that this is long. I have an action form that contains an ArrayList of items (lets say phone numbers). The form allows me to edit existing numbers or add new ones. When I go to the editPhoneNumbers.jsp page, it displays all of my phone numbers based on the ArrayList with a button to add another and a button to save the form. I start with a single phone number - e.g. my home number. If you hit add, the form should be re-displayed with 2 phone number fields - my home one, and a new blank one - both editable. This is the action flow I currently have: editPhoneNumbers.do -- EditPhoneNumberAction.java (input is PhoneNumberForm - containing an ArrayList of numbers) - this loads my current phone numbers from the data store into the form. EditPhoneNumberAction -- editPhoneNumber.jsp - this displays the form. editPhoneNumber.jsp -- SavePhoneNumberAction.java (action = add | save) SavePhoneNumberAction.java - if the action is add, I add an empty PhoneNumber object to the ActionForm ArrayList, then I want to redisplay the form with the original item, and the blank new one. SavePhoneNumberAction.java -- editPhoneNumbers.do Loop is complete. I thought this would be as simple as adding a new item to the ArrayList in the form and forwarding on the original form. It doesn't work. I keep getting back (in the display) only my home phone number (the original form without the new object) I suspect it is related to this log message: Recycling existing ActionForm bean instance of class . Another interesting point is even though I explicitly set the action property of the form in SavePhoneNumberAction, it always comes into EditPhoneNumberAction as null. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: dynamic form action flow
I've tried going straight to the display page and then I get the new, blank element and form, but lose the prior existing form fields (home phone). -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 4:14 AM To: Struts Users Mailing List Subject: Re: dynamic form action flow SavePhoneNumberAction.java -- editPhoneNumbers.do It may be that this is looking up the original phone number again. If so, this is also where the recyling message could be coming into it. Do you want to go back through the edit action, or straight to the display page? -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Jeff Oberlander wrote: Ok, I've wasted an embarrassing amount of time on this and would appreciate any help. Its night now and no progress has been made. This is another action flow question. Maybe there is a sample somewhere that does this? I apologize that this is long. I have an action form that contains an ArrayList of items (lets say phone numbers). The form allows me to edit existing numbers or add new ones. When I go to the editPhoneNumbers.jsp page, it displays all of my phone numbers based on the ArrayList with a button to add another and a button to save the form. I start with a single phone number - e.g. my home number. If you hit add, the form should be re-displayed with 2 phone number fields - my home one, and a new blank one - both editable. This is the action flow I currently have: editPhoneNumbers.do -- EditPhoneNumberAction.java (input is PhoneNumberForm - containing an ArrayList of numbers) - this loads my current phone numbers from the data store into the form. EditPhoneNumberAction -- editPhoneNumber.jsp - this displays the form. editPhoneNumber.jsp -- SavePhoneNumberAction.java (action = add | save) SavePhoneNumberAction.java - if the action is add, I add an empty PhoneNumber object to the ActionForm ArrayList, then I want to redisplay the form with the original item, and the blank new one. SavePhoneNumberAction.java -- editPhoneNumbers.do Loop is complete. I thought this would be as simple as adding a new item to the ArrayList in the form and forwarding on the original form. It doesn't work. I keep getting back (in the display) only my home phone number (the original form without the new object) I suspect it is related to this log message: Recycling existing ActionForm bean instance of class . Another interesting point is even though I explicitly set the action property of the form in SavePhoneNumberAction, it always comes into EditPhoneNumberAction as null. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: dynamic form action flow
I figured this out finally, thanks to the Vectors in Form thread today, which turned out to be similar It was 2 things: 1) The scope in my struts-config was request and should have been session. 2) Upon adding a new blank object to the ArrayList for re-display, instead of forwarding to the editPhoneNumbers.do action, directly re-display the jsp. -Original Message- From: Jeff Oberlander Sent: Friday, February 01, 2002 7:39 AM To: 'Struts Users Mailing List' Subject: RE: dynamic form action flow I've tried going straight to the display page and then I get the new, blank element and form, but lose the prior existing form fields (home phone). -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 4:14 AM To: Struts Users Mailing List Subject: Re: dynamic form action flow SavePhoneNumberAction.java -- editPhoneNumbers.do It may be that this is looking up the original phone number again. If so, this is also where the recyling message could be coming into it. Do you want to go back through the edit action, or straight to the display page? -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Jeff Oberlander wrote: Ok, I've wasted an embarrassing amount of time on this and would appreciate any help. Its night now and no progress has been made. This is another action flow question. Maybe there is a sample somewhere that does this? I apologize that this is long. I have an action form that contains an ArrayList of items (lets say phone numbers). The form allows me to edit existing numbers or add new ones. When I go to the editPhoneNumbers.jsp page, it displays all of my phone numbers based on the ArrayList with a button to add another and a button to save the form. I start with a single phone number - e.g. my home number. If you hit add, the form should be re-displayed with 2 phone number fields - my home one, and a new blank one - both editable. This is the action flow I currently have: editPhoneNumbers.do -- EditPhoneNumberAction.java (input is PhoneNumberForm - containing an ArrayList of numbers) - this loads my current phone numbers from the data store into the form. EditPhoneNumberAction -- editPhoneNumber.jsp - this displays the form. editPhoneNumber.jsp -- SavePhoneNumberAction.java (action = add | save) SavePhoneNumberAction.java - if the action is add, I add an empty PhoneNumber object to the ActionForm ArrayList, then I want to redisplay the form with the original item, and the blank new one. SavePhoneNumberAction.java -- editPhoneNumbers.do Loop is complete. I thought this would be as simple as adding a new item to the ArrayList in the form and forwarding on the original form. It doesn't work. I keep getting back (in the display) only my home phone number (the original form without the new object) I suspect it is related to this log message: Recycling existing ActionForm bean instance of class . Another interesting point is even though I explicitly set the action property of the form in SavePhoneNumberAction, it always comes into EditPhoneNumberAction as null. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic form action flow
Ok, I've wasted an embarrassing amount of time on this and would appreciate any help. Its night now and no progress has been made. This is another action flow question. Maybe there is a sample somewhere that does this? I apologize that this is long. I have an action form that contains an ArrayList of items (lets say phone numbers). The form allows me to edit existing numbers or add new ones. When I go to the editPhoneNumbers.jsp page, it displays all of my phone numbers based on the ArrayList with a button to add another and a button to save the form. I start with a single phone number - e.g. my home number. If you hit add, the form should be re-displayed with 2 phone number fields - my home one, and a new blank one - both editable. This is the action flow I currently have: editPhoneNumbers.do -- EditPhoneNumberAction.java (input is PhoneNumberForm - containing an ArrayList of numbers) - this loads my current phone numbers from the data store into the form. EditPhoneNumberAction -- editPhoneNumber.jsp - this displays the form. editPhoneNumber.jsp -- SavePhoneNumberAction.java (action = add | save) SavePhoneNumberAction.java - if the action is add, I add an empty PhoneNumber object to the ActionForm ArrayList, then I want to redisplay the form with the original item, and the blank new one. SavePhoneNumberAction.java -- editPhoneNumbers.do Loop is complete. I thought this would be as simple as adding a new item to the ArrayList in the form and forwarding on the original form. It doesn't work. I keep getting back (in the display) only my home phone number (the original form without the new object) I suspect it is related to this log message: Recycling existing ActionForm bean instance of class . Another interesting point is even though I explicitly set the action property of the form in SavePhoneNumberAction, it always comes into EditPhoneNumberAction as null. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Dynamic Form Beans?
Hi John, Are you able to slove this problem?if so, Can you help me out? Stephen. -Original Message- From: John Townsend [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, August 29, 2001 8:19 PM To: [EMAIL PROTECTED]; 'Luis Olivares' Subject: RE: Dynamic Form Beans? The one idea that I had was to create a new subclass of ActionForm called ActionDataForm. This form would have get and put methods that use keys instead of the usual pattern of numerous getters/setters. For the process of saving form data, we could add a new override to RequestUtils.processPopulate(..) which would take an ActionDataForm instead of an ActionForm as its form instance. Then we would implement this method to use get and put with keys instead of getters/setters. One problem: I don't know how the populate works from the other side (meaning when you want to prepopulate a form based on the contents of a JavaBean in the session, etc.). I imagine that logic is contained in the HTML tag libraries or some other tag library. I guess what I am wondering is that since a number of people have run into this and needed a solution I assumed that there might already be a solution to this problem. If not, maybe we can find a solution and then submit a patch to Struts for 1.1 or something. Anyone else have any thoughts on this? -- John Townsend PS. One thing I just thought of: I wonder if there is a JavaBeans solution to this problem? If there is, that might be a better way to go. -Original Message- From: Luis Olivares [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 29, 2001 11:28 AM To: [EMAIL PROTECTED] Subject: Re: Dynamic Form Beans? I have the same 'problem'. I would like to be able to create a form dynamically depending on the structure of a table (I used to do this with 'plain' JSP). Any ideas? Regards. Luis Olivares. [EMAIL PROTECTED] -- Intelligence is the ability to avoid doing work, yet getting the work done --Linus Torvalds-- - Original Message - From: John Townsend [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 29, 2001 12:54 PM Subject: Dynamic Form Beans? I am working on a project where is would be nice to have the ability to define a dynamic form bean (i.e. a form bean where the fields are defined at runtime). The most obvious (but perhaps not the best) solution to this problem would be if the ActionServlet could handle saving data in a form bean that was a hashtable. Has someone else run into this problem and come up with a solution? Thanks, -- John Townsend