File Upload and error with web-site example
All, Some of my colleagues have been trying to set up a file upload today using your Struts framework. We had a look through the guideline documentation on the subject, and noticed a small error that you may be interested in (on page: http://jakarta.apache.org/struts/userGuide/building_view.html). The sample HTML looks something like this: <%@page language="java"> <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"> Please Input Text: Please Input The File You Wish to Upload: This code actually doesn't seem to work (an exception with setProperty() ). We think, and we've tested this, that you need to put an ' enctype ="multipart/form-data" ' attribute in the "html:form" tag. Hope this saves someone some time. Regards, The Agora Team -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk -- Agora Professional Services is an entrepreneurial consulting firm specialising in e-Business and innovative solutions since 1995.
Nested properties and javascript
All, When one uses nested beans as the FormBean (ActionForm) the html input field names (logically) have a dot in their names. This all work fine, i.e. the data can be posted back to the server and picked up by struts. However, JScript doesn't appear happy with objects having dots in their names (it naturally thinks that you mean a 'subobject' of an object). Anyone have any ideas on how to get around this? (apart from not using nested FormBeans?) Regards, Sean
Re: Problem Orion application server with STRUTS...
Yep this one happens to some deployments (not al!!) Just place the application properties file in the root of your classes directory, i.e. directly into web-inf/classes and reference it not in a sub-directory. I look forward to hearing if you come across the other problems we've hit. Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk -- Agora Professional Services is an entrepreneurial consulting firm specialising in e-Business and innovative solutions since 1995. "Jean-Francoi s Brassard" To: <[EMAIL PROTECTED]> Subject: Problem Orion application server with STRUTS... 23/07/2001 13:58 Please respond to struts-user Struts doesn't work with Orion for me, any people have a solution! Thank's in advance 01-07-22 22:24 strutsBlank: 1.0.2.2 Started 01-07-22 22:24 strutsBlank: Servlet error javax.servlet.jsp.JspException: Missing message for key index.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:242) at /index.jsp._jspService(/index.jsp.java:106) (JSP page line 8) at com.orionserver[Oracle9iAS (1.0.2.2) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5458) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189) at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62) 01-07-22 22:25 defaultWebApp: 1.0.2.2 Stopped 01-07-22 22:25 strutsBlank: org.apache.struts.action.ActionServlet: Finalizing this controller servlet 01-07-22 22:25 strutsBlank: 1.0.2.2 Stopped
Re: Struts with Oracle 9i Application Server and Jdeveloper....
I (and others) have had problems with OC4J and it's ApplicationContextClassLoader. Not a struts specific issue but has ocurred in all web-apps deployed into OC4J. Orion seem to be ignoring this bug report (#389). Regards, Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk -- Agora Professional Services is an entrepreneurial consulting firm specialising in e-Business and innovative solutions since 1995. "Jean-Francoi s Brassard" To: <[EMAIL PROTECTED]> Subject: Struts with Oracle 9i Application Server and Jdeveloper 20/07/2001 17:42 Please respond to struts-user Hi, I want to know if Struts works well with Oracle 9i Application Server and Jdeveloper!!! Thanks you in advance
Orion, Struts, and ClassLoader problem
All, Has anyone managed to resolve this issue? I've found many references to it on both Struts and Orion mailing lists, with reference to loading resources and classes. Had a play myself with Struts, loading up the classes using different class loader but to no avail. It appears that the problem of loading classes ocurrs when a class is in one jar file and it's parent class (super class) is in another jar (both located in web-inf/lib of course). I've re-opened bug number 389 in Orion's BugZilla (it was nice of them to mark it as resolved). Feel free to vote for it, though it won't let me. In the meantime, it looks like dumping all my jars (for ALL my apps) into ${orion.home}\lib ! (why won't companies be happy with open source containers like JBoss) Regards, Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk -- Agora Professional Services is an entrepreneurial consulting firm specialising in e-Business and innovative solutions since 1995.
Re: Know of any consulting companies?
Very much so. And not just jakarta. Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk -- Agora Professional Services is an entrepreneurial consulting firm specialising in e-Business and innovative solutions since 1995. Eric Loeb cc: Subject: Know of any consulting companies? 05/07/2001 21:40 Please respond to struts-user Is there an ARS-Digita-like consulting company that uses the various jakarta components to build web apps for clients? thanks in advance, Eric Loeb __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Re: validation in the form vs. validation in the business domain object
That's the way I'm looking to do it. I have a class called BuisnessException that descends from Exception. This is thrown and then I convert it to an ActionError within Struts. I plan to give the oppotunity to nest them at a later date. Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk -- Agora Professional Services is an entrepreneurial consulting firm specialising in e-Business and innovative solutions since 1995. David Winterfeldt To: [EMAIL PROTECTED] Subject: Re: validation in the form vs. validation in the business domain object 20/06/2001 08:05 Please respond to struts-user Someone I know extended Exception and they throw nested exceptions that eventually are passed back to the Struts layer and then an ActionError is constructed for each exception. Something like that seems like a clean way to keep things separated. I did something similiar on a project with a Swing and EJBs. David --- James Hoffa <[EMAIL PROTECTED]> wrote: > What ideas do people have about where is the best > place to perform validation of items that come back > from ActionForms? > > Example: check to see if the user's choice of > motherboard, memory, and cpu are compatible with > each > other. > > Following the struts example, it seems like the > validate() method in an ActionForm is used only for > light validation (i.e. checking to see if something > was left blank, or checking for alpha and numeric > chars). This approach seems correct to me, since > there > should not be business logic inside the ActionForm. > > That leaves most of the work to the business domain > object since any nontrivial application will not > have > business logic in the Action class either. > > The business domain object, in many cases, will be > accessed remotely from the Action class. > > Does it make sense for the business domain object to > return an ActionErrors object(it is serializable)? > I > am not 100% comfortable yet with the idea of > importing > ActionErrors into the business object since it > couples > it to struts to a certain extent, and it could > potentially be large. > > Is the only alternative to send back a list of > generic > error codes from the business object that each map > to > an ActionError and the Action class could add the > ActionErrors? (i think i'd rather import > actionerrors > in this case) > > What are some of the "best practices" people have > found to work for this problem? > > Craig and ALL Struts creators: Struts is really > great. Thank you for all of your hard work. It is > definitely something to be proud of. > > __ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail > http://personal.mail.yahoo.com/ __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Re: generate ActionForms
TogetherJ by togethersoft will (www.togethersoft.com) They have a free 'lightweight' version that will do what you want. Regards, Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk "Michael Schommer" cc: Subject: generate ActionForms 30/05/2001 15:56 Please respond to struts-user Hi, I want to generate the ActionForm-classes. Do somebody know something about tools to generate Java-classes? Gruß Michael -- Java - write once, run anywhere
Ideas (and a quick implementation) for extending Struts
All, If anyone read my last (and first) posting to the list they'll know that I'm new to Struts. Anyway, after deciding to plan on using Struts in my next project, I felt that for the application many Beans would be required for the many, many, many, forms. All of which will need extensive validation. So I decided that ideally one shouldn't need to define a Bean for each form, only define the data on the form to be picked up by the ActionServlet, validated and then passed to the custom Action class. Anyway, I thought that it would be a lot of work to implement and also read the current plans for version 1.1 (of Struts) and came up with a half-way house, for us in the interim. However, at the w/e I got bored and ended up writing my initial design and it is already just about useable. It's not complete and I'm sure there's lots of missing pieces and bugs. I intend to carry on with it this week as much as I can, but thought I'd just pass on more about it. Once it is more useable I'll willingly pass on the code to others, but it can't be easily back-engineered into newer releases of Struts, and I don't really want to spark any code-forking. But at the least it may spark some ideas for the Struts developers. My implementation of course is very rough and there are much better ways to do it, and I'm in no doubt that the team (knowing the framework inside-out) could do it much better. (I also have other ideas that would be cool too) Anyway, he's how it is used: (I've directly re-coded existing classes where necessary, and also made a new package. All original Struts functionality remains - I hope!.) 1. in the struts-config.xml file you have a definition for your forms, e.g. An additional property-mapping attribute is 'defaultValue'. 2. If validation is specified in web.xml then each data value is validated according to the data-type to be converted to and any regular expressions given (haven't implemented the regExp bit yet). Failure naturally takes the user back to the 'input' page (in the action-mappings). 3. All that happens then is that the ActionForm given in Action.process() is a subclass called org.apache.struts.data.DataForm which is a 'glorified Hashtable' of the values defined in the data-mapping for that form. 4. There will also be populate and extract methods on the DataForm class to automatically 'move' values to and from the DataForm and a Bean (or EJB) given. Using this extension to Struts will greatly speed the development of our next project, but it would be good if something like it could be incorporated into the original code-stream. Anyway, if people are interested in it then let me know and once I've put some more work into it I'll be happy to pass it on. Regards, Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk
RE: Date
What is the return Object for? Or have I mis-understood what the entity object passed in is? ( thought it is the EJB to populate or take data from) Sean -- Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk "Young, Wayne" To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Subject: RE: Date 23/05/2001 14:10 Please respond to struts-user Jim, We're following a pattern that I read about on the struts-dev list. http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg01340.html Here's a summary from our JSP/Struts standards document. Form Beans should be "String Beans" o The EJB tier will return beans and properties in the 'native' database type. o The Web tier will convert the 'model' bean to a 'view' bean for gathering & validating input. o The 'view' bean can have nested beans, collections, & arrays as long as the underlying type is String. o The 'view' bean will have formImport() & formExport methods o The 'view' bean formImport() method will have the following signature. public Object formImport( Object entity, HttpServletRequest request, ActionErrors errors) throws ServletException {} o The formImport() method can/will add to ActionErrors as necessary. o The 'view' bean formExport() method will have the following signature. public Object formExport( Object entity, HttpServletRequest request, ActionErrors errors) throws ServletException {} o The formExport() method can/will add to ActionErrors as necessary. o To populate the 'view' bean, the formImport() method should be called in the perform() method of the corresponding action class. (get action) o To populate the 'model' bean, the formExport() method should be called in the perform() method of the corresponding action class. (update action) o Actions/Forms that use the validate() method should execute a formExport () and add the errors to ActionErrors. o Forms should call the import() & export() methods on the nested beans. o If a bean property is ALWAYS "view-only", it may be part of the "view" bean as it's 'native' database type. Use for view-only properties. To support all of this, we extended org.apache.struts.util.ConvertUtils to convert Gregorian Calendars to Strings, and vice-versa while considering the locale & timezone. We use GregorianCalendars to represent dates and then convert them to a string in the timezone & display format for the user. We find this to be better than using java.util.Date. We're probably going to extend GregorianCalendar and add some kind of type attribute to represent whether it's a date, time, or datetime. We also have an extended version of that handles writes GregorianCalendars according to locale & timezone. The benefits... o Simple to implement. An easy pattern to follow. o The conversion logic is all in one place. Not scattered around a bunch of get/set methods. o The error handling works with Struts. o Nested beans are reusable. (this is good) o Results in an validating STRING interface that can work with different technologies. The drawbacks... o Extra 'view' beans... we may write a generator for these. o there will be a few more, I'm sure. Just my $0.02. Wayne [EMAIL PROTECTED] -Original Message- From: Jim Downing [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 7:06 AM To: [EMAIL PROTECTED] Subject: Date Hi all, I'm pretty new to struts. One of my forms needs to handle a Date attribute on the bean it represents, and I was wondering what the best solution for handling dates is - do you have to h
Tag to iterate a ResultSet
Hi, I've only recently started looking at struts and as part of my play want to produce an HTML table of a ResultSet. Are there any tags included to do this (I can't find anything) - or has anyone else done this? In the meantime I'll start writing my own I suppose. It will be agood learning experience... Regards, Sean - Dr Sean Radford, MBBS, MSc Senior Consultant Agora Professional Services Ltd [EMAIL PROTECTED] http://www.agora.co.uk