FW: Multiple formfile uploads - howto?
Hey all, With a simple JSP page with just one strutshtml:file tag I can easily load a file into a FormFile object into my Form (with normal getter and setter), and then use an Action to work with the Form. But, when trying to make this simple JSP page display 1-N strutshtml:file... tags to load up many files, the system breaks in between the JSP page and the Form, never reaching the Action. I have not had success with FormFile[], HashMap, etc. ==JSP code== !-for HashMap strutslogic:iterate id=ai name=uploadform property=mystuff TR TD CENTERstrutshtml:text name=ai property=key/filename/centeR /TD TD strutshtml:file styleClass=fileInput size=100 name=ai property=value / /TD /TR /strutslogic:iterate !-or for FormFile[] strutslogic:iterate id=ai name=uploadform property=mystuff TD CENTERstrutshtml:text name=ai property=mystuff//centeR /TD /strutslogic:iterate ==Form code== public class UploadForm extends BaseForm { /*HashMap doesn't work*/ protected java.util.HashMap mystuff = new HashMap(); public HashMap getMystuff() { return mystuff; } public void setMystuff(HashMap mystuff) { this.mystuff = mystuff; } /*FormFile[] doesn't work*/ protected FormFile[] mystuff; public FormFilegetMystuff() { return mystuff; } public void setMystuff(FormFilemystuff) { this.mystuff = mystuff; } ==ERROR== argument type mismatch Has anyone been successful in uploading an unknown number of files at once through Struts, or is Struts unable to handle this? TIA! -D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JBoss
With Tomcat you have your container that you can run your java servlets and JSP's. With Jboss, you have tomcat (or Jetty) as your container to run your java servlets and JSP's. In addition, you have an EJB container to run EJB applications (i.e. entity bean and session beans), and have access to JNDI for appserver configuration of commonly used services. Perfect example is you configure the APP SERVER (and not the applications) for your authorization/authentication environment and configure the APP SERVER (again, not all the applications that you build) to point to the databases that you want to work with. So, the APP SERVER does all the backend work, such as configuration, configuration changes, connection pooling, blah blah blah. And, of course, JBoss is an App Server that does all that and is well respected (not to mention open source!). my two coppers, -D -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:54 AM To: 'Struts Users Mailing List' Subject: RE: JBoss Tomcat and JBoss work well together. In simple terms, think of Tomcat as your servlet container and JBoss as your EJB container. Wiebe http://frontierj.blogspot.com http://frontierj.blogspot.com/ -Original Message- From: Horky Adam G A1C 805 CSPTS/SCBE [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 7:19 AM To: [EMAIL PROTECTED] Subject: JBoss I noticed some of the developers on this mailing list advocating the use of JBoss. I am currently reading some docs on JBoss, but I don't have a clear understanding of it yet. I currently use Tomcat as my app server. Does it run over Tomcat? Can anyone recommend some good documentation on what exactly JBoss is? A1C Adam G Horky Application Development Programmer, SCBE (618)256-2300 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: newbie: Best Practice Struts/Value-Objects?
To make sure I understand, the options so far are to: 1. Pass the full VO to the view, create the 15 other fields as hidden tags within the form, and then on submit Action create a blank VO and populate with the fields and send to the DB. 2. Pass the full VO to the view, get the 5 fields that are changed from the form, and then on submit Action re-create the original VO and simply change the 5 fields within that newly created original and pass that back to the DB. 3. Create specialized LightVO's that are only the field groupings that will be changed for that submit Action (and send the LightVO's back to the DB as-is with the changes from the form). With #1 I mentioned some concerns with maintanence but some good options came up on how to work around those. #3 seems the best approach for an environment that will be setup and not likely to change and the 'end result' for a good system (aka after there are NO more changes, and we know how often that is). But for my scenario/environment, of the options presented it seems #2 is the best combination for low-maintanence and flexibility to get started on a project and then as things settle down and performance becomes a motivator move to #3 (which is an easy migration path). Does this seem to correctly identify all the options of using Value-Objects with Struts? -D -Original Message- From: Menke, John [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 3:31 PM To: 'Struts Users Mailing List' Subject: RE: newbie: Best Practice Struts/Value-Objects? Maybe make what we call a displayBean in our app. It is not a VO as we view VO's to be more domain oriented. It's just for the front end. In your action create the display bean and set it on the form. Then in your action have logic to take values from displayBean and set them in the VO. We don't want our API to get crowded with view oriented objects so the displayBean is kept in the same package as the actions. VO's are more domain oriented and can go into API package. -jm -Original Message- From: Darren Hartford [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 2:20 PM To: Struts Users Mailing List Subject: RE: newbie: Best Practice Struts/Value-Objects? Hi John, Yeah, that is one (messy) solution to my problem. My concern is I would have to do add those 15 fields in every JSP page that sends the VO back, and if I have to make a change to the DB/VO, then go back over every JSP page again to make more changes. I'm trying to get to as low-maintanence as possible initially, even if it means sacrificing some performance by not using light-value-objects in the beginning. Can always make it faster after it is working correctly, right? ;-) I'm still lost as to how to handle Struts with Value Objects though -D -Original Message- From: Menke, John [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 12:16 PM To: 'Struts Users Mailing List' Subject: RE: newbie: Best Practice Struts/Value-Objects? you could use hidden variables on your jsp page to store the VO attributes you are not changing and keep your VO intact only changing the 5 fields -Original Message- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 11:05 AM To: 'Struts Users Mailing List' Subject: RE: newbie: Best Practice Struts/Value-Objects? Hi Darren, I was under the impression that it works exactly the way you hope it does. Actually I'm pretty sure it does. Also what might be worth looking at ( I have to look at it myself ), is Light-value-objects where you only populate the initial value object with the 5 fields rather than the whole 20. This is obviously more optimal in terms of db queries. This is all pre-supposing you are using xdoclet and EJBs and xdoclet, which perhaps you are not. HTH, Brian -Original Message- From: Darren Hartford [mailto:[EMAIL PROTECTED] Sent: 02 October 2003 13:41 To: [EMAIL PROTECTED] Subject: newbie: Best Practice Struts/Value-Objects? Hi all! Been working with struts and value-objects, and I am beginning to understand the power of these two in combination. I did however run into a snag that may be either on purpose or just ignorance on my part. If I pass a 20-field value-object to an ActionForm (let's say an EmployeeVO), and I only show the employee's name and address for editing (only 5 or so fields). They make the necessary changes and submit the form. What I understand is the form will populate a NEW EmployeeVO and not make the changes to the original EmployeeVO, thereby creating an EmployeeVO populated only from the 5 fields on the form and nulling the other 15 fields. I was hoping to take an existing Value-Object, only make necessary changes from the submitted form (i.e. 0-5 changed fields and the other 15 stay the way they are), and then re-submit the Value-Object for updating the DB, but that does not seem possible. Am I doing something wrong and/or mis-understanding the best
newbie: Best Practice Struts/Value-Objects?
Hi all! Been working with struts and value-objects, and I am beginning to understand the power of these two in combination. I did however run into a snag that may be either on purpose or just ignorance on my part. If I pass a 20-field value-object to an ActionForm (let's say an EmployeeVO), and I only show the employee's name and address for editing (only 5 or so fields). They make the necessary changes and submit the form. What I understand is the form will populate a NEW EmployeeVO and not make the changes to the original EmployeeVO, thereby creating an EmployeeVO populated only from the 5 fields on the form and nulling the other 15 fields. I was hoping to take an existing Value-Object, only make necessary changes from the submitted form (i.e. 0-5 changed fields and the other 15 stay the way they are), and then re-submit the Value-Object for updating the DB, but that does not seem possible. Am I doing something wrong and/or mis-understanding the best utilization of Value-Objects with Struts? Again, I'm a newbie so any pointers, help, or examples would be great! thanky in advance! -D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: newbie: Best Practice Struts/Value-Objects?
Hi John, Yeah, that is one (messy) solution to my problem. My concern is I would have to do add those 15 fields in every JSP page that sends the VO back, and if I have to make a change to the DB/VO, then go back over every JSP page again to make more changes. I'm trying to get to as low-maintanence as possible initially, even if it means sacrificing some performance by not using light-value-objects in the beginning. Can always make it faster after it is working correctly, right? ;-) I'm still lost as to how to handle Struts with Value Objects though -D -Original Message- From: Menke, John [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 12:16 PM To: 'Struts Users Mailing List' Subject: RE: newbie: Best Practice Struts/Value-Objects? you could use hidden variables on your jsp page to store the VO attributes you are not changing and keep your VO intact only changing the 5 fields -Original Message- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 11:05 AM To: 'Struts Users Mailing List' Subject: RE: newbie: Best Practice Struts/Value-Objects? Hi Darren, I was under the impression that it works exactly the way you hope it does. Actually I'm pretty sure it does. Also what might be worth looking at ( I have to look at it myself ), is Light-value-objects where you only populate the initial value object with the 5 fields rather than the whole 20. This is obviously more optimal in terms of db queries. This is all pre-supposing you are using xdoclet and EJBs and xdoclet, which perhaps you are not. HTH, Brian -Original Message- From: Darren Hartford [mailto:[EMAIL PROTECTED] Sent: 02 October 2003 13:41 To: [EMAIL PROTECTED] Subject: newbie: Best Practice Struts/Value-Objects? Hi all! Been working with struts and value-objects, and I am beginning to understand the power of these two in combination. I did however run into a snag that may be either on purpose or just ignorance on my part. If I pass a 20-field value-object to an ActionForm (let's say an EmployeeVO), and I only show the employee's name and address for editing (only 5 or so fields). They make the necessary changes and submit the form. What I understand is the form will populate a NEW EmployeeVO and not make the changes to the original EmployeeVO, thereby creating an EmployeeVO populated only from the 5 fields on the form and nulling the other 15 fields. I was hoping to take an existing Value-Object, only make necessary changes from the submitted form (i.e. 0-5 changed fields and the other 15 stay the way they are), and then re-submit the Value-Object for updating the DB, but that does not seem possible. Am I doing something wrong and/or mis-understanding the best utilization of Value-Objects with Struts? Again, I'm a newbie so any pointers, help, or examples would be great! thanky in advance! -D - 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]