form in UTF-8 doesn't work with weblogic
Hi, I have a form that is supposed to accept Japanese text. I set enctype="utf-8" but my ActionForm is not getting any of these Japanese. I'm not sure if this is a problem of WebLogic that is not parsing the request stream with the right encoding or is it that I have to implement my own multipart request handler with the encoding set to utf-8. Thanks in advance, juan
MultiboxTag
Is there more documentation or examples on how to use the Multibox tag?? Thanks, juan
RE: file upload
Can I get at least a pointer to documentation about how to do this? thank you in advance, juan -Original Message- From: Juan Gargiulo [mailto:[EMAIL PROTECTED]] Sent: Friday, December 15, 2000 5:58 PM To: [EMAIL PROTECTED] Subject: file upload Hi, I'm trying to use the file upload features from struts. I know that this is suppose to be easy to use. But I keep receiving a null form in my perform method and I can't figure out the problem. JSP code: - form:form action="upload.do" name="uploadForm" method="POST" enctype="multipart/form-data" type="UploadForm" form:file property="file" / form:submit property="submit" value="Submit"/ /form:form UploadForm code: --- public final class UploadForm extends ActionForm { private FormFile file; public FormFile getFile() { return file;} public void setFile(FormFile file) {this.file = file;} } UploadAction:perform() code: public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { UploadForm fileForm = (UploadForm) form;== form is coming null FormFile file = fileForm.getFile(); . } Any help will be appreciated. juan
file upload
Hi, I'm trying to use the file upload features from struts. I know that this is suppose to be easy to use. But I keep receiving a null form in my perform method and I can't figure out the problem. JSP code: - form:form action="upload.do" name="uploadForm" method="POST" enctype="multipart/form-data" type="UploadForm" form:file property="file" / form:submit property="submit" value="Submit"/ /form:form UploadForm code: --- public final class UploadForm extends ActionForm { private FormFile file; public FormFile getFile() { return file;} public void setFile(FormFile file) {this.file = file;} } UploadAction:perform() code: public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { UploadForm fileForm = (UploadForm) form;== form is coming null FormFile file = fileForm.getFile(); . } Any help will be appreciated. juan
RE: org.apache.struts.action.MESSAGE exception with orion 1.4
I finally got it working by removing struts-config_1_0.dtd from the struts.jar file. And locating this file under: \WEB-INF\classes\org\apache\struts\resources\ Also, instead of placing the ApplicationResources.properties file under orion\lib, you can jar it and place it under \WEB-INF\lib hope this helps, juan -Original Message- From: MacGill [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 06, 2000 10:04 PM To: [EMAIL PROTECTED] Subject: Re: org.apache.struts.action.MESSAGE exception with orion 1.4 G'Day I am also working with Struts 1.0 and Orion 1.4 and having problems. The main thing that I have realised is that org.apache.struts.action.MESSAGE is the default web browser error for struts. To know what is going on in more detail I suggest studying orion\log\global-application.log So far I have over come some of the errors by placing struts.jar in orion\lib and the ApplicationResources.properties file in orion\lib under the directory set in struts-config.xml My current stumbling block in reading the struts-config_1_0.dtd I have tried all the suggestions on this mailing list but so far have had no success. MacGill Juan Gargiulo wrote: Did somebody found a work-around for the "Missing resources" problem in Orion 1.4? I tried several different potential solutions but none of them worked. I really need to get struts 1.0 working with Orion 1.4 ASAP. Thank you in advance, juan -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 21, 2000 9:53 AM To: [EMAIL PROTECTED] Subject: Re: org.apache.struts.action.MESSAGE exception with orion 1.4 "Douma, Ate" wrote: The two problems preventing the Struts example (build 20001120) to work on Orion (1.4.0) can be solved as follows: 1. javax.servlet.jsp.JspException: Missing resources attribute org.apache.struts.action.MESSAGE error The problem is caused by Orion not allowing access on resources (in this case a resourcebundle property file) in the WEB-INF/classes folder. It seems that the Servlet 2.2 spec. doesn't states clearly if this is allowed or not; the Orion team decided to not allow access. A simple solution is making the resources available through the (application its) classpath. By jarring the resources (e.g. the WEB-INF/classes folders) and putting this jar in the WEB-INF/lib folder the resources can be found. I would suggest the Stuts team to implement this solution for the struts example as Orion is probably not going to change its behavior in this. I would suggest instead that Orion fix their buggy classloader. This particular issue has nothing to do with the servlet specification -- Orion is not implementing the getResource() method of java.lang.ClassLoader, which is used by the ResourceBundle classes of the JDK, correctly. 2. java.net.MalformedURLException: unknown protocol: jndi The solution to this problem is given by Olli Pyry yesterday in the message with subject: Strugs Orion JNDI From: Olli Pöyry[SMTP:[EMAIL PROTECTED]] Sent: Tuesday, November 21, 2000 9:51:08 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject:Strugs Orion JNDI The following error that occurs in ActionServlet's startup with the newest Struts nightly build and Orion: register('-//Apache Software Foundation//DTD Struts Configuration 1.0//EN', 'jndi:/home/jblum/web/struts/WEB-INF/lib/struts.jar/org/apache/str uts/resour ces/struts-config_1_0.dtd' resolveEntity('-//Apache Software Foundation//DTD Struts Configuration 1.0//EN', 'http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd') Resolving to alternate DTD 'jndi:/home/jblum/web/struts/WEB-INF/lib/struts.jar/org/apache/str uts/resour ces/struts-config_1_0.dtd' seems be caused from the following line in ActionServlet.java (about line 881): URL url = this.getClass().getResource(registrations[i+1]); when this is replaced with: URL url = getServletContext().getResource(registrations[i+1]); the dtd is found and everything works. However you have to rebuild struts.jar - but that is easy ant. Hope this helps! Olli Pyry, Essaim Oy, Helsinki, Finland As this requires changing the source, I kindly request that the Struts development team could fix this also. This statement again depends on the container correctly implementing the class loader they are using for web applications. My understanding is that Struts has been working fine with previous versions of Orion. It sounds like they changed something in the latest code. If so, they should change it bac
Design question
Hi, I'm re-designing a web application that is mainly running with servlets/jsps/conn-pooling. I started using struts for prototypes, and I really like its architecture. The new design has to be robust and scalable because we expect considerable traffic. It is clear that the data tier should be implemented with entity beans, but I'm not sure yet about the web and business tier. One idea is to use struts (action classes+jsps+xml+xsl) to implement the web tier, and java beans and session EJBs for the business tier. But I have some questions for this architecture: 1. Is struts doing object pooling for action classes? (it's designed for high traffic?) If not, is there a way of doing this? 2. Is it right for action classes to use session EJBs as business beans? Is there any downside on this? 3. In the j2ee sample app. (the pet-store app.), Sun propose a design based on events and handlers for controlling the page flow. Is struts a valid replacement for this? 4. If combining struts with EJBs is fine, which is the best way of doing it? Thanks in advance for sharing your knowledge. Juan Gargiulo
RE: Design question
Craig, My understanding from what you responded me about ActionForm being EJBs was wrong, sorry about that. However, your explanation in the last email was extremely useful. Thanks, juan -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Friday, November 10, 2000 4:35 PM To: [EMAIL PROTECTED] Subject: Re: Design question Juan Gargiulo wrote: Craig, Thanks a lot for your answer. I think that I'm very close of defining the architecture for my application. Using action classes as adapters and session EJBs for business logic sounds good. Yep. Also using EJBs as actionforms is a good idea because they are a good target for object reuse. But it is not clear to me how do this. I don't see how struts is going to know how to get one of this EJB-actionforms from the context. How I specify the name of the home for the EJB-form to the action class (to the struts descriptor)? Actually, I do *not* believe it is a good idea to re-use an EJB as an ActionForm. In fact, this will be somewhat more difficult in 1.0, now that ActionForm is a class rather than an interface. The reasoning behind my belief goes like this: * An ActionForm is part of the view layer of MVC, not the model layer like an EJB (or a regular JavaBean that represents persistent data). * The sole purpose of an ActionForm is to maintain the state of all the input variables on a particular form, so that you can reproduce the form pre-filled-in if the user made an error that they need to fix. This matches the expectations of users who are used to GUI-based client server apps, that never make you retype any input except the stuff you did wrong. * Because of the above, the "domain" of an ActionForm does not necessarily match any existing EJBs or model layer JavaBeans. It is not uncommon to have inputs from a single form that will ultimately cause updates to more than one undelrying EJB or model bean. * Using a separate class for the ActionForm means you can change the underlying organization of your model beans or EJBs without impacting the view layer (although there might be modest impacts on the Action classes that copy things back and forth). * In addition, most EJBs and model beans have validation rules internally that prevent them from accepting semantically invalid data. Such rules would prevent you from accomplishing the primary purpose of an ActionForm -- storing all of the user's input fields, so that you can reproduce the input screen. * Also, if your form is multiple pages and you were using the real EJB, let's say you start updating properties based on receiving the first page. Now, you've potentially started locking resources in the underlying database -- and you have to deal with the fact that the user may never come back and finish this transaction. So, my bottom line recommendation is that you plan on building simple JavaBeans for your ActionForms. Most of the time, an ActionForm will have just getters and setters, with no error checking (other than a validate() method if you want to use it, plus the reset() method). PropertyUtils also has a convenience function that can copy properties with like names from your EJB to the ActionForm bean (or vice versa), to reduce the amount of tedious code that this approach implies. And, at some future point, it's reasonable to expect a development tool to be able to auto-generate ActionForm beans for you. Using an EJB as a bean that provides data values used in the presentation, on the other hand, is pretty easy. Just store the client-side instance you get back from the EJB server as a request attribute or session attribute -- from the perspective of the Struts custom tags, this EJB just looks like a JavaBean with getter methods, so they don't care that it is really an EJB. NOTE: If the EJBs are really on a remote server this could have some performance impact -- you might be better served to copy data into local beans in that case. Thanks, juan Craig