Re: Please help....Struts 1.0.2b and JDK 1.4.2
You asked exactly the same question only 24 hours ago. Patience is a virtue. ;-) Do you mean 1.0.2 beta? Wow, that's old! There is no reason that it shouldn't, but I haven't run anything that old for some time now. I would recommend upgrading to 1.1 anyway. :-) -- Martin Cooper Kramer, Brad [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Can anyone either confirm or deny if Struts 1.0.2b is compatible with JDK 1.4.2? Thanks a lot! _ Brad Kramer Pager - [EMAIL PROTECTED] _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: please help, using logic:iterate and html:form
Mike, What error are you getting -Sam. Mu Mike [EMAIL PROTECTED] wrote: Hi, all, last week, I spent a whole day trying to figure the below problem out, and you warmhearted guys just came and helped me,but to greatly disappiont you, I m still at a loss to know where the problem is ,so I decided to explain detailedly and completely of what I did and hope you nice buddies can help me find the problem goal: I want to submit an array of Fonbean(java class file listed below) to an action strategy: I decide to use html:form and logic:iterate to do this 1.what I have in my configruation xml type=com.mycom.form.TestBeanForm/ type=com.mycom.action.TestAction name=testBeanForm scope=session 2.TestBeanForm.java public class TestBeanForm extends ActionForm { public FontBean[] getTestBean() { if(testBean==null) { testBean=new FontBean[2]; testBean[0]=new FontBean(); testBean[1]=new FontBean(); } return testBean; } public void setTestBean(FontBean[] testBean) { this.testBean = testBean; } FontBean[] testBean; } 3. FontBean.java public class FontBean { public int getSize() { return size; } public void setSize(int size) { this.size = size; } public String getFontName() { return fontName; } public void setFontName(String fontName) { this.fontName = fontName; } private int size; private String fontName; } 4. my jsp file type=com.mycom.bean.propertybean.FontBean id=mybean indexId=index1 indexed=true/ /* I think when I submit, the testBeanForm will automatically fill its testBean's elements of their fontName attributes with font1 */ Submit Changes 5.my action class file public class TestAction extends Action { public ActionForward execute(ActionMapping actionMapping, ActionForm form, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception { System.out.println(stepped into action); TestBeanForm bform=(TestBeanForm)form; /*I stopped here to check if the form has its testBean variable filled with font1 of its fontName attribute, but it doesnt, the testBean of form is just the object I created in getTestBean(),that is, contains two elements, both the fontName attributes of the two elements are null */ return actionMapping.findForward(error); } } so what on earth is the problem? ThanksRegards Mike _ ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam
RE: PLEASE HELP!!!!
Thank you so much for your help. I started from scratch again this morning. I created a new project in Eclipse and imported my files one by one double checking the directory structure each time. I also was sure to include the message resources tag in the struts-config.xml file. This resolved my problem. Thanks again for your help and good -bye to that nasty error message :-) Shishir K. Singh [EMAIL PROTECTED] wrote: Can you pls post your full web.xml and struts-config.xml (I seem to have deleted your earlier posting). Also, can you list your directory structure with the list of files in them. Shishir -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 10:23 PM To: Struts Users Mailing List Subject: RE: PLEASE HELP First let me apologize if I seemed like I was shouting earlier. This obviously was my first time ever trying to use a messageboard. I did receive a few links to help me in posting future questions. Thanks for responding. However the solution you suggested did not work. Do you have any other suggestions on resolving this issue? Thanks again - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
RE: PLEASE HELP!!!!
I think you are missing this : !-- = Resource Settings -- message-resources parameter=resources.application null=false/ !-- -- Where resources is the directory within WEB-INF and application.properties is the properties file. You may put the null = true to get null value if there is a message missing. I personally prefer false as I can catch any errors that may not have been defined in the properties file Put this after the /action-mapping tag in struts-config.xml and see if it works. Shishir -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 7:10 PM To: [EMAIL PROTECTED] Subject: PLEASE HELP I am developing a new Struts Application. I have successfully been able to run the StrutsBlank example following the instructions from a tutorial on the web. However when I try to execute my own project I am getting the following error message in the browser: javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCont extImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex tImpl.java:800) org.apache.jsp.Login_jsp._jspService(Login_jsp.java:166) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Inside my JSP there are two lines of code which seem to be causing this problem they are: %@ taglib uri=/WEB-INF/lib/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/lib/struts-html.tld prefix=html % I am running Eclipse version 3.0 with a Tomcat Plugin version 5.0.16 and I using Struts version 1.1 My struts-config.xml is setup as the following: ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- Data Sources -- data-sources /data-sources !-- Form Beans -- form-beans form-bean name=LoginForm type=com.struts.rs.LoginActionForm/ form-bean name=DataActionForm type=com.struts.rs.DataActionForm/ /form-beans !-- Global Forwards -- global-forwards forward name=RSLogin path=/Login.jsp / forward name=OppLog path=/RSframe.jsp / forward name=EntryForm path=/entryForm.jsp / /global-forwards !-- Action Mappings -- action-mappings actionpath = /RSLogin type = com.struts.rs.LoginAction name = LoginForm scope = request validate = true input = /Login.jsp forward name=RSLogin path=/Login.jsp / /action !-- Action Mappings -- actionpath = /RSframe type = com.struts.rs.DataAction name = DataActionForm scope = request validate = false input = /RSframe.jsp forward name=RSframe path=/RSframe.jsp / /action action path = /entryForm type = com.struts.rs.EntryAction name = DataActionForm scope = session validate = false input = /entryForm.jsp forward name=entryForm path=/entryForm.jsp / /action /action-mappings /struts-config and my web-xml file looks like : ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app id=WebApp display-nameRS/display-name servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecom.struts.rs.resources.ApplicationResources/param-value /init-param init-param param-nameconfig/param-name param-valueWEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namedetail/param-name
RE: PLEASE HELP!!!!
If you want a proper answer give your message a proper subject. SHOUTING like that without even indicating what area you are having problems in is pretty much gauranteed to make most (not all luckily for you!) experienced list members ignore your mail. Please read: http://www.catb.org/~esr/faqs/smart-questions.html or to be specific about being specific... http://www.catb.org/~esr/faqs/smart-questions.html#bespecific -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Tuesday, 20 January 2004 08:10 To: [EMAIL PROTECTED] Subject: PLEASE HELP I am developing a new Struts Application. I have successfully been able to run the StrutsBlank example following the instructions from a tutorial on the web. However when I try to execute my own project I am getting the following error message in the browser: javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI mpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:800) org.apache.jsp.Login_jsp._jspService(Login_jsp.java:166) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 11) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Inside my JSP there are two lines of code which seem to be causing this problem they are: %@ taglib uri=/WEB-INF/lib/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/lib/struts-html.tld prefix=html % I am running Eclipse version 3.0 with a Tomcat Plugin version 5.0.16 and I using Struts version 1.1 My struts-config.xml is setup as the following: ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- Data Sources -- data-sources /data-sources !-- Form Beans -- form-beans form-bean name=LoginForm type=com.struts.rs.LoginActionForm/ form-bean name=DataActionForm type=com.struts.rs.DataActionForm/ /form-beans !-- Global Forwards -- global-forwards forward name=RSLogin path=/Login.jsp / forward name=OppLog path=/RSframe.jsp / forward name=EntryForm path=/entryForm.jsp / /global-forwards !-- Action Mappings -- action-mappings actionpath = /RSLogin type = com.struts.rs.LoginAction name = LoginForm scope = request validate = true input = /Login.jsp forward name=RSLogin path=/Login.jsp / /action !-- Action Mappings -- actionpath = /RSframe type = com.struts.rs.DataAction name = DataActionForm scope = request validate = false input = /RSframe.jsp forward name=RSframe path=/RSframe.jsp / /action action path = /entryForm type = com.struts.rs.EntryAction name = DataActionForm scope = session validate = false input = /entryForm.jsp forward name=entryForm path=/entryForm.jsp / /action /action-mappings /struts-config and my web-xml file looks like : ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app id=WebApp display-nameRS/display-name servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecom.struts.rs.resources.ApplicationResources/param-value /init-param init-param param-nameconfig/param-name param-valueWEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namedetail/param-name param-value2/param-value /init-param init-param param-namevalidate/param-name param-valuetrue/param-value /init-param load-on-startup2/load-on-startup /servlet servlet-mapping
RE: PLEASE HELP!!!!
First let me apologize if I seemed like I was shouting earlier. This obviously was my first time ever trying to use a messageboard. I did receive a few links to help me in posting future questions. Thanks for responding. However the solution you suggested did not work. Do you have any other suggestions on resolving this issue? Thanks again --- Shishir K. Singh [EMAIL PROTECTED] wrote: I think you are missing this : !-- = Resource Settings -- message-resources parameter=resources.application null=false/ !-- -- Where resources is the directory within WEB-INF and application.properties is the properties file. You may put the null = true to get null value if there is a message missing. I personally prefer false as I can catch any errors that may not have been defined in the properties file Put this after the /action-mapping tag in struts-config.xml and see if it works. Shishir -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 7:10 PM To: [EMAIL PROTECTED] Subject: PLEASE HELP I am developing a new Struts Application. I have successfully been able to run the StrutsBlank example following the instructions from a tutorial on the web. However when I try to execute my own project I am getting the following error message in the browser: javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCont extImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex tImpl.java:800) org.apache.jsp.Login_jsp._jspService(Login_jsp.java:166) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Inside my JSP there are two lines of code which seem to be causing this problem they are: %@ taglib uri=/WEB-INF/lib/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/lib/struts-html.tld prefix=html % I am running Eclipse version 3.0 with a Tomcat Plugin version 5.0.16 and I using Struts version 1.1 My struts-config.xml is setup as the following: ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- Data Sources -- data-sources /data-sources !-- Form Beans -- form-beans form-bean name=LoginForm type=com.struts.rs.LoginActionForm/ form-bean name=DataActionForm type=com.struts.rs.DataActionForm/ /form-beans !-- Global Forwards -- global-forwards forward name=RSLogin path=/Login.jsp / forward name=OppLog path=/RSframe.jsp / forward name=EntryForm path=/entryForm.jsp / /global-forwards !-- Action Mappings -- action-mappings actionpath = /RSLogin type = com.struts.rs.LoginAction name = LoginForm scope = request validate = true input = /Login.jsp forward name=RSLogin path=/Login.jsp / /action !-- Action Mappings -- actionpath = /RSframe type = com.struts.rs.DataAction name = DataActionForm scope = request validate = false input = /RSframe.jsp forward name=RSframe path=/RSframe.jsp / /action action path = /entryForm type = com.struts.rs.EntryAction name = DataActionForm scope = session validate = false input = /entryForm.jsp forward name=entryForm path=/entryForm.jsp / /action /action-mappings /struts-config and my web-xml file looks like : ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app id=WebApp display-nameRS/display-name servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name
RE: PLEASE HELP!!!!
Can you pls post your full web.xml and struts-config.xml (I seem to have deleted your earlier posting). Also, can you list your directory structure with the list of files in them. Shishir -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 10:23 PM To: Struts Users Mailing List Subject: RE: PLEASE HELP First let me apologize if I seemed like I was shouting earlier. This obviously was my first time ever trying to use a messageboard. I did receive a few links to help me in posting future questions. Thanks for responding. However the solution you suggested did not work. Do you have any other suggestions on resolving this issue? Thanks again - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PLEASE HELP!!!!
Hehe, dont let trolls like me scare you away from asking questions. ;-) The struts list is actually one of the friendliest and helpful mailing lists there is. Actually I think that this question comes up quite a bit on the list. Im not sure of the answer myself, but a search of the archives will probably turn up some helpful posts. The archives can be found at: http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=42 But Ive always found that one a pain to search, so Id suggest trying the copy at MARC: http://marc.theaimsgroup.com/?l=struts-userr=1w=2 hmmm. do you have a message-resources/ element entry in your struts-config.xml? Yours resources is in the package com.struts.rs.resources? (and I presume its in that directory structure under your WEB-INF/classes) What happens if you set message-resources parameter=com.struts.rs.resources.ApplicationResources/ in struts config? (This goes after the controller/ element in the struts config, which comes after the action-mappings/) -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Tuesday, 20 January 2004 11:23 To: Struts Users Mailing List Subject: RE: PLEASE HELP First let me apologize if I seemed like I was shouting earlier. This obviously was my first time ever trying to use a messageboard. I did receive a few links to help me in posting future questions. Thanks for responding. However the solution you suggested did not work. Do you have any other suggestions on resolving this issue? Thanks again --- Shishir K. Singh [EMAIL PROTECTED] wrote: I think you are missing this : !-- = Resource Settings -- message-resources parameter=resources.application null=false/ !-- -- Where resources is the directory within WEB-INF and application.properties is the properties file. You may put the null = true to get null value if there is a message missing. I personally prefer false as I can catch any errors that may not have been defined in the properties file Put this after the /action-mapping tag in struts-config.xml and see if it works. Shishir -Original Message- From: Anita Raeppel [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 7:10 PM To: [EMAIL PROTECTED] Subject: PLEASE HELP I am developing a new Struts Application. I have successfully been able to run the StrutsBlank example following the instructions from a tutorial on the web. However when I try to execute my own project I am getting the following error message in the browser: javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCont extImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex tImpl.java:800) org.apache.jsp.Login_jsp._jspService(Login_jsp.java:166) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Inside my JSP there are two lines of code which seem to be causing this problem they are: %@ taglib uri=/WEB-INF/lib/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/lib/struts-html.tld prefix=html % I am running Eclipse version 3.0 with a Tomcat Plugin version 5.0.16 and I using Struts version 1.1 My struts-config.xml is setup as the following: ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- Data Sources -- data-sources /data-sources !-- Form Beans -- form-beans form-bean name=LoginForm type=com.struts.rs.LoginActionForm/ form-bean name=DataActionForm type=com.struts.rs.DataActionForm/ /form-beans !-- Global Forwards -- global-forwards forward name=RSLogin path=/Login.jsp / forward name=OppLog path=/RSframe.jsp / forward name=EntryForm path=/entryForm.jsp / /global-forwards !-- Action Mappings -- action-mappings actionpath = /RSLogin type = com.struts.rs.LoginAction name = LoginForm scope = request validate = true input = /Login.jsp forward name=RSLogin path=/Login.jsp / /action !-- Action Mappings -- actionpath = /RSframe type = com.struts.rs.DataAction
RE: PLEASE HELP!!!!
your properties file should be called ApplicationResources.properties according to your config file. Heya Gosper CSC Australia 212 Northbourne Ave, Braddon ACT 2612 Ph: +61 (0) 2 6246 8155 Fax: +61 (0) 2 62468100 MOB: 0401 611779 This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.
RE: Please Help - ClassCastException
I've been responding to your questions here and at JavaRanch on this subject. It seems like you are missing the point of DynaActionForms. Please read 4.3 and 4.4 of the user guide. http://jakarta.apache.org/struts/userGuide/building_controller.html Lots of additional comments below. Comments below look for * -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 10:18 PM To: Struts Users Mailing List Subject: RE: Please Help - ClassCastException Allow me to ask three more questions: 1. If I want to reset some specific text fields when the JSP is re-displayed, do I code the PostForm.java like this (please confirm): code: - import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class PostForm extends DynaValidatorForm { public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset( mapping, request ); set( receiver, new String() ); set( sender, new String() ); } public PostForm () {} } *** Why not just use the intial attribute of the form-property element? --- 2. if I want to reset all the text fields when the JSP is re-displayed, do I code like this (please confirm): code: --- import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class PostForm extends DynaValidatorForm { public void reset(ActionMapping mapping, HttpServletRequest request) { initialize( mapping ); } public PostForm () {} } -- *** Why not just use the intial attribute of the form-property element? 3. What is the difference between code: --- form-bean name=postForm type=package.package.package.PostForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ /form-bean --- AND code: -- form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ /form-bean --- Thank you very much. *** The second one makes sense. Why do you need the PostForm class? see my answer to a similar question of yours at JavaRanch http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topicf=58t= 001820 Here is a snippet of some tutorial I am working on that might help. DynaActionForms are universally loved and hated. In teaching, consulting Struts and developing with Struts, I have found that DynaActionForms are either embraced or rejected. The idea behind DynaActionForms is that instead of creating an ActionForm per form, you instead configure an ActionForm per form. Advantages of DynaActionForms: Some folks feel creating an ActionForm class for each HTML form in your Struts application is time-consuming, causes maintenance problems, and is frustrating. With DynaActionForm classes you don't have to create an ActionForm subclass for each form and a bean property for each field. Instead you configure an DynaActionForm its properties, type, and defaults in the Struts configuration file. snip To configure a DynaActionForm in struts-config.xml, you use a form-bean element as with normal ActionForm. The type of the form bean must be org.apache.struts.action.DynaActionForm or a derived class. You then add form-property elements to declare the properties of the form. To use a DynaActionForm add the following to form-beans element (example): form-bean name=userRegistrationDynaForm type=org.apache.struts.action.DynaActionForm form-property name=userName type=java.lang.String / form-property name=email type=java.lang.String / form-property name=password type=java.lang.String / form-property name=passwordCheck type=java.lang.String / form-property name=firstName type=java.lang.String / form-property name=lastName type=java.lang.String / form-property name=phone type=java.lang.String initial=(520) / form-property name=fax type=java.lang.String / form-property name=page type
RE: Please Help - ClassCastException
I am still confused... I have a jsp that provides text fields for user to fill out information. All the information is passed via HttpRequest and to be validated. And all the properties in my PostForm are populated by the information retrieved from those text fields. And my PostForm is of type=org.apache.struts.validator.DynaValidatorForm Therefore, in my PostForm.java, I should do something like this? I just do not think the following code is correct. == import org.apache.struts.validator.DynaValidatorForm; public class PostForm extends DynaValidatorForm { private String receiver; private String sender; public void set(String receiver, String receiver); public void set(String sender, String sender); public String get(String receiver, String receiver); public String get(String sender, String sender); } == And you are saying that in my action class, I should ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostForm; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); ActionForm postForm = ( ActionForm )form; ThreadHandler thandler = new ThreadHandler(); ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); if (parentPostID == 0 ) // new topic { threadBean.setLastPostMemberName( memberName ); threadBean.setThreadCreationDate( now ); . . threadID = thandler.insertThread( threadBean ); } ... ... } } --- Joe Hertz [EMAIL PROTECTED] wrote: Well, first off: In your (dyna) form, you don't create setters and getters for the properties though. With DynaForms you would say set(myPropertyName, myString) instead of calling setMyPropertyName(myString). This is the Dyna part of DynaForms. It's much less tedious IMHO. In your action, you absolutely want to cast the form to PostForm. Otherwise the form variable has no way to know properties are associated with it. So yes, once you cast it to PostForm calls to BeanUtils.copyProperties() can and will work properly. Hope this helps, -Joe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 1:42 AM To: Struts Users Mailing List Subject: RE: Please Help - ClassCastException I think that there are a lot more mistakes in my code than I originally thought. The root of the problem is that I do not know how to use DynaValidatorForm. If you could help me in learning how to code when I am working with DynaValidatorForm. 1. in my struts-config.xml, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ . . /form-bean 2. My PostForm.java is like: import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; public class PostForm extends DynaValidatorForm { private String receiver; private String sender; .. public void setReceiver( String receiver ) { this.receiver = receiver; } public void setSender( String sender ) { this.sender = sender; } public String getReceiver() { return receiver; } public String getSender() { return sender; } . . } 3. in my action class (see the code below) 3.1. do I cast the form to DynaActionForm? or I should cast the form to DynaValidatorForm? 3.2. Can I use the copyProperties() method of the BeanUtils to convert the form to a bean? BeanUtils.copyProperties
RE: Please Help - ClassCastException
Not at all. First off, set(String, String) is predefined for you. You don't need to create any of that. In fact, what you will find in a DynaValidatorForm is that your form classes start to get very sparse. Here's really what it could look like. public class PostForm extends BaseDynaForm { public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { // throw new UnsupportedOperationException(Method is not implemented); } public PostForm () { } } In your ActionForm itself, beanUtils would work something like this. All you need is to get the right formBean object. public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PostForm pForm = (PostForm) form; // other code you write here BeanUtils.copyProperties(yourBean, pForm); // etc Doing it yourself without beanUtils? Instead of calling getSender() and having a String returned, you call get (sender) and it will return an Object (cast it yourself to whatever type the sender form property really is). I made a base form class with a getString method that calls get() and does the String cast for me to save the tediom. Making sense now? -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 2:46 AM To: Struts Users Mailing List Subject: RE: Please Help - ClassCastException I am still confused... I have a jsp that provides text fields for user to fill out information. All the information is passed via HttpRequest and to be validated. And all the properties in my PostForm are populated by the information retrieved from those text fields. And my PostForm is of type=org.apache.struts.validator.DynaValidatorForm Therefore, in my PostForm.java, I should do something like this? I just do not think the following code is correct. == import org.apache.struts.validator.DynaValidatorForm; public class PostForm extends DynaValidatorForm { private String receiver; private String sender; public void set(String receiver, String receiver); public void set(String sender, String sender); public String get(String receiver, String receiver); public String get(String sender, String sender); } == And you are saying that in my action class, I should ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostForm; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); ActionForm postForm = ( ActionForm )form; ThreadHandler thandler = new ThreadHandler(); ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); if (parentPostID == 0 ) // new topic { threadBean.setLastPostMemberName( memberName ); threadBean.setThreadCreationDate( now ); . . threadID = thandler.insertThread( threadBean ); } ... ... } } --- Joe Hertz [EMAIL PROTECTED] wrote: Well, first off: In your (dyna) form, you don't create setters and getters for the properties though. With DynaForms you would say set(myPropertyName, myString) instead of calling setMyPropertyName(myString). This is the Dyna part of DynaForms. It's much less tedious IMHO. In your action, you absolutely want to cast the form to PostForm. Otherwise the form variable has no way to know properties are associated with it. So yes, once you cast it to PostForm calls to BeanUtils.copyProperties() can and will work properly. Hope this helps, -Joe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 1:42 AM To: Struts Users Mailing List Subject: RE
Re: Please Help - ClassCastException
On 04/01/2004 05:04, Caroline Jen [EMAIL PROTECTED] wrote: Thank you for trying to help. I have added import org.apache.artimus.message.PostForm; to my action class. I do not fully follow what I should check in the struts-config.xml file. And should I use name=postForm with lowercase 'p' or uppercase 'P'? In my struts-config.xml file, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm Here is the problem. Replace org.apache.struts.validator.DynaValidatorForm for org.apache.artimus.message.PostForm That should work Pedro Salgado form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ form-property name=title type=java.lang.String/ form-property name=postTopic type=java.lang.String/ form-property name=postBody type=java.lang.String/ /form-bean and action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Do you see any problems? --- Pedro Salgado [EMAIL PROTECTED] wrote: On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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] __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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: Please Help - ClassCastException
This passage is straight from the struts javadoc The key passed into the validator is the action element's 'name' attribute from the struts-config.xml which should match the form element's name attribute in the validation.xml Take a peek at how to configure struts-config.xml at http://www.reumann.net/do/struts/lesson3/step4 which details the form bean name type (with the fully qualified package name) and the column form-property Keep me apprised, Martin - Original Message - From: Pedro Salgado [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, December 31, 1969 7:05 PM Subject: Re: Please Help - ClassCastException On 04/01/2004 05:04, Caroline Jen [EMAIL PROTECTED] wrote: Thank you for trying to help. I have added import org.apache.artimus.message.PostForm; to my action class. I do not fully follow what I should check in the struts-config.xml file. And should I use name=postForm with lowercase 'p' or uppercase 'P'? In my struts-config.xml file, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm Here is the problem. Replace org.apache.struts.validator.DynaValidatorForm for org.apache.artimus.message.PostForm That should work Pedro Salgado form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ form-property name=title type=java.lang.String/ form-property name=postTopic type=java.lang.String/ form-property name=postBody type=java.lang.String/ /form-bean and action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Do you see any problems? --- Pedro Salgado [EMAIL PROTECTED] wrote: On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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] __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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
RE: Please Help - ClassCastException
Allow me to ask three more questions: 1. If I want to reset some specific text fields when the JSP is re-displayed, do I code the PostForm.java like this (please confirm): code: - import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class PostForm extends DynaValidatorForm { public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset( mapping, request ); set( receiver, new String() ); set( sender, new String() ); } public PostForm () {} } --- 2. if I want to reset all the text fields when the JSP is re-displayed, do I code like this (please confirm): code: --- import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class PostForm extends DynaValidatorForm { public void reset(ActionMapping mapping, HttpServletRequest request) { initialize( mapping ); } public PostForm () {} } -- 3. What is the difference between code: --- form-bean name=postForm type=package.package.package.PostForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ /form-bean --- AND code: -- form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ /form-bean --- Thank you very much. --- Joe Hertz [EMAIL PROTECTED] wrote: Not at all. First off, set(String, String) is predefined for you. You don't need to create any of that. In fact, what you will find in a DynaValidatorForm is that your form classes start to get very sparse. Here's really what it could look like. public class PostForm extends BaseDynaForm { public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { // throw new UnsupportedOperationException(Method is not implemented); } public PostForm () { } } In your ActionForm itself, beanUtils would work something like this. All you need is to get the right formBean object. public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PostForm pForm = (PostForm) form; // other code you write here BeanUtils.copyProperties(yourBean, pForm); // etc Doing it yourself without beanUtils? Instead of calling getSender() and having a String returned, you call get (sender) and it will return an Object (cast it yourself to whatever type the sender form property really is). I made a base form class with a getString method that calls get() and does the String cast for me to save the tediom. Making sense now? -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 2:46 AM To: Struts Users Mailing List Subject: RE: Please Help - ClassCastException I am still confused... I have a jsp that provides text fields for user to fill out information. All the information is passed via HttpRequest and to be validated. And all the properties in my PostForm are populated by the information retrieved from those text fields. And my PostForm is of type=org.apache.struts.validator.DynaValidatorForm Therefore, in my PostForm.java, I should do something like this? I just do not think the following code is correct. == import org.apache.struts.validator.DynaValidatorForm; public class PostForm extends DynaValidatorForm { private String receiver; private String sender; public void set(String receiver, String receiver); public void set(String sender, String sender); public String get(String receiver, String receiver); public String get(String sender, String sender); } == And you are saying that in my action class, I should ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import
Re: Please Help - ClassCastException
On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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: Please Help - ClassCastException
Thank you for trying to help. I have added import org.apache.artimus.message.PostForm; to my action class. I do not fully follow what I should check in the struts-config.xml file. And should I use name=postForm with lowercase 'p' or uppercase 'P'? In my struts-config.xml file, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ form-property name=title type=java.lang.String/ form-property name=postTopic type=java.lang.String/ form-property name=postBody type=java.lang.String/ /form-bean and action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Do you see any problems? --- Pedro Salgado [EMAIL PROTECTED] wrote: On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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] __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Please Help - ClassCastException
Here is what I see (opinions vary)... I see you are defining your form bean in your struts-config.xml as type 'org.apache.struts.validator.DynaValidatorForm'. So, why are you trying to cast it as this 'org.apache.artimus.message.PostForm' class. Does that class extend DynaValidatorForm? If it doesn't, you'll get a ClassCastException like you're getting now. Personally, I expected you to cast it as: DynaValidatorForm postForm = (DynaValidatorForm) form; Or us it as-initially defined (not casting like above) and use BeanUtils such as: String receiver = (String) PropertyUtils.getSimpleProperty(form, receiver); Regards, David -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 11:04 PM To: Struts Users Mailing List Subject: Re: Please Help - ClassCastException Thank you for trying to help. I have added import org.apache.artimus.message.PostForm; to my action class. I do not fully follow what I should check in the struts-config.xml file. And should I use name=postForm with lowercase 'p' or uppercase 'P'? In my struts-config.xml file, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ form-property name=title type=java.lang.String/ form-property name=postTopic type=java.lang.String/ form-property name=postBody type=java.lang.String/ /form-bean and action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Do you see any problems? --- Pedro Salgado [EMAIL PROTECTED] wrote: On your struts config file check if the form bean for StoreMessage action is of type pkg.pkg.PostForm and if the action name is pointing to the correct form bean... It also seems to be missing the import of the PostForm on your action class. Pedro Salgado On 04/01/2004 03:22, Caroline Jen [EMAIL PROTECTED] wrote: The statement shown below encountered a ClassCastException: PostForm postForm = ( PostForm )form; I cannot figure out the reason. Please help. Allow me to show more code of the class where the exception occurred: ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; int postID; String postCreationIP; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); PostForm postForm = ( PostForm )form; } } __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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] __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - 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: Please Help - ClassCastException
I think that there are a lot more mistakes in my code than I originally thought. The root of the problem is that I do not know how to use DynaValidatorForm. If you could help me in learning how to code when I am working with DynaValidatorForm. 1. in my struts-config.xml, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ . . /form-bean 2. My PostForm.java is like: import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; public class PostForm extends DynaValidatorForm { private String receiver; private String sender; .. public void setReceiver( String receiver ) { this.receiver = receiver; } public void setSender( String sender ) { this.sender = sender; } public String getReceiver() { return receiver; } public String getSender() { return sender; } . . } 3. in my action class (see the code below) 3.1. do I cast the form to DynaActionForm? or I should cast the form to DynaValidatorForm? 3.2. Can I use the copyProperties() method of the BeanUtils to convert the form to a bean? BeanUtils.copyProperties( threadBean, postForm ); ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.DynaActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostForm; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); DynaActionForm postForm = ( DynaActionForm )form; ThreadHandler thandler = new ThreadHandler(); ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); if (parentPostID == 0 ) // new topic { threadBean.setLastPostMemberName( memberName ); threadBean.setThreadCreationDate( now ); . . threadID = thandler.insertThread( threadBean ); } ... ... } } 4. the action mapping in my struts-config.xml is like: action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Thank you. --- David Friedman [EMAIL PROTECTED] wrote: Here is what I see (opinions vary)... I see you are defining your form bean in your struts-config.xml as type 'org.apache.struts.validator.DynaValidatorForm'. So, why are you trying to cast it as this 'org.apache.artimus.message.PostForm' class. Does that class extend DynaValidatorForm? If it doesn't, you'll get a ClassCastException like you're getting now. Personally, I expected you to cast it as: DynaValidatorForm postForm = (DynaValidatorForm) form; Or us it as-initially defined (not casting like above) and use BeanUtils such as: String receiver = (String) PropertyUtils.getSimpleProperty(form, receiver); Regards, David -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 11:04 PM To: Struts Users Mailing List Subject: Re: Please Help - ClassCastException Thank you for trying to help. I have added import org.apache.artimus.message.PostForm; to my action class. I do not fully follow what I should check in the struts-config.xml file. And should I use name=postForm with lowercase 'p' or uppercase 'P'? In my struts-config.xml file, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ form-property name
RE: Please Help - ClassCastException
Well, first off: In your (dyna) form, you don't create setters and getters for the properties though. With DynaForms you would say set(myPropertyName, myString) instead of calling setMyPropertyName(myString). This is the Dyna part of DynaForms. It's much less tedious IMHO. In your action, you absolutely want to cast the form to PostForm. Otherwise the form variable has no way to know properties are associated with it. So yes, once you cast it to PostForm calls to BeanUtils.copyProperties() can and will work properly. Hope this helps, -Joe -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 1:42 AM To: Struts Users Mailing List Subject: RE: Please Help - ClassCastException I think that there are a lot more mistakes in my code than I originally thought. The root of the problem is that I do not know how to use DynaValidatorForm. If you could help me in learning how to code when I am working with DynaValidatorForm. 1. in my struts-config.xml, I have: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ . . /form-bean 2. My PostForm.java is like: import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; public class PostForm extends DynaValidatorForm { private String receiver; private String sender; .. public void setReceiver( String receiver ) { this.receiver = receiver; } public void setSender( String sender ) { this.sender = sender; } public String getReceiver() { return receiver; } public String getSender() { return sender; } . . } 3. in my action class (see the code below) 3.1. do I cast the form to DynaActionForm? or I should cast the form to DynaValidatorForm? 3.2. Can I use the copyProperties() method of the BeanUtils to convert the form to a bean? BeanUtils.copyProperties( threadBean, postForm ); ... import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.DynaActionForm; import org.apache.commons.beanutils.BeanUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.artimus.message.PostForm; import org.apache.artimus.message.PostBean; import org.apache.artimus.message.ThreadBean; import org.apache.artimus.message.utility.DateUtil; public final class StoreMessage extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int parentPostID; int threadID; String memberName = request.getRemoteUser(); Timestamp now = DateUtil.getCurrentGMTTimestamp(); parentPostID = Integer.parseInt( request.getParameter( parent ) ); DynaActionForm postForm = ( DynaActionForm )form; ThreadHandler thandler = new ThreadHandler(); ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); if (parentPostID == 0 ) // new topic { threadBean.setLastPostMemberName( memberName ); threadBean.setThreadCreationDate( now ); . . threadID = thandler.insertThread( threadBean ); } ... ... } } 4. the action mapping in my struts-config.xml is like: action roles=administrator,editor,contributor path=/message/NewTopic type=org.apache.artimus.message.StoreMessage name=postForm scope=request validate=true input=.message.Form forward name=success path=.article.View/ /action Thank you. --- David Friedman [EMAIL PROTECTED] wrote: Here is what I see (opinions vary)... I see you are defining your form bean in your struts-config.xml as type 'org.apache.struts.validator.DynaValidatorForm'. So, why are you trying to cast it as this 'org.apache.artimus.message.PostForm' class. Does that class extend DynaValidatorForm? If it doesn't, you'll get a ClassCastException like you're getting now. Personally, I expected you to cast it as: DynaValidatorForm postForm = (DynaValidatorForm) form; Or us it as-initially defined (not casting like above) and use BeanUtils
RE: Please Help With This Error Message
Your statement is OK. It comes from the surrounding quote. The only idea I have is to check double-quotes correctly. Fred -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: mercredi 17 décembre 2003 07:41 To: [EMAIL PROTECTED] Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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: Please Help With This Error Message
maybe you don't have a space character between creator and scope... try to write the tag in one line, not multiple lines. F. - Original Message - From: fredatwork [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:53 AM Subject: RE: Please Help With This Error Message Your statement is OK. It comes from the surrounding quote. The only idea I have is to check double-quotes correctly. Fred -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: mercredi 17 décembre 2003 07:41 To: [EMAIL PROTECTED] Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help With This Error Message
Hi, I tried and tried. I cannot figure out the error. I need your sharp eyes and experience. I keep getting this error message in the browser: ServletException in:/article/content/postForm.jsp] /article/content/postForm.jsp(32,67) equal symbol expected' This postForm.jsp had worked find before I inserted: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=bean:write name=author/ size=82 maxlength=25 tabindex=1/ And the error message points at the bean:define ... tag. The statements are in ONE line (they do not wrapped around) in my file. cr is passed to the postForm.jsp in a session object this way: c:set var=cr value=${articleForm.creator} scope=session/ Thanks a lot. -C --- Firat TIRYAKI [EMAIL PROTECTED] wrote: maybe you don't have a space character between creator and scope... try to write the tag in one line, not multiple lines. F. - Original Message - From: fredatwork [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:53 AM Subject: RE: Please Help With This Error Message Your statement is OK. It comes from the surrounding quote. The only idea I have is to check double-quotes correctly. Fred -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: mercredi 17 décembre 2003 07:41 To: [EMAIL PROTECTED] Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Please Help With This Error Message
C, You can't nest tags as you did in the value attribute. bean:define ... value=bean:write name=author/ / The rest of the list will croak when I recommend that you use %= author % instead of bean:write name=author/ Maybe they can tell you a fancy -el/JSTL way to do it. :) B -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 4:46 PM To: Struts Users Mailing List Subject: Re: Please Help With This Error Message Hi, I tried and tried. I cannot figure out the error. I need your sharp eyes and experience. I keep getting this error message in the browser: ServletException in:/article/content/postForm.jsp] /article/content/postForm.jsp(32,67) equal symbol expected' This postForm.jsp had worked find before I inserted: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=bean:write name=author/ size=82 maxlength=25 tabindex=1/ And the error message points at the bean:define ... tag. The statements are in ONE line (they do not wrapped around) in my file. cr is passed to the postForm.jsp in a session object this way: c:set var=cr value=${articleForm.creator} scope=session/ Thanks a lot. -C --- Firat TIRYAKI [EMAIL PROTECTED] wrote: maybe you don't have a space character between creator and scope... try to write the tag in one line, not multiple lines. F. - Original Message - From: fredatwork [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:53 AM Subject: RE: Please Help With This Error Message Your statement is OK. It comes from the surrounding quote. The only idea I have is to check double-quotes correctly. Fred -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: mercredi 17 décembre 2003 07:41 To: [EMAIL PROTECTED] Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - 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: Please Help With This Error Message
Maybe they can tell you a fancy -el/JSTL way to do it. :) yes, if you use html-el:text instead then you should be able to use an el expression a'la: html-el:text property=creator value=${author}/ size=82 maxlength=25 tabindex=1/ you'll need something like this at the top of your jsp %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % Heya Gosper CSC Australia 212 Northbourne Ave, Braddon ACT 2612 Ph: +61 (0) 2 6246 8155 Fax: +61 (0) 2 62468100 MOB: 0401 611779 This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. Barett McGavock [EMAIL PROTECTED] 18/12/2003 10:58 AM Please respond to Struts Users Mailing List To: 'Struts Users Mailing List' [EMAIL PROTECTED] cc: 'Caroline Jen' [EMAIL PROTECTED] Subject:RE: Please Help With This Error Message C, You can't nest tags as you did in the value attribute. bean:define ... value=bean:write name=author/ / The rest of the list will croak when I recommend that you use %= author % instead of bean:write name=author/ Maybe they can tell you a fancy -el/JSTL way to do it. :) B -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 4:46 PM To: Struts Users Mailing List Subject: Re: Please Help With This Error Message Hi, I tried and tried. I cannot figure out the error. I need your sharp eyes and experience. I keep getting this error message in the browser: ServletException in:/article/content/postForm.jsp] /article/content/postForm.jsp(32,67) equal symbol expected' This postForm.jsp had worked find before I inserted: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=bean:write name=author/ size=82 maxlength=25 tabindex=1/ And the error message points at the bean:define ... tag. The statements are in ONE line (they do not wrapped around) in my file. cr is passed to the postForm.jsp in a session object this way: c:set var=cr value=${articleForm.creator} scope=session/ Thanks a lot. -C --- Firat TIRYAKI [EMAIL PROTECTED] wrote: maybe you don't have a space character between creator and scope... try to write the tag in one line, not multiple lines. F. - Original Message - From: fredatwork [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:53 AM Subject: RE: Please Help With This Error Message Your statement is OK. It comes from the surrounding quote. The only idea I have is to check double-quotes correctly. Fred -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: mercredi 17 décembre 2003 07:41 To: [EMAIL PROTECTED] Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - 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: Please Help With This Error Message
Sorry, shouldn't have copy/pasted. I meant html-el:text property=creator value=${author} size=82 maxlength=25 tabindex=1/ Heya Gosper CSC Australia 212 Northbourne Ave, Braddon ACT 2612 Ph: +61 (0) 2 6246 8155 Fax: +61 (0) 2 62468100 MOB: 0401 611779 This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. [EMAIL PROTECTED] 18/12/2003 01:05 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List [EMAIL PROTECTED] cc: Subject:RE: Please Help With This Error Message Maybe they can tell you a fancy -el/JSTL way to do it. :) yes, if you use html-el:text instead then you should be able to use an el expression a'la: html-el:text property=creator value=${author}/ size=82 maxlength=25 tabindex=1/ you'll need something like this at the top of your jsp %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % Heya Gosper CSC Australia 212 Northbourne Ave, Braddon ACT 2612 Ph: +61 (0) 2 6246 8155 Fax: +61 (0) 2 62468100 MOB: 0401 611779 This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. Barett McGavock [EMAIL PROTECTED] 18/12/2003 10:58 AM Please respond to Struts Users Mailing List To: 'Struts Users Mailing List' [EMAIL PROTECTED] cc: 'Caroline Jen' [EMAIL PROTECTED] Subject:RE: Please Help With This Error Message C, You can't nest tags as you did in the value attribute. bean:define ... value=bean:write name=author/ / The rest of the list will croak when I recommend that you use %= author % instead of bean:write name=author/ Maybe they can tell you a fancy -el/JSTL way to do it. :) B -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 4:46 PM To: Struts Users Mailing List Subject: Re: Please Help With This Error Message Hi, I tried and tried. I cannot figure out the error. I need your sharp eyes and experience. I keep getting this error message in the browser: ServletException in:/article/content/postForm.jsp] /article/content/postForm.jsp(32,67) equal symbol expected' This postForm.jsp had worked find before I inserted: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=bean:write name=author/ size=82 maxlength=25 tabindex=1/ And the error message points at the bean:define ... tag. The statements are in ONE line (they do not wrapped around) in my file. cr is passed to the postForm.jsp in a session object this way: c:set var=cr value=${articleForm.creator} scope=session/ Thanks a lot. -C --- Firat TIRYAKI [EMAIL PROTECTED] wrote: maybe you don't have a space character between creator and scope... try to write the tag in one line, not multiple lines. F. - Original Message - From: fredatwork [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:53 AM Subject: RE: Please Help With This Error Message Your statement is OK. It comes from the surrounding quote. The only idea I have is to check double-quotes correctly. Fred -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: mercredi 17 décembre 2003 07:41 To: [EMAIL PROTECTED] Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Please Help With This Error Message
hi Caroline According to me this is perfectly fine. Please see there may be something worng in your JSP Regards Gary - Original Message - From: Caroline Jen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 12:11 PM Subject: Please Help With This Error Message Please help me to figure out this error message that I got in the browser: equal symbol expected. The error complains about this statement in my JSP: bean:define id=author name=creator scope=session type=java.lang.String/ and the above statement is intended to retrieve the string creator from a session object. __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction
Hi Caroline, have you checked the source of the HTML page in the browser to see what the value of username is, client-side? I expect the value is being sent to the browser as null. If that is the case, it is because request.getRemoteUser() is returning null and that would be because you don't have or are losing your login session. Adam On 12/08/2003 10:32 PM Caroline Jen wrote: I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen [EMAIL PROTECTED] wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Rats, the thread broke, hence my other reply. Like everyone says, you need to check the return value of getRemoteUser() - try looking at the value of the hidden field in the HTML via IE's 'Show page source'. On 12/08/2003 11:55 PM Caroline Jen wrote: I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen [EMAIL PROTECTED] wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData
Re: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
On 09/12/2003 01:29 Caroline Jen wrote: I use container-managed authentication. In which case, why don't you get the user name using request.getUserPrincipal().getName() ? -- Paul Thomas +--+-+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +--+-+ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Hi, I think that we are in different time zones. As you have mentioned, I, too, suspected that the statement in my JSP: request.getRemoteUser(); returns nothing. Therefore, I did a test in my JSP. In addition to request.getRemoteUser(); I created another String manually: req:isUserInRole role=editor % String username = request.getRemoteUser(); String userrole = author; % % out.println(The user name is: + username +.); % % out.println(The role is: + userrole +.); % /req:isUserInRole And the browser shows: The user name is: Gloria Jen. The role is: author. Gloria Jen is the name that I provided while logging on and authenticated by the container. Therefore, the request.getRemoteUser(); does not return a null. And I hope that it means I am not passing a null value when I use the hidden field technique. Then, I pass two hidden fields (with value in them) from my JSP to a Java class (FindEditorData.java), which is of scaffold.ProcessAction type. One of the field is passed with its value correctly retrieved. The other field is passed with its value found to be null. What could go wrong? I have been thinking about it for days and so do those who try to help me. req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); String userrole = author; % %out.println(The user name is: + username +.);% %out.println(The role is: + userrole +.);% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole -Caroline --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If you are doing it yourself (ie. through a db lookup) then the server doesn't know about the user being authenticated and will return null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 2:56 PM To: Struts Users Mailing List Subject: RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, In your FindEditorData.java class, is the value for your username variable null or null? If it is null, then you are reading the wrong request parameter since request.getParameter() will return null if the parameter doesn't exist. If the String value is null, then you have a problem with getRemoteUser() Why don't you dump request parameters that you are getting in your FindEditorData? Hidden input tags work fine. Regards, Richard --- Caroline Jen [EMAIL PROTECTED] wrote: Hi, I think that we are in different time zones. As you have mentioned, I, too, suspected that the statement in my JSP: request.getRemoteUser(); returns nothing. Therefore, I did a test in my JSP. In addition to request.getRemoteUser(); I created another String manually: req:isUserInRole role=editor % String username = request.getRemoteUser(); String userrole = author; % % out.println(The user name is: + username +.); % % out.println(The role is: + userrole +.); % /req:isUserInRole And the browser shows: The user name is: Gloria Jen. The role is: author. Gloria Jen is the name that I provided while logging on and authenticated by the container. Therefore, the request.getRemoteUser(); does not return a null. And I hope that it means I am not passing a null value when I use the hidden field technique. Then, I pass two hidden fields (with value in them) from my JSP to a Java class (FindEditorData.java), which is of scaffold.ProcessAction type. One of the field is passed with its value correctly retrieved. The other field is passed with its value found to be null. What could go wrong? I have been thinking about it for days and so do those who try to help me. req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); String userrole = author; % %out.println(The user name is: + username +.);% %out.println(The role is: + userrole +.);% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole -Caroline --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If you are doing it yourself (ie. through a db lookup) then the server doesn't know about the user being authenticated and will return null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 2:56 PM To: Struts Users Mailing List Subject: RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
I do not fully understand what you say about null or null. Anyway, I did try to write out values in the FindEditorData.java. What is written out in the browser is: name=null; kn=journal_category; kv=null And the way I try to write out those crucial fields is shown below: // package and import statements omitted public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, In your FindEditorData.java class, is the value for your username variable null or null? If it is null, then you are reading the wrong request parameter since request.getParameter() will return null if the parameter doesn't exist. If the String value is null, then you have a problem with getRemoteUser() Why don't you dump request parameters that you are getting in your FindEditorData? Hidden input tags work fine. Regards, Richard --- Caroline Jen [EMAIL PROTECTED] wrote: Hi, I think that we are in different time zones. As you have mentioned, I, too, suspected that the statement in my JSP: request.getRemoteUser(); returns nothing. Therefore, I did a test in my JSP. In addition to request.getRemoteUser(); I created another String manually: req:isUserInRole role=editor % String username = request.getRemoteUser(); String userrole = author; % % out.println(The user name is: + username +.); % % out.println(The role is: + userrole +.); % /req:isUserInRole And the browser shows: The user name is: Gloria Jen. The role is: author. Gloria Jen is the name that I provided while logging on and authenticated by the container. Therefore, the request.getRemoteUser(); does not return a null. And I hope that it means I am not passing a null value when I use the hidden field technique. Then, I pass two hidden fields (with value in them) from my JSP to a Java class (FindEditorData.java), which is of scaffold.ProcessAction type. One of the field is passed with its value correctly retrieved. The other field is passed with its value found to be null. What could go wrong? I have been thinking about it for days and so do those who try to help me. req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); String userrole = author; % %out.println(The user name is: + username +.);% %out.println(The role is: + userrole +.);% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole -Caroline --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If you are doing it yourself (ie. through a db lookup) then the server doesn't know about the user being authenticated and will return null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 2:56 PM To: Struts Users Mailing List Subject: RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, As a sanity check, in your bean, initialize the username variable to something ie. XX. and re-run your app. This will show if your setUsername is ever called. -Richard --- Caroline Jen [EMAIL PROTECTED] wrote: I do not fully understand what you say about null or null. Anyway, I did try to write out values in the FindEditorData.java. What is written out in the browser is: name=null; kn=journal_category; kv=null And the way I try to write out those crucial fields is shown below: // package and import statements omitted public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, In your FindEditorData.java class, is the value for your username variable null or null? If it is null, then you are reading the wrong request parameter since request.getParameter() will return null if the parameter doesn't exist. If the String value is null, then you have a problem with getRemoteUser() Why don't you dump request parameters that you are getting in your FindEditorData? Hidden input tags work fine. Regards, Richard --- Caroline Jen [EMAIL PROTECTED] wrote: Hi, I think that we are in different time zones. As you have mentioned, I, too, suspected that the statement in my JSP: request.getRemoteUser(); returns nothing. Therefore, I did a test in my JSP. In addition to request.getRemoteUser(); I created another String manually: req:isUserInRole role=editor % String username = request.getRemoteUser(); String userrole = author; % % out.println(The user name is: + username +.); % % out.println(The role is: + userrole +.); % /req:isUserInRole And the browser shows: The user name is: Gloria Jen. The role is: author. Gloria Jen is the name that I provided while logging on and authenticated by the container. Therefore, the request.getRemoteUser(); does not return a null. And I hope that it means I am not passing a null value when I use the hidden field technique. Then, I pass two hidden fields (with value in them) from my JSP to a Java class (FindEditorData.java), which is of scaffold.ProcessAction type. One of the field is passed with its value correctly retrieved. The other field is passed with its value found to be null. What could go wrong? I have been thinking about it for days and so do those who try to help me. req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); String userrole = author; % %out.println(The user name is: + username +.);% %out.println(The role is: + userrole +.);% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole -Caroline --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
I followed your advice. In the Bean.java, I did the following: private String username = natalie; public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } and I compiled all the relevant classes, re-run the application, the FindEditorData.java writes out the following in the browser: The process did not complete. Details should follow. name=natalie; kn=journal_category; kv=null Now, the question is why the Bean.java does not pick up the value of the hidden field 'username' from my JSP while successfully picks up the value of the other hidden field 'keyName'. There is some data processing activities going on in the FindEditorData.java: String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); The above data accessing codes had been tested outside the environment of the application (the codes did what I expected them to do without problem) before they were integrated into the application. -Caroline --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, As a sanity check, in your bean, initialize the username variable to something ie. XX. and re-run your app. This will show if your setUsername is ever called. -Richard --- Caroline Jen [EMAIL PROTECTED] wrote: I do not fully understand what you say about null or null. Anyway, I did try to write out values in the FindEditorData.java. What is written out in the browser is: name=null; kn=journal_category; kv=null And the way I try to write out those crucial fields is shown below: // package and import statements omitted public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, In your FindEditorData.java class, is the value for your username variable null or null? If it is null, then you are reading the wrong request parameter since request.getParameter() will return null if the parameter doesn't exist. If the String value is null, then you have a problem with getRemoteUser() Why don't you dump request parameters that you are getting in your FindEditorData? Hidden input tags work fine. Regards, Richard --- Caroline Jen [EMAIL PROTECTED] wrote: Hi, I think that we are in different time zones. As you have mentioned, I, too, suspected that the statement in my JSP: request.getRemoteUser(); returns nothing. Therefore, I did a test in my JSP. In addition to request.getRemoteUser(); I created another String manually: req:isUserInRole role=editor % String username = request.getRemoteUser(); String userrole = author; % % out.println(The user name is: + username +.); % % out.println(The role is: + userrole +.); % /req:isUserInRole And the browser shows: The user name is: Gloria Jen. The role is: author. Gloria Jen is the name that I provided while logging on and authenticated by the container. Therefore, the request.getRemoteUser(); does not return a null. And I hope that it means I am not passing a null value when I use the hidden field technique. Then, I pass two hidden fields (with value in them) from my JSP to a Java class (FindEditorData.java), which is of scaffold.ProcessAction type. One of the field is passed with its value correctly retrieved. The other field is passed with its value found to be null. What could go wrong? I have been thinking about it for days and so do those who try to help me. req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); String userrole = author; % %out.println(The user
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
I did another test. I took out those data access activities in the FindEditorData.java and ran the application. The conclusion is that those few lines of data access activities have nothing to do with the value of the 'username' becoming null in the FindEditorData.java. -Caroline --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, As a sanity check, in your bean, initialize the username variable to something ie. XX. and re-run your app. This will show if your setUsername is ever called. -Richard --- Caroline Jen [EMAIL PROTECTED] wrote: I do not fully understand what you say about null or null. Anyway, I did try to write out values in the FindEditorData.java. What is written out in the browser is: name=null; kn=journal_category; kv=null And the way I try to write out those crucial fields is shown below: // package and import statements omitted public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, In your FindEditorData.java class, is the value for your username variable null or null? If it is null, then you are reading the wrong request parameter since request.getParameter() will return null if the parameter doesn't exist. If the String value is null, then you have a problem with getRemoteUser() Why don't you dump request parameters that you are getting in your FindEditorData? Hidden input tags work fine. Regards, Richard --- Caroline Jen [EMAIL PROTECTED] wrote: Hi, I think that we are in different time zones. As you have mentioned, I, too, suspected that the statement in my JSP: request.getRemoteUser(); returns nothing. Therefore, I did a test in my JSP. In addition to request.getRemoteUser(); I created another String manually: req:isUserInRole role=editor % String username = request.getRemoteUser(); String userrole = author; % % out.println(The user name is: + username +.); % % out.println(The role is: + userrole +.); % /req:isUserInRole And the browser shows: The user name is: Gloria Jen. The role is: author. Gloria Jen is the name that I provided while logging on and authenticated by the container. Therefore, the request.getRemoteUser(); does not return a null. And I hope that it means I am not passing a null value when I use the hidden field technique. Then, I pass two hidden fields (with value in them) from my JSP to a Java class (FindEditorData.java), which is of scaffold.ProcessAction type. One of the field is passed with its value correctly retrieved. The other field is passed with its value found to be null. What could go wrong? I have been thinking about it for days and so do those who try to help me. req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); String userrole = author; % %out.println(The user name is: + username +.);% %out.println(The role is: + userrole +.);% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole -Caroline --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the
Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction
I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen [EMAIL PROTECTED] wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen [EMAIL PROTECTED] wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen [EMAIL PROTECTED] wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If you are doing it yourself (ie. through a db lookup) then the server doesn't know about the user being authenticated and will return null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 2:56 PM To: Struts Users Mailing List Subject: RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen [EMAIL PROTECTED] wrote: I want to pass two hidden fields
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
I use container-managed authentication. --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If you are doing it yourself (ie. through a db lookup) then the server doesn't know about the user being authenticated and will return null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 2:56 PM To: Struts Users Mailing List Subject: RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, Did you check the result of getRemoteUser(). Does it return null or null? If so, it's not a problem with your hidden form variables,. -Richard At 05:29 PM 12/8/2003, you wrote: I use container-managed authentication. --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Imposible? Look at the HTML that is generated by the JSP page. I think you will see that it returns null. Take a look at the JavaDoc for HttpServletRequest.getRemoteUser(); getRemoteUser public java.lang.String getRemoteUser() Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. Returns: a String specifying the login of the user making this request, or null As the JavaDoc says: Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Are you using basic authentication or are you authenticating the user yourself? If you are doing it yourself (ie. through a db lookup) then the server doesn't know about the user being authenticated and will return null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 2:56 PM To: Struts Users Mailing List Subject: RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor html:form action=/find/Category TR TD class=option % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /TD /TR /html:form /req:isUserInRole --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction I did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole and an action mapping: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, Why are you passing the result of request.getRemoteUser() in a hidden variable anyway since it is available as part of the HttpRequest and thus will be available in the action class? -Richard At 02:55 PM 12/8/2003, you wrote: I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles --- Yee, Richard K,,DMDCWEST wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessActionI did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping: roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false name=success path=.article.Result/The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: % String username = request.getRemoteUser();%value=journal_category/ value=%=username%/ View Articles and an action mapping: roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false name=success path=.article.Result/ How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )){ StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); === message truncated === __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
I must pass the result of request.getRemoteUser() because it is a Java class that receives the hidden field. If you read my code carefully, you will see that FindEditorData.java is a Java class and I cannot use 'request' or 'session' in a Java class. It takes a servlet or a class extends Action to use 'request' or 'session'. But, this class is of ProcessAction type defined in the struts-config.xml: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action And, it is easy to see that I use container-managed authentication. In my JSP, there is req:isUserInRole role=editor before reaching % String username=request.getRemoteUser(); % Again, I have provided my code: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser(); % html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole --- Richard Yee [EMAIL PROTECTED] wrote: Caroline, Why are you passing the result of request.getRemoteUser() in a hidden variable anyway since it is available as part of the HttpRequest and thus will be available in the action class? -Richard At 02:55 PM 12/8/2003, you wrote: I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null. It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. req:isUserInRole role=editor % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles --- Yee, Richard K,,DMDCWEST wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessActionI did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping: roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false name=success path=.article.Result/The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData --- Caroline Jen wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping: roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction
RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction
Caroline, What is the return value of getRemoteUser() ? -Richard At 07:38 PM 12/8/2003, you wrote: I must pass the result of request.getRemoteUser() because it is a Java class that receives the hidden field. If you read my code carefully, you will see that FindEditorData.java is a Java class and I cannot use 'request' or 'session' in a Java class. It takes a servlet or a class extends Action to use 'request' or 'session'. But, this class is of ProcessAction type defined in the struts-config.xml: action roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request validate=false forward name=success path=.article.Result/ /action And, it is easy to see that I use container-managed authentication. In my JSP, there is req:isUserInRole role=editor before reaching % String username=request.getRemoteUser(); % Again, I have provided my code: req:isUserInRole role=editor % String username = request.getRemoteUser(); % value=journal_category/ value=%=username%/ View Articles --- Richard Yee wrote: Caroline, Why are you passing the result of request.getRemoteUser() in a hidden variable anyway since it is available as part of the HttpRequest and thus will be available in the action class? -Richard At 02:55 PM 12/8/2003, you wrote: I pass two hidden fields: username and keyName at the same time. The keyName is passed and with the correct value in it. The username is passed but its value turns out to be a null.It is impossible for request.getRemoteUser(); in my JSP returning a null. (see code below) Before it reaches request.getRemoteUser(); the user has already been successfully logged in with a valid name. % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles --- Yee, Richard K,,DMDCWEST wrote: Caroline, Are you having problems with the username or the keyName hidden variable? If it is the username, then I'd suspect that request.getRemoteUser() in your JSP is returning null. Regards, Richard-Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 1:32 PM To: Struts Users Mailing List Subject: Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessActionI did not mess up lowercase and uppercase of the hidden field I want to pass from my JSP to the scaffold.ProcessAction. If it had been the lowercase/uppercase problem, I would have gotten a message saying that the variable could not be recognized. I pass two hidden fields at the same time. One of them is successfully passed with correct value. The other is passed but its value shows a 'null' in the scaffold.ProcessAction. What could go wrong? Let me show my code again: Two hidden fields: username and keyName are passed from a JSP via a SUBMIT button: % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping:roles=editor path=/find/Categorytype=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.FindEditorDatanam e=articleForm scope=request validate=false name=success path=.article.Result/ The value of the 'username' is found to be a 'null' in the FindEditorData.java while the value of keyName is successfully retrieved. In the browser, I got: name=null; kn=journal_category; kv=nullThe code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername();EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName();if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value );return new ProcessResultBase( list ); } // end execute} // End FindEditorData --- Caroline Jen wrote:I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping: roles=editor path=/find/Category type=org.apache.struts.scaffold.ProcessAc tionparameter=org.apache.artimus.article.FindEditorData name=articleForm scope=request
Re: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction
Are you using the input type=hidden or html:hidden attributes? I didn't see it in your email. If you do, the values will be available in the request. Regards, Richard At 08:20 PM 12/7/2003, you wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping: How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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: Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction
My code was shown in my original message. I used two html:hidden ... tags to pass two hidden fields, one is successfully passed while the other shows null. By the way, I do not use 'request' to retrieve the value of the hidden field because my Java class is a scaffold.ProcessAction type. I simply use getXxx. Let me show my code again: req:isUserInRole role=editor html:form action=/find/Category % String username = request.getRemoteUser();% html:hidden property=keyName value=journal_category/ html:hidden property=username value=%=username%/ html:submitView Articles/html:submit /html:form /req:isUserInRole --- Richard Yee [EMAIL PROTECTED] wrote: Are you using the input type=hidden or html:hidden attributes? I didn't see it in your email. If you do, the values will be available in the request. Regards, Richard At 08:20 PM 12/7/2003, you wrote: I want to pass two hidden fields; username and keyName from a JSP via a SUBMIT button: req:isUserInRole role=editor % String username = request.getRemoteUser();% value=journal_category/ value=%=username%/ View Articles and an action mapping: How come the username is not passed to the FindEditorData.java while the keyName is successfully passed. In the browser, I got: name=null; kn=journal_category; kv=null The code of my FindEditorData is shown below: public final class FindEditorData extends Bean { public Object execute() throws Exception { // Obtain username String username = getUsername(); EditorService service = new EditorService(); String value = service.findEditorData( username ); String property = getKeyName(); if (( null==property ) || ( null==value )) { StringBuffer sb = new StringBuffer(); sb.append( name= ); sb.append( username ); sb.append( ; kn= ); sb.append( property ); sb.append( ; kv= ); sb.append( value ); throw new ParameterException( sb.toString() ); } ResultList list = new ResultListBase ( Access.findByProperty( this,property,value ) ); list.setLegend( property,value ); return new ProcessResultBase( list ); } // end execute } // End FindEditorData __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.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] __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PLEASE HELP: Exception handling
Say this in WEB.XML error-page exception-typejava.lang.Exception/exception-type location/error.jsp/location /error-page Then this in error.jsp or what ever you consider friendly: %@ page isErrorPage =true % You are at a J2EE error page: p %= exception.getMessage() % and then: throw new Exception(Oops, I did it again); Or if you want to localize. There are many variations, but KISS will start you. .V Bard A. Evjen wrote: Can anyone provide me with a complete example of using execption handling in struts that supports a nice message to the user and the actual error message (displayed on the jsp page)? (I'm using struts 1.1) I think I've tried everything now (well, obviously not everything since it is not working), so I would REALLY appreciate the help. You can either point me to a page where I can download a complete example or you can send it to me on bardevjen at operamail.com Thanks a lot! Regards, Bard -- Victor Cekvenich, Struts Instructor (215) 321-9146 Advanced Struts Training http://basebeans.com/do/cmsPg?content=TRAINING Server Side Java training with Rich UI, mentoring, designs, samples and project recovery in North East. Simple best practice basic Portal, a Struts CMS, Membership, Forums, Shopping and Credit processing, http://basicportal.com software, ready to develop/customize; requires a db to run. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help!!! A Validation Rule Fail On A Second-Page Causes A Blank Page To Show Up
Hi Ted, Thank you for your time in helping me out. After your email message I take a hard look at the jsp file and can not find what was wrong with it. The secondPage.jsp is almost the same as the firstPage.jsp. When I move all the code from the secondPage.jsp to the firstPage.jsp the validation process went fine. All fields are validated by the validator. I have given up the hope to create a multipage form for now. And by the way I have purchased the Struts In Actions book along with other three books on the same subject. But there was not must information on multipage form. Do you have any suggestion on book that I may find some complete example on multi page form. To answers your your question about why do I reset all input fields to its original state when the getPage() is equal to 2 is that I only have two pages,firstPage.jsp and secondPage.jsp, each page would set the page number to 0 and 1 correspondingly. I set the page to 2 in the action class when the secondPage.jsp was executed. Then I call the form's reset method to clear all the fields before the control goes back to the firstPage.jsp. I guest you are right about removing the form bean should be good enough to remove all attributes in form for both pages. Thank again. Kam Lung Leung On Fri, 24 Oct 2003 17:19:03 -0400, Ted Husted wrote: Kam Lung Leung wrote: Why don't I get a pop up dialog box with error messages? Why the secondPage.jsp did not get executed when a validation error occurred? Why do I get a blank screen? Are you sure that it's blank? Sometimes the page doesn't render because of errors in the HTML, which might only be exposed when the page is trying to display error messages. I'm not sure why you would reset everything if getPage() is equal to 2. The usual approach is to allow the properties to accumulate, until the end of the workflow, and then dispose of the (session-scoped ActionForm altogether. Generally, the only thing you ever need to reset is a checkbox to false on a session-scope ActionForm. -Ted. Hi, I have been looking at this problem for the last four days and can't figure out. I have an application that required workflow form. I created a CreateUserAccountAction class that extends the DispatchAction and a form MultiCreateUserAccountForm that extends the ValidatorForm. The reset method of the MultiCreateUserAccountForm clears all attributes under the current session when the getPage() is equal to 2. The CreateUserAccountAction has two methods that are similar to the execute method that are named createUserAccountActionOne and createUserAccountActionTwo. I got this concept out of chapter 12 of the book Profession Jakarta Struts by James Goodwill and Richard Hightower. *** Here are the symptoms ** If there is a required field that is missing (leaved out) or does not fulfill the validation rule on the firstPage.jsp when the submit button is pressed. A new dialog box popped up on the screen with the validation message(s) from the resource property file. When all fields are validated the control is forwarded to the secondPage.jsp. If there is a required field that is missing (leaved out) or does not fulfill the validation rule on the secondPage.jsp when the submit button is pressed. A blank page is showed up on the window without a new dialog box shows up on the screen. The server.log indicates an error occurred and the control returns to the same page (secondPage.jsp). To fixing this problem, I pressed the back page button of the browser and correctly filled in all missing fields or making sure the input is conforming to the validation rule. When all fields on the second page are filled in correctly according to the validation rules then the control is correctly forwarded back to the firstPage.jsp. ** My questions Any suggestion and how to fix this problem is deeply appriciated. Kam Lung Leung *** ***More detail on how the jsp was set up ** The createUserAccountActionOne method calls the MultiCreateUserAccountForm.validate() method to validate the user input fields of the firstPage.jsp. Second, it calls the setPage() method with 1 as its input parameter. Finally, it calls the MultiCreateUserAccountForm.setMethodToDispatch() with createUserAccountActionTwo as the input parameter. The createUserAccountActionTwo method calls the MultiCreateUserAccountForm.validate() method to validate the user input fields of the secondPage.jsp. Secondly, it remove the obsolete form bean with session.removeAttribute(mapping.getAttribute()). Thirdly, it calls the setPage() method with 2 as its input parameter. Finally, it calls the reset() method to clear all attributes under the current session. ** This are action
RE: Please help: Cannot find message resources under key org.apa che. struts.action. MESSAGE
Looks like you need a file ApplicationResources.properties in your /WEB-INF/classes directory. Edgar -Original Message- From: Prashanth Narayanan [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 4:57 PM To: 'Struts Users Mailing List' Subject: Please help: Cannot find message resources under key org.apache. struts.action. MESSAGE still couldn't resolve this any help will be appreciated - this is my first struts example! -Original Message- From: Prashanth Narayanan Sent: Wednesday, October 29, 2003 1:54 PM To: '[EMAIL PROTECTED]' Subject: Cannot find message resources under key org.apache.struts.action. MESSAGE hi, i am getting the following message: org.apache.jasper.JasperException: Cannot find message resources under key org.apache.struts.action.MESSAGE at org.apache.jasper.servlet.JspServletWrapper.service(JspServlet Wrapper.java:2 54) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) ... i am running struts 1.1 on apache 4.1. and this is the most basic example: -- my BookView.jsp -- %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % html:html locale=true head html:base/ title bean:message key=index.title/ /title /head body h2BookView/h2 /body /html:html -- from my web.xml: -- web-app servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param my struts-config.xml: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config message-resources parameter=ApplicationResources.properties/ /struts-config any help will be much appreciated, thanks, -prash. - 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: Please help: Cannot find message resources under key org.apache. struts.action. MESSAGE
And delete the .properties from struts-config: struts-config message-resources parameter=ApplicationResources/ /struts-config -Original Message- From: Edgar P Dollin [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 3:58 PM To: 'Prashanth Narayanan'; 'Struts Users Mailing List' Subject: RE: Please help: Cannot find message resources under key org.apache. struts.action. MESSAGE Looks like you need a file ApplicationResources.properties in your /WEB-INF/classes directory. Edgar -Original Message- From: Prashanth Narayanan [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 4:57 PM To: 'Struts Users Mailing List' Subject: Please help: Cannot find message resources under key org.apache. struts.action. MESSAGE still couldn't resolve this any help will be appreciated - this is my first struts example! -Original Message- From: Prashanth Narayanan Sent: Wednesday, October 29, 2003 1:54 PM To: '[EMAIL PROTECTED]' Subject: Cannot find message resources under key org.apache.struts.action. MESSAGE hi, i am getting the following message: org.apache.jasper.JasperException: Cannot find message resources under key org.apache.struts.action.MESSAGE at org.apache.jasper.servlet.JspServletWrapper.service(JspServlet Wrapper.java:2 54) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) ... i am running struts 1.1 on apache 4.1. and this is the most basic example: -- my BookView.jsp -- %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % html:html locale=true head html:base/ title bean:message key=index.title/ /title /head body h2BookView/h2 /body /html:html -- from my web.xml: -- web-app servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param my struts-config.xml: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config message-resources parameter=ApplicationResources.properties/ /struts-config any help will be much appreciated, thanks, -prash. - 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: please help: ActionForms of same type but different name?
Are the number of different form instances going to be determined dynamically? If so, this is an intractible problem, because you won't be able to make every possible determination in the struts-config.xml file in advance. This might be a good use of JavaScript though. In that case, you would have two form beans: LoginFormA, and LoginFormB. Each one would have one potential action coming out of the page (ActionA and ActionB). You would then create one hidden html:form instance of each of LoginFormA, and LoginFormB. For each visible html:form, you would have a form which, on submit, would populate the hidden LoginFormA or LoginFormB instance, setting a hidden value indicating which visible html:form was actually submitted, and then submit the HIDDEN html:form corresponding to the particular form bean you needed to use. Would this pattern work for you? Kirk Wylie M7 Corporation Sonam Belbase wrote: Continued.. So there are two levels of distinction here - the first one being between LoginFormTypeA and LoginFormTypeB. But that is no big issue since the actions that map to them are different. So when m of n is submitted, the request processor knows whether m is of type LoginFormTypeA or of type LoginFormTypeB. Problem is that you cannot have multiple html:form elements on a page, all with the same name LoginFormTypeA or LoginFormTypeB. This is why we gave them different names through iteration- LoginFormA_1, LoginFormA_2, LoginFormB_1, etc. When LoginFormA_1 is submitted, you would think that the request processor would look for a form called LoginFormA_1 and form.get(userName) would return the value of LoginFormA_1's userName property. This doesn't happen. Instead, the request processor looks at the action associated with the submitted form, sees that it is loginActionA, looks for the associated form (which from the action-mapping is LoginFormTypeA) and since it cannot find one, creates one. Thus form.get(userName) returns null. Hope this is not too confusing! : ) SB Sonam Belbase wrote: Tim, We do have the same form and the same action and more specifically, we have the LoginFormTypeA processed by loginActionA and LoginFormTypeB processed by loginActionB. Of the 5 login forms, three could be of type A, 2 could be of type B. Chen, Gin wrote: The problem here is that with 5 login forms.. How would you know or even care which of the 5 was used to submit? Is it processed differently if I pick m of n versus x of n? In any case sounds like what you really want is the same form and the same action. Ie.. I might have a bean such that it only contains one parameter. (don't mind syntax as stupid outlook keeps trying to apply spelling and grammer rules which I don't want to turn off cause I'm the worst speller/grammulator) form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=formIteration type=java.lang.Integer/ /form-bean This bean is mapped to the same action. (ex. /loginAction) Then for my JSP : //remember n is simulated ie. don't put n in end (duh) :) c:forEach var=loopCnt begin=1 end=n html:form action=/loginAction html-el:hidden property=formIteration value=${loopCnt}/ html:submit property=userAction bean:message key=button.login/ /html:submit /html:form /c:forEach Now your action is pretty simple. Based on the formIteration value you know which of the n forms was used to login. Hope that helps. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:37 PM To: Struts Users Mailing List Subject: Re: please help: ActionForms of same type but different name? There is no knowing until runtime how many iterations there are going to be. That's why we can't define the n number of LoginForms. The requirement is that on the same jsp, we will have repeating html:form/html:form sections. User will specify at runtime how many he/she wants. The html:forms will all be of the same type. Restriction is that only one can be submitted at a time, i.e. user might have specified 5 Login sections of the page, and therefore is shown 5 login sections, but can only save one at a time. The save action needs to know which form to retrieve the values username and password from. SB Chen, Gin wrote: One approach, you can define as many form-beans as you want iteratations. Ex: form-bean name=LoginForm_1 type=com.oreilly.struts.storefront.security.LoginForm /form-bean form-bean name=LoginForm_2 type=com.oreilly.struts.storefront.security.LoginForm /form-bean . . . form-bean name=LoginForm_n
RE: Please help: Cannot find message resources under key org.apache.struts.action. MESSAGE
struts-config message-resources parameter=ApplicationResources.properties/ /struts-config According to your struts config, the path for the res. File should be something like this. /WEB-INF/classes/ApplicationResources/properties.properties The res file being named properties.properties which Is not wrong just that it sounds funny. I guess you got my hint. So you will need to make osme changes. And I guess RTFM!! Take care and hope this helps! Rajat - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: please help: ActionForms of same type but different name?
The problem here is that with 5 login forms.. How would you know or even care which of the 5 was used to submit? Is it processed differently if I pick m of n versus x of n? In any case sounds like what you really want is the same form and the same action. Ie.. I might have a bean such that it only contains one parameter. (don't mind syntax as stupid outlook keeps trying to apply spelling and grammer rules which I don't want to turn off cause I'm the worst speller/grammulator) form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=formIteration type=java.lang.Integer/ /form-bean This bean is mapped to the same action. (ex. /loginAction) Then for my JSP : //remember n is simulated ie. don't put n in end (duh) :) c:forEach var=loopCnt begin=1 end=n html:form action=/loginAction html-el:hidden property=formIteration value=${loopCnt}/ html:submit property=userAction bean:message key=button.login/ /html:submit /html:form /c:forEach Now your action is pretty simple. Based on the formIteration value you know which of the n forms was used to login. Hope that helps. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:37 PM To: Struts Users Mailing List Subject: Re: please help: ActionForms of same type but different name? There is no knowing until runtime how many iterations there are going to be. That's why we can't define the n number of LoginForms. The requirement is that on the same jsp, we will have repeating html:form/html:form sections. User will specify at runtime how many he/she wants. The html:forms will all be of the same type. Restriction is that only one can be submitted at a time, i.e. user might have specified 5 Login sections of the page, and therefore is shown 5 login sections, but can only save one at a time. The save action needs to know which form to retrieve the values username and password from. SB Chen, Gin wrote: One approach, you can define as many form-beans as you want iteratations. Ex: form-bean name=LoginForm_1 type=com.oreilly.struts.storefront.security.LoginForm /form-bean form-bean name=LoginForm_2 type=com.oreilly.struts.storefront.security.LoginForm /form-bean . . . form-bean name=LoginForm_n type=com.oreilly.struts.storefront.security.LoginForm /form-bean You can also just use a single form bean for all your actions.. If they are the same class then they are the same formbean anyways. So just use the same name for all of them (well not html:form name in Struts 1.1+ but rather use name in action definition). Or If you explain your requirements a bit more we could come up with a better solution/explanation. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:16 PM To: Struts Users Mailing List Subject: please help: ActionForms of same type but different name? Given the following code in my jsp: logic:iterate id=element name=dynamicFormList type=java.lang.String html:form action=/login name=%=element% type=com.oreilly.struts.storefront.security.LoginForm User Name: html:text property=userName size=20 maxlength=50/ Password: html:text property=password size=20 maxlength=50/ html:hidden property=identifier value=%= element % / html:submit property= value=OK / /html:form /logic:iterate element has the value LoginForm_1 in the first iteratation, LoginForm_2 in the second iteration, and so on. In struts-config: form-bean name=LoginForm type=com.oreilly.struts.storefront.security.LoginForm /form-bean LoginForm extends ActionForm. I understand that the attributes name and type have been deprecated but I am trying to get the iteration to create and display a new instance of the LoginForm, each with it's own name and properties. After submit, the request processor seems to look for a formbean associated with the action (in this case, a formbean called LoginForm) and not a formbean with name LoginForm_1 and therefore in the action the form property values are all null. Anyone know how I can get it to look for the formBean with the unique name that was specified by the variable element? Thanks, SB -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL
Re: please help: ActionForms of same type but different name?
Tim, We do have the same form and the same action and more specifically, we have the LoginFormTypeA processed by loginActionA and LoginFormTypeB processed by loginActionB. Of the 5 login forms, three could be of type A, 2 could be of type B. Chen, Gin wrote: The problem here is that with 5 login forms.. How would you know or even care which of the 5 was used to submit? Is it processed differently if I pick m of n versus x of n? In any case sounds like what you really want is the same form and the same action. Ie.. I might have a bean such that it only contains one parameter. (don't mind syntax as stupid outlook keeps trying to apply spelling and grammer rules which I don't want to turn off cause I'm the worst speller/grammulator) form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=formIteration type=java.lang.Integer/ /form-bean This bean is mapped to the same action. (ex. /loginAction) Then for my JSP : //remember n is simulated ie. don't put n in end (duh) :) c:forEach var=loopCnt begin=1 end=n html:form action=/loginAction html-el:hidden property=formIteration value=${loopCnt}/ html:submit property=userAction bean:message key=button.login/ /html:submit /html:form /c:forEach Now your action is pretty simple. Based on the formIteration value you know which of the n forms was used to login. Hope that helps. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:37 PM To: Struts Users Mailing List Subject: Re: please help: ActionForms of same type but different name? There is no knowing until runtime how many iterations there are going to be. That's why we can't define the n number of LoginForms. The requirement is that on the same jsp, we will have repeating html:form/html:form sections. User will specify at runtime how many he/she wants. The html:forms will all be of the same type. Restriction is that only one can be submitted at a time, i.e. user might have specified 5 Login sections of the page, and therefore is shown 5 login sections, but can only save one at a time. The save action needs to know which form to retrieve the values username and password from. SB Chen, Gin wrote: One approach, you can define as many form-beans as you want iteratations. Ex: form-bean name=LoginForm_1 type=com.oreilly.struts.storefront.security.LoginForm /form-bean form-bean name=LoginForm_2 type=com.oreilly.struts.storefront.security.LoginForm /form-bean . . . form-bean name=LoginForm_n type=com.oreilly.struts.storefront.security.LoginForm /form-bean You can also just use a single form bean for all your actions.. If they are the same class then they are the same formbean anyways. So just use the same name for all of them (well not html:form name in Struts 1.1+ but rather use name in action definition). Or If you explain your requirements a bit more we could come up with a better solution/explanation. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:16 PM To: Struts Users Mailing List Subject: please help: ActionForms of same type but different name? Given the following code in my jsp: logic:iterate id=element name=dynamicFormList type=java.lang.String html:form action=/login name=%=element% type=com.oreilly.struts.storefront.security.LoginForm User Name: html:text property=userName size=20 maxlength=50/ Password: html:text property=password size=20 maxlength=50/ html:hidden property=identifier value=%= element % / html:submit property= value=OK / /html:form /logic:iterate element has the value LoginForm_1 in the first iteratation, LoginForm_2 in the second iteration, and so on. In struts-config: form-bean name=LoginForm type=com.oreilly.struts.storefront.security.LoginForm /form-bean LoginForm extends ActionForm. I understand that the attributes name and type have been deprecated but I am trying to get the iteration to create and display a new instance of the LoginForm, each with it's own name and properties. After submit, the request processor seems to look for a formbean associated with the action (in this case, a formbean called LoginForm) and not a formbean with name LoginForm_1 and therefore in the action the form property values are all null. Anyone know how I can get it to look for the formBean with the unique name that was specified by the variable element? Thanks, SB -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited
Re: please help: ActionForms of same type but different name?
Continued.. So there are two levels of distinction here - the first one being between LoginFormTypeA and LoginFormTypeB. But that is no big issue since the actions that map to them are different. So when m of n is submitted, the request processor knows whether m is of type LoginFormTypeA or of type LoginFormTypeB. Problem is that you cannot have multiple html:form elements on a page, all with the same name LoginFormTypeA or LoginFormTypeB. This is why we gave them different names through iteration- LoginFormA_1, LoginFormA_2, LoginFormB_1, etc. When LoginFormA_1 is submitted, you would think that the request processor would look for a form called LoginFormA_1 and form.get(userName) would return the value of LoginFormA_1's userName property. This doesn't happen. Instead, the request processor looks at the action associated with the submitted form, sees that it is loginActionA, looks for the associated form (which from the action-mapping is LoginFormTypeA) and since it cannot find one, creates one. Thus form.get(userName) returns null. Hope this is not too confusing! : ) SB Sonam Belbase wrote: Tim, We do have the same form and the same action and more specifically, we have the LoginFormTypeA processed by loginActionA and LoginFormTypeB processed by loginActionB. Of the 5 login forms, three could be of type A, 2 could be of type B. Chen, Gin wrote: The problem here is that with 5 login forms.. How would you know or even care which of the 5 was used to submit? Is it processed differently if I pick m of n versus x of n? In any case sounds like what you really want is the same form and the same action. Ie.. I might have a bean such that it only contains one parameter. (don't mind syntax as stupid outlook keeps trying to apply spelling and grammer rules which I don't want to turn off cause I'm the worst speller/grammulator) form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=formIteration type=java.lang.Integer/ /form-bean This bean is mapped to the same action. (ex. /loginAction) Then for my JSP : //remember n is simulated ie. don't put n in end (duh) :) c:forEach var=loopCnt begin=1 end=n html:form action=/loginAction html-el:hidden property=formIteration value=${loopCnt}/ html:submit property=userAction bean:message key=button.login/ /html:submit /html:form /c:forEach Now your action is pretty simple. Based on the formIteration value you know which of the n forms was used to login. Hope that helps. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:37 PM To: Struts Users Mailing List Subject: Re: please help: ActionForms of same type but different name? There is no knowing until runtime how many iterations there are going to be. That's why we can't define the n number of LoginForms. The requirement is that on the same jsp, we will have repeating html:form/html:form sections. User will specify at runtime how many he/she wants. The html:forms will all be of the same type. Restriction is that only one can be submitted at a time, i.e. user might have specified 5 Login sections of the page, and therefore is shown 5 login sections, but can only save one at a time. The save action needs to know which form to retrieve the values username and password from. SB Chen, Gin wrote: One approach, you can define as many form-beans as you want iteratations. Ex: form-bean name=LoginForm_1 type=com.oreilly.struts.storefront.security.LoginForm /form-bean form-bean name=LoginForm_2 type=com.oreilly.struts.storefront.security.LoginForm /form-bean . . . form-bean name=LoginForm_n type=com.oreilly.struts.storefront.security.LoginForm /form-bean You can also just use a single form bean for all your actions.. If they are the same class then they are the same formbean anyways. So just use the same name for all of them (well not html:form name in Struts 1.1+ but rather use name in action definition). Or If you explain your requirements a bit more we could come up with a better solution/explanation. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:16 PM To: Struts Users Mailing List Subject: please help: ActionForms of same type but different name? Given the following code in my jsp: logic:iterate id=element name=dynamicFormList type=java.lang.String html:form action=/login name=%=element% type=com.oreilly.struts.storefront.security.LoginForm User Name: html:text property=userName size=20 maxlength=50/ Password
RE: please help: ActionForms of same type but different name?
One approach, you can define as many form-beans as you want iteratations. Ex: form-bean name=LoginForm_1 type=com.oreilly.struts.storefront.security.LoginForm /form-bean form-bean name=LoginForm_2 type=com.oreilly.struts.storefront.security.LoginForm /form-bean . . . form-bean name=LoginForm_n type=com.oreilly.struts.storefront.security.LoginForm /form-bean You can also just use a single form bean for all your actions.. If they are the same class then they are the same formbean anyways. So just use the same name for all of them (well not html:form name in Struts 1.1+ but rather use name in action definition). Or If you explain your requirements a bit more we could come up with a better solution/explanation. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:16 PM To: Struts Users Mailing List Subject: please help: ActionForms of same type but different name? Given the following code in my jsp: logic:iterate id=element name=dynamicFormList type=java.lang.String html:form action=/login name=%=element% type=com.oreilly.struts.storefront.security.LoginForm User Name: html:text property=userName size=20 maxlength=50/ Password: html:text property=password size=20 maxlength=50/ html:hidden property=identifier value=%= element % / html:submit property= value=OK / /html:form /logic:iterate element has the value LoginForm_1 in the first iteratation, LoginForm_2 in the second iteration, and so on. In struts-config: form-bean name=LoginForm type=com.oreilly.struts.storefront.security.LoginForm /form-bean LoginForm extends ActionForm. I understand that the attributes name and type have been deprecated but I am trying to get the iteration to create and display a new instance of the LoginForm, each with it's own name and properties. After submit, the request processor seems to look for a formbean associated with the action (in this case, a formbean called LoginForm) and not a formbean with name LoginForm_1 and therefore in the action the form property values are all null. Anyone know how I can get it to look for the formBean with the unique name that was specified by the variable element? Thanks, SB -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: please help: ActionForms of same type but different name?
There is no knowing until runtime how many iterations there are going to be. That's why we can't define the n number of LoginForms. The requirement is that on the same jsp, we will have repeating html:form/html:form sections. User will specify at runtime how many he/she wants. The html:forms will all be of the same type. Restriction is that only one can be submitted at a time, i.e. user might have specified 5 Login sections of the page, and therefore is shown 5 login sections, but can only save one at a time. The save action needs to know which form to retrieve the values username and password from. SB Chen, Gin wrote: One approach, you can define as many form-beans as you want iteratations. Ex: form-bean name=LoginForm_1 type=com.oreilly.struts.storefront.security.LoginForm /form-bean form-bean name=LoginForm_2 type=com.oreilly.struts.storefront.security.LoginForm /form-bean . . . form-bean name=LoginForm_n type=com.oreilly.struts.storefront.security.LoginForm /form-bean You can also just use a single form bean for all your actions.. If they are the same class then they are the same formbean anyways. So just use the same name for all of them (well not html:form name in Struts 1.1+ but rather use name in action definition). Or If you explain your requirements a bit more we could come up with a better solution/explanation. -Tim -Original Message- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:16 PM To: Struts Users Mailing List Subject: please help: ActionForms of same type but different name? Given the following code in my jsp: logic:iterate id=element name=dynamicFormList type=java.lang.String html:form action=/login name=%=element% type=com.oreilly.struts.storefront.security.LoginForm User Name: html:text property=userName size=20 maxlength=50/ Password: html:text property=password size=20 maxlength=50/ html:hidden property=identifier value=%= element % / html:submit property= value=OK / /html:form /logic:iterate element has the value LoginForm_1 in the first iteratation, LoginForm_2 in the second iteration, and so on. In struts-config: form-bean name=LoginForm type=com.oreilly.struts.storefront.security.LoginForm /form-bean LoginForm extends ActionForm. I understand that the attributes name and type have been deprecated but I am trying to get the iteration to create and display a new instance of the LoginForm, each with it's own name and properties. After submit, the request processor seems to look for a formbean associated with the action (in this case, a formbean called LoginForm) and not a formbean with name LoginForm_1 and therefore in the action the form property values are all null. Anyone know how I can get it to look for the formBean with the unique name that was specified by the variable element? Thanks, SB -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help!!! A Validation Rule Fail On A Second-Page Causes A Blank Page To Show Up
Kam Lung Leung wrote: Why don't I get a pop up dialog box with error messages? Why the secondPage.jsp did not get executed when a validation error occurred? Why do I get a blank screen? Are you sure that it's blank? Sometimes the page doesn't render because of errors in the HTML, which might only be exposed when the page is trying to display error messages. I'm not sure why you would reset everything if getPage() is equal to 2. The usual approach is to allow the properties to accumulate, until the end of the workflow, and then dispose of the (session-scoped ActionForm altogether. Generally, the only thing you ever need to reset is a checkbox to false on a session-scope ActionForm. -Ted. Hi, I have been looking at this problem for the last four days and can't figure out. I have an application that required workflow form. I created a CreateUserAccountAction class that extends the DispatchAction and a form MultiCreateUserAccountForm that extends the ValidatorForm. The reset method of the MultiCreateUserAccountForm clears all attributes under the current session when the getPage() is equal to 2. The CreateUserAccountAction has two methods that are similar to the execute method that are named createUserAccountActionOne and createUserAccountActionTwo. I got this concept out of chapter 12 of the book Profession Jakarta Struts by James Goodwill and Richard Hightower. *** Here are the symptoms ** If there is a required field that is missing (leaved out) or does not fulfill the validation rule on the firstPage.jsp when the submit button is pressed. A new dialog box popped up on the screen with the validation message(s) from the resource property file. When all fields are validated the control is forwarded to the secondPage.jsp. If there is a required field that is missing (leaved out) or does not fulfill the validation rule on the secondPage.jsp when the submit button is pressed. A blank page is showed up on the window without a new dialog box shows up on the screen. The server.log indicates an error occurred and the control returns to the same page (secondPage.jsp). To fixing this problem, I pressed the back page button of the browser and correctly filled in all missing fields or making sure the input is conforming to the validation rule. When all fields on the second page are filled in correctly according to the validation rules then the control is correctly forwarded back to the firstPage.jsp. ** My questions Any suggestion and how to fix this problem is deeply appriciated. Kam Lung Leung *** ***More detail on how the jsp was set up ** The createUserAccountActionOne method calls the MultiCreateUserAccountForm.validate() method to validate the user input fields of the firstPage.jsp. Second, it calls the setPage() method with 1 as its input parameter. Finally, it calls the MultiCreateUserAccountForm.setMethodToDispatch() with createUserAccountActionTwo as the input parameter. The createUserAccountActionTwo method calls the MultiCreateUserAccountForm.validate() method to validate the user input fields of the secondPage.jsp. Secondly, it remove the obsolete form bean with session.removeAttribute(mapping.getAttribute()). Thirdly, it calls the setPage() method with 2 as its input parameter. Finally, it calls the reset() method to clear all attributes under the current session. ** This are action mapping *** action path=/multiCreateUserAccountFirstSubmit type=com.wlwa.CreateUserAccountAction name=multiCreateUserAccountForm scope=session validate=true parameter=methodToDispatch input=/CreateUserAccountLink.jsp forward name=success path=/CreateUserAccountSecondLink.jsp / /action action path=/multiCreateUserAccountSecondSubmit type=com.wlwa.CreateUserAccountAction name=multiCreateUserAccountForm scope=session validate=true parameter=methodToDispatch input=/CreateUserAccountSecondLink.jsp forward name=success path=/CreateUserAccountLink.jsp / /action - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please help with this error ???en_US.errors.required???
Hi Vivien, Take a look at your web.xml. Maybe you copied it from Struts dist and message-resources was already configured there. As settings in web.xml will override settings in struts-config.xml, classloader can't find resource to be loaded and then you get that messages. Hope i helped you. Kind regards, Daniel. --- Chen, Vivien [EMAIL PROTECTED] wrote: I have a login.jsp which I use DynaValidatorForm. Both the username and password are required fields. When I submited the page without entering these data, I got ???en_US.errors.required??? and ???en_US.errors.required???. It looks like the validation was peformed because I got two error.required messages but I don't understand why it was not able to print the accurate message. please help. Thanks in adavance. In xxxResources.properties: errors.required={0} is required. errors.minlength={0} cannot be less than {1} characters. errors.maxlength={0} cannot be greater than {2} characters. ... In struts-config.xml: form-beans !-- Login form bean -- form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=username type=java.lang.String/ form-property name=password type=java.lang.String/ /form-bean /form-beans message-resources parameter=xxxResources/ I packaged the xxxResource.properties in my xxx.war: WEB-INF/classes/xxxResources.properties In Validation.xml: form-validation formset form name=loginForm field property=username depends=required,minlength,maxlength arg0 key=prompt.username/ arg1 key=${var:minlength} name=minlength resource=false/ arg2 key=${var:maxlength} name=maxlength resource=false/ var var-namemaxlength/var-name var-value16/var-value /var var var-nameminlength/var-name var-value3/var-value /var /field .. /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ 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: Please help with this error ???en_US.errors.required???
Thanks for your tips which gave me some idea what to look for. My web.xml is fine. The problem is I have the following in my struts-config.xml, which I copied/pasted from the strust-config.xml in the Struts tiles_documentation examples. Will my application, which uses tiles, breaks at some point if I don't include it as the comment states? !-- Not used by tiles or this website, but needed due to a bug in actual Struts version -- message-resources parameter=org.apache.struts.webapp.tiles.dev1-1.ApplicationResources null=false / Vivien -Original Message- From: Daniel H. F. e Silva [mailto:[EMAIL PROTECTED] Sent: Fri 10/10/2003 1:44 PM To: Struts Users Mailing List Cc: Subject:RE: Please help with this error ???en_US.errors.required??? Hi Vivien, Sorry, but i did not make myself clear. Property you have to check existence in web.xml is application. It has same effect as parameter attribute of message-resources/. So, if you find it there (web.xml), remove it. Hope it helped you. Regards, Daniel. --- Chen, Vivien [EMAIL PROTECTED] wrote: I checked my web.xml and did not see message-resources being defined there. Do you have any other idea where I might do wrong. I am really stuck with this problem now. Vivien -Original Message- From: Daniel H. F. e Silva [mailto:[EMAIL PROTECTED] Sent: Fri 10/10/2003 9:55 AM To: Struts Users Mailing List Cc: Subject: Re: Please help with this error ???en_US.errors.required??? Hi Vivien, Take a look at your web.xml. Maybe you copied it from Struts dist and message-resources was already configured there. As settings in web.xml will override settings in struts-config.xml, classloader can't find resource to be loaded and then you get that messages. Hope i helped you. Kind regards, Daniel. --- Chen, Vivien [EMAIL PROTECTED] wrote: I have a login.jsp which I use DynaValidatorForm. Both the username and password are required fields. When I submited the page without entering these data, I got ???en_US.errors.required??? and ???en_US.errors.required???. It looks like the validation was peformed because I got two error.required messages but I don't understand why it was not able to print the accurate message. please help. Thanks in adavance. In xxxResources.properties: errors.required={0} is required. errors.minlength={0} cannot be less than {1} characters. errors.maxlength={0} cannot be greater than {2} characters. ... In struts-config.xml: form-beans !-- Login form bean -- form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=username type=java.lang.String/ form-property name=password type=java.lang.String/ /form-bean /form-beans message-resources parameter=xxxResources/ I packaged the xxxResource.properties in my xxx.war: WEB-INF/classes/xxxResources.properties In Validation.xml: form-validation formset form name=loginForm field property=username depends=required,minlength,maxlength arg0 key=prompt.username/ arg1 key=${var:minlength} name=minlength resource=false/ arg2 key=${var:maxlength} name=maxlength resource=false/ var var-namemaxlength/var-name var-value16/var-value /var var var-nameminlength/var-name var-value3/var-value /var /field .. /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ 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] __ 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: Please help with this error ???en_US.errors.required???
Hi Vivien, I think it depends on Struts version you are using. I use 1.1 and everything works fine. Your message-resources/ config tells Struts to look for your resources at package org.apache.struts.webapp.tiles.dev1-1. So, you should have, for instance, this: WEB-INF -- | |--- classes -- | |--- org/apache/struts/webapp/tiles/dev1-1 | | - ApplicationResources.properties If you are not using 1.1, please, upgrade to. If problem still happens, you know how to find us. Hope it was useful. Regards, Daniel. --- Chen, Vivien [EMAIL PROTECTED] wrote: Thanks for your tips which gave me some idea what to look for. My web.xml is fine. The problem is I have the following in my struts-config.xml, which I copied/pasted from the strust-config.xml in the Struts tiles_documentation examples. Will my application, which uses tiles, breaks at some point if I don't include it as the comment states? !-- Not used by tiles or this website, but needed due to a bug in actual Struts version -- message-resources parameter=org.apache.struts.webapp.tiles.dev1-1.ApplicationResources null=false / Vivien -Original Message- From: Daniel H. F. e Silva [mailto:[EMAIL PROTECTED] Sent: Fri 10/10/2003 1:44 PM To: Struts Users Mailing List Cc: Subject: RE: Please help with this error ???en_US.errors.required??? Hi Vivien, Sorry, but i did not make myself clear. Property you have to check existence in web.xml is application. It has same effect as parameter attribute of message-resources/. So, if you find it there (web.xml), remove it. Hope it helped you. Regards, Daniel. --- Chen, Vivien [EMAIL PROTECTED] wrote: I checked my web.xml and did not see message-resources being defined there. Do you have any other idea where I might do wrong. I am really stuck with this problem now. Vivien -Original Message- From: Daniel H. F. e Silva [mailto:[EMAIL PROTECTED] Sent: Fri 10/10/2003 9:55 AM To: Struts Users Mailing List Cc: Subject:Re: Please help with this error ???en_US.errors.required??? Hi Vivien, Take a look at your web.xml. Maybe you copied it from Struts dist and message-resources was already configured there. As settings in web.xml will override settings in struts-config.xml, classloader can't find resource to be loaded and then you get that messages. Hope i helped you. Kind regards, Daniel. --- Chen, Vivien [EMAIL PROTECTED] wrote: I have a login.jsp which I use DynaValidatorForm. Both the username and password are required fields. When I submited the page without entering these data, I got ???en_US.errors.required??? and ???en_US.errors.required???. It looks like the validation was peformed because I got two error.required messages but I don't understand why it was not able to print the accurate message. please help. Thanks in adavance. In xxxResources.properties: errors.required={0} is required. errors.minlength={0} cannot be less than {1} characters. errors.maxlength={0} cannot be greater than {2} characters. ... In struts-config.xml: form-beans !-- Login form bean -- form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=username type=java.lang.String/ form-property name=password type=java.lang.String/ /form-bean /form-beans message-resources parameter=xxxResources/ I packaged the xxxResource.properties in my xxx.war: WEB-INF/classes/xxxResources.properties In Validation.xml: form-validation formset form name=loginForm field property=username depends=required,minlength,maxlength arg0 key=prompt.username/ arg1 key=${var:minlength} name=minlength resource=false/ arg2 key=${var:maxlength} name=maxlength resource=false/ var var-namemaxlength/var-name var-value16/var-value /var var var-nameminlength/var-name var-value3/var-value /var /field .. /form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ 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
Re: Please Help Me To Understand forward
The first snippet redirects to a Struts ActionForward named welcome. This places controls within the Struts controller where it can be managed from the struts-config. In the global-forwards section, the ActionForward element for welcome is mapped to the page /do/Menu. This application uses prefix mapping, so any request for /do/* is sent to the Struts ActionServlet. The Struts ActionSerlvet then looks for a matching ActionMapping. The matching ActionMapping in this case is /Menu (the URI stripped of the prefix or suffix registered to the Servlet). If you look again, I think you will find this ActionMapping: action path=/Menu name=menuForm type=org.apache.struts.scaffold.ExistsAttributeAction parameter=application;HOURS forward name=success path=.article.Menu/ forward name=failure path=/do/MenuCreate/ /action Here, if the attribute exists, the page will be rendered by the .article.Menu Tile. Otherwise, control will go the /MenuCreate action first. The .article.Menu tile (in tiles-def.xml) assembles the page using these instructions: definition name=.article.Menu extends=.article.Base put name=title value=article.Menu.title/ put name=content value=/article/content/menu.jsp/ put name=navbar value=/article/common/navbarMenu.jsp/ /definition The menu.jsp is the main content page, but other pages are also used to create the final response. -Ted. Caroline Jen wrote: I am studying the code in Artimus_1_1 to make sure that I understand how things actually work. I am lost at the beginning of the application. Please kindly help me. The index.jsp of the application contains two lines: code: -- %@ taglib uri=/tags/struts-logic prefix=logic % logic:redirect forward=welcome/ --- Does this redirect forward tells the browser to submit a new request to the path with logical name welcome? I then searched the config.xml file, code: --- global-forwards !-- default forwards -- forward name=baseStyle path=/article/assets/styles/base.css/ !-- MENU forwards -- forward name=welcome path=/do/Menu/ forward name=cancel path=/do/Menu redirect=true/ forward name=done path=/do/Menu/ ... /global-forwards --- The path of the logical name welcome is do/Menu (note it is upper case Menu). The other place that do/Menu appears in the config.xml is: action path=/MenuCreate name=menuForm type=org.apache.struts.scaffold.ProcessAction parameter=org.apache.artimus.article.MenuCreate forward name=success path=/do/Menu/ forward name=failure path=.article.Menu/ /action There is no Menu ActionServlet in the application. There is a menu.jsp (note it is lower case menu) file in the application. Does this application display menu.jsp when it is first launched? Apparently, it does. This menu.jsp is in the artimus_1_1/WEB-INF/src/pages/article/content folder. I am confused - does /do/Menu locate the menu.jsp 1. in the /src/pages/article/content folder? 2. regardless upper or lower cases? __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PLEASE HELP with Exception in error.jsp with Tiles
Hi Richard, First things first - ditch 1.4.1 and get 1.4.2 - I've had endless unusual problems with 1.4.1 - except the very latest release - but 1.4.2 seems faster to me as well. Hmmm - lots to look through ... msanger - Microsoft make you that mad, eh? It looks to me like a further exception is being thrown in the error.jsp (possibly relating to bean:message key=errorPage.heading - is this line correct?). My advice would be to simplify the error.jsp significantly (i.e. start with static content) and build it back gradually. I remember a post a while ago about a gotcha in that when using tiles the error page appears after the already committed content of the tiles - so you may need to consider this too? Good luck! Hue. -Original Message- From: Richard Mixon [mailto:[EMAIL PROTECTED] Sent: 28 August 2003 06:06 To: 'Struts Users Mailing List' Subject: PLEASE HELP with Exception in error.jsp with Tiles Sorry to plead, but I have been fighting this for the better part of two days now. I've done a line by line review of just about all of my code. Cannot find anything that appears out of whack - compared to similar programs that are working. Would really appreciate any tips or suggestions on how to track this down. Let me know if there is additional documentation needed. First, I am running the regular Struts 1.1 production release on Windows XP using Sun Java 1.4.1. In my main JSP I'm running into some type of exception that is causing me to switch to my error.jsp. However it never makes it there and I get about 2/3 of my original JSP page. This only occurs when I encounter an error in a multi-line update. I've turned on logging for the tiles and appropriate struts classes. The most I can see is that I'm getting an NPE in: org.apache.struts.taglib.html.MessagesTag.doAfterBody(MessagesTag. java:312) Below is my error.jsp file and the exception stack trace (sorry, its long chain of exceptions). Each exception refers to the same line in my main JSP - 849 - which is this line, I've just finished the /tiles:put tag for an inline put, and am encountering the /tiles:insert to end my tiles structure (I've included several lines after it): /*line 849*/ if (_jspx_th_tiles_insert_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_tiles_insert_flush_definition.reuse(_jspx_th_tiles_i nsert_0); out.write(\r\n); out.write(!-- html-el:javascript formName=\subjectAspectsForm\ dynamicJavascript=\true\ staticJavascript=\true\ htmlComment=\true\ cdata=\false\/ --\r\n\r\n); } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } HERE'S the error.jsp: %@ page language=java isErrorPage=true % %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean % %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-logic; prefix=logic % !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; !-- I do not integrate this page as a tile, but rather as a standalone-page -- html head titlebean:message key=errorPage.title//title link rel=stylesheet type=text/css media=all href=%=request.getContextPath()%/styles/default.css / /head body div id=screen div id=content h1bean:message key=errorPage.heading//h1 %-- Error Messages --% logic:messagesPresent div class=error See error messages below /div /logic:messagesPresent %-- Success Messages --% logic:messagesPresent message=true div class=message See informational messages below /div /logic:messagesPresent %-- No Messages Message --% logic:messagesNotPresent message=true logic:messagesNotPresent div class=message No messages /div /logic:messagesNotPresent /logic:messagesNotPresent -- Error Messages -- logic:messagesPresent div class=error html:messages id=error bean:write name=error filter=false/br/ /html:messages /div /logic:messagesPresent !-- Success Messages -- logic:messagesPresent message=true div class=message html:messages id=message message=true bean:write name=message filter=false/br/ /html:messages /div /logic:messagesPresent % if (exception != null) { exception.printStackTrace(new java.io.PrintWriter(out)); } else { % !-- only show this if no error messages present -- logic:messagesNotPresent
RE: PLEASE HELP with Exception in error.jsp with Tiles
Hue, Thanks. That did help as it showed it had nothing to do with the error.jsp. Turned out to be a real rookie mistake - a mispelled message key. I'm embarrassed, to say the least - but very, very happy to be on my way again. - Richard -Original Message- From: Hue Holleran [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2003 2:12 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: PLEASE HELP with Exception in error.jsp with Tiles Hi Richard, First things first - ditch 1.4.1 and get 1.4.2 - I've had endless unusual problems with 1.4.1 - except the very latest release - but 1.4.2 seems faster to me as well. Hmmm - lots to look through ... msanger - Microsoft make you that mad, eh? It looks to me like a further exception is being thrown in the error.jsp (possibly relating to bean:message key=errorPage.heading - is this line correct?). My advice would be to simplify the error.jsp significantly (i.e. start with static content) and build it back gradually. I remember a post a while ago about a gotcha in that when using tiles the error page appears after the already committed content of the tiles - so you may need to consider this too? Good luck! Hue. -Original Message- From: Richard Mixon [mailto:[EMAIL PROTECTED] Sent: 28 August 2003 06:06 To: 'Struts Users Mailing List' Subject: PLEASE HELP with Exception in error.jsp with Tiles Sorry to plead, but I have been fighting this for the better part of two days now. I've done a line by line review of just about all of my code. Cannot find anything that appears out of whack - compared to similar programs that are working. Would really appreciate any tips or suggestions on how to track this down. Let me know if there is additional documentation needed. First, I am running the regular Struts 1.1 production release on Windows XP using Sun Java 1.4.1. In my main JSP I'm running into some type of exception that is causing me to switch to my error.jsp. However it never makes it there and I get about 2/3 of my original JSP page. This only occurs when I encounter an error in a multi-line update. I've turned on logging for the tiles and appropriate struts classes. The most I can see is that I'm getting an NPE in: org.apache.struts.taglib.html.MessagesTag.doAfterBody(MessagesTag. java:312) Below is my error.jsp file and the exception stack trace (sorry, its long chain of exceptions). Each exception refers to the same line in my main JSP - 849 - which is this line, I've just finished the /tiles:put tag for an inline put, and am encountering the /tiles:insert to end my tiles structure (I've included several lines after it): /*line 849*/ if (_jspx_th_tiles_insert_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_tiles_insert_flush_definition.reuse(_jspx_th_tiles_i nsert_0); out.write(\r\n); out.write(!-- html-el:javascript formName=\subjectAspectsForm\ dynamicJavascript=\true\ staticJavascript=\true\ htmlComment=\true\ cdata=\false\/ --\r\n\r\n); } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } HERE'S the error.jsp: %@ page language=java isErrorPage=true % %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean % %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % %@ taglib uri=http://jakarta.apache.org/struts/tags-logic; prefix=logic % !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; !-- I do not integrate this page as a tile, but rather as a standalone-page -- html head titlebean:message key=errorPage.title//title link rel=stylesheet type=text/css media=all href=%=request.getContextPath()%/styles/default.css / /head body div id=screen div id=content h1bean:message key=errorPage.heading//h1 %-- Error Messages --% logic:messagesPresent div class=error See error messages below /div /logic:messagesPresent %-- Success Messages --% logic:messagesPresent message=true div class=message See informational messages below /div /logic:messagesPresent %-- No Messages Message --% logic:messagesNotPresent message=true logic:messagesNotPresent div class=message No messages /div /logic:messagesNotPresent /logic:messagesNotPresent -- Error Messages -- logic:messagesPresent div class=error html:messages id=error bean:write name=error filter=false/br/ /html:messages /div /logic:messagesPresent !-- Success Messages
RE: Please Help With Simple Tiles Problem
Thanks for your response. Your assumption is correct in that my design is not very static and therefore need the ability of dynamic embedded tiles (so the first solution would not work). However, you did give me some good ideas and insight into how Tiles works. What I got out of all of this is is that it seems Tiles was intented to work better with flatter structures rather than this dynamic, tree structure thing I'm trying to implement (tiles within tiles within tiles, branching off into other tiles, etc). It certainly has that capability but my definition.xml is getting UGLY... but it's worth it ;) --- Holman, Cal [EMAIL PROTECTED] wrote: Terry Hard to tell from a snippet of an entire site but if the definition page does not define anything except the page.jsp and if you always have form_wrapper.jsp around each for then you could move form_wrapper.jsp functionality to page.jsp and simplify the design. The other way to reduce is to have the functionality for form_wrapper .jsp in the formX.jsp. The tiles context is only for the definition being used not for any embedded definitions so unless you take measures to pass attributes down tiles will not see them. I pass the page definition being called for some menuing style changes but to do so you need to define a bean with the attribute in request scope then pluck it in the lower tiles definition. I have an example on my web site - if you look for the code for the level 3 index you will see the same technique: http://www.calandva.com/holmansite/do/blog/blogging. Although I have been having a lot of problems with my DSL connection over the last few weeks - so email me if you would like more info. If you must do the nested definitions then you can pass the inner tiles insert parameter as a bean and script the formX.jsp. This is pretty ugly and Cedric or someone else may know a better way - I just hacked this together. First the hack: In form_wrapper.jsp add this line where you want form1.jsp to be inserted: tiles:insert name=%= request.getAttribute(form).toString() % flush=true / Then in page.jsp you need to do two things the easy one is include form_wrapper.jsp: tiles:insert attribute=body flush=true/ or you could use your def calling a def routine. Also in page.jsp include a line near the top of the page prior to any tiles:insert tags to create the request scope bean this will make the form visible to the next tile: tiles:useAttribute id=form name=form scope=request/ Now the definition can look like this: definition name=page path=page.jsp/ definition name=form_type_page extends=page put name=body value=form_wrapper.jsp put name=form value=form1.jsp/ /definition definition name=form_page2 extends=form_type_page put name=form value=form2 /definition I know it is messy - but it should work. Cal http://www.calandva.com/Last update 08/01/03 __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Please Help With Simple Tiles Problem
Terry Hard to tell from a snippet of an entire site but if the definition page does not define anything except the page.jsp and if you always have form_wrapper.jsp around each for then you could move form_wrapper.jsp functionality to page.jsp and simplify the design. The other way to reduce is to have the functionality for form_wrapper .jsp in the formX.jsp. The tiles context is only for the definition being used not for any embedded definitions so unless you take measures to pass attributes down tiles will not see them. I pass the page definition being called for some menuing style changes but to do so you need to define a bean with the attribute in request scope then pluck it in the lower tiles definition. I have an example on my web site - if you look for the code for the level 3 index you will see the same technique: http://www.calandva.com/holmansite/do/blog/blogging. Although I have been having a lot of problems with my DSL connection over the last few weeks - so email me if you would like more info. If you must do the nested definitions then you can pass the inner tiles insert parameter as a bean and script the formX.jsp. This is pretty ugly and Cedric or someone else may know a better way - I just hacked this together. First the hack: In form_wrapper.jsp add this line where you want form1.jsp to be inserted: tiles:insert name=%= request.getAttribute(form).toString() % flush=true / Then in page.jsp you need to do two things the easy one is include form_wrapper.jsp: tiles:insert attribute=body flush=true/ or you could use your def calling a def routine. Also in page.jsp include a line near the top of the page prior to any tiles:insert tags to create the request scope bean this will make the form visible to the next tile: tiles:useAttribute id=form name=form scope=request/ Now the definition can look like this: definition name=page path=page.jsp/ definition name=form_type_page extends=page put name=body value=form_wrapper.jsp put name=form value=form1.jsp/ /definition definition name=form_page2 extends=form_type_page put name=form value=form2 /definition I know it is messy - but it should work. Cal http://www.calandva.com/Last update 08/01/03 -Original Message- From: Terry Brick [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 15:20 To: [EMAIL PROTECTED] Subject: RE: Please Help With Simple Tiles Problem Thanks for your response David. Correct me if I'm wrong, but isn't this exactly what I had in my example? Maybe I'm just not grasping something... It looks to me like I'm still having to add two definition blocks for each form I want to add. Under your form_page definition you point to form1 -OR- form2. But in reality can't you only have one or the other? I have an struts action pointing to each form so wouldn't I have to do something like... definition name=page path=page.jsp/ definition name=form_page1 extends=page put name=body value=form1 /definition definition name=form_page2 extends=page put name=body value=form2 /definition definition name=form1 path=form_wrapper.jsp put name=body value=form1.jsp/ definition definition name=form2 path=form_wrapper.jsp put name=body value=form2.jsp/ definition So I would have an action pointing to form_page1 and an action pointing two form_page2. But I would have to add two definitions to my tiles-config file for each form. It just seems redundant to me. Sorry if I'm being dense, your patience is much appreciated :-) --- David Tobey [EMAIL PROTECTED] wrote: Can you just create a generic definition for a form page. Then, switch out what you put for the body. Like this: definition name=page path=page.jsp/ definition name=form_page extends=page put name=body value=form1 -- OR: put name=body value=form2 -- /definition definition name=form1 path=form_wrapper.jsp put name=body value=form1.jsp/ definition definition name=form2 path=form_wrapper.jsp put name=body value=form2.jsp/ definition ... etc ... Now you must create one new definition for each form, but to use a different one, just change what you use for the body of the form_page. dave -Original Message- From: Terry Brick [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 10:55 PM To: Struts Users Mailing List Subject: Re: Please Help With Simple Tiles Problem Ok, I've finally gotten this to work. However, I don't think it's the right solution and it's certainly not one I'm happy with. But maybe by showing how I'm getting it to work, that will better communicate to people what I'm trying SO HARD to do. This works: definition name=page path=page.jsp/ definition name=form1 extends=page put name=body value=form1a/ definition definition name=form1a path=form_wrapper.jsp put name=form-body value=form1.jsp/ /definition So this gives me... page.jsp
RE: Please Help With Simple Tiles Problem
Thanks for your response David. Correct me if I'm wrong, but isn't this exactly what I had in my example? Maybe I'm just not grasping something... It looks to me like I'm still having to add two definition blocks for each form I want to add. Under your form_page definition you point to form1 -OR- form2. But in reality can't you only have one or the other? I have an struts action pointing to each form so wouldn't I have to do something like... definition name=page path=page.jsp/ definition name=form_page1 extends=page put name=body value=form1 /definition definition name=form_page2 extends=page put name=body value=form2 /definition definition name=form1 path=form_wrapper.jsp put name=body value=form1.jsp/ definition definition name=form2 path=form_wrapper.jsp put name=body value=form2.jsp/ definition So I would have an action pointing to form_page1 and an action pointing two form_page2. But I would have to add two definitions to my tiles-config file for each form. It just seems redundant to me. Sorry if I'm being dense, your patience is much appreciated :-) --- David Tobey [EMAIL PROTECTED] wrote: Can you just create a generic definition for a form page. Then, switch out what you put for the body. Like this: definition name=page path=page.jsp/ definition name=form_page extends=page put name=body value=form1 -- OR: put name=body value=form2 -- /definition definition name=form1 path=form_wrapper.jsp put name=body value=form1.jsp/ definition definition name=form2 path=form_wrapper.jsp put name=body value=form2.jsp/ definition ... etc ... Now you must create one new definition for each form, but to use a different one, just change what you use for the body of the form_page. dave -Original Message- From: Terry Brick [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 10:55 PM To: Struts Users Mailing List Subject: Re: Please Help With Simple Tiles Problem Ok, I've finally gotten this to work. However, I don't think it's the right solution and it's certainly not one I'm happy with. But maybe by showing how I'm getting it to work, that will better communicate to people what I'm trying SO HARD to do. This works: definition name=page path=page.jsp/ definition name=form1 extends=page put name=body value=form1a/ definition definition name=form1a path=form_wrapper.jsp put name=form-body value=form1.jsp/ /definition So this gives me... page.jsp form_wrapper.jsp form1.jsp/ /form_wrapper.jsp /page.jsp The problem is that form1.jsp will not always be form1.jsp. I want to be able to swap that for a form2.jsp, form3.jsp, etc. Using this method, I would have to add TWO definitions into the tile-defs.xml for each new form I wanted! (form2, form2a, form3, form3a, etc) There must be a better way where I only have to add a single definition for each new form. Any ideas? Advice is much appreciated. Thanks. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help With Simple Tiles Problem
Tiles can function stand alone from struts but is incorporated in struts 1.1. Here is the website of the originator of tiles. Part way down the page are some example tiles war files that I found helpful. http://www.lifl.fr/~dumoulin/tiles/ Barry - Original Message - From: Terry Brick [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 31, 2003 3:42 PM Subject: Please Help With Simple Tiles Problem I'm using struts 1.1 and having trouble with a simple Tile function. I've searched the archives and doc, but for some reason I just can't seem to get a grip on a lot of this tile stuff. All I want to do is embed a tile within a tile within a page. Here's what I have now: tiles-defx.xml (snippet) = definition name=layout.default path=/tls/layout.jsp put name=title value=my title direct=true/ put name=header value=/tls/header.jsp/ /definition definition name=form.default extends=layout.default put name=body value=/tls/wrapform.jsp/ /definition definition name=form.user extends=form.default put name=title value=form title direct=true/ put name=form-body value=/tls/user_form.jsp/ /definition In layout.jsp (snippet) === tiles:insert attribute=body/ In wrapform.jsp (snippet) tiles:insert attribute=form-body/ I get an error saying that my form-body attribute does not exist. And when I swap tiles:insert with tiles:get, I don't get an error, but I also don't get my form-body content. I can see that what I have defined doesn't make much sense, but I can't figure it out. What I want is, when I call form.user for it to give me the folloing content structure (if these tags represented the content of JSP's) layout.jsp wrapform.jsp user_form.jsp/ /wrapform.jsp /layout.jsp Could someone please show me how to do this? Thank you - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help With Simple Tiles Problem
Thanks. I've seen that page and many other. Believe, I feel stupid from seeing so many examples and not being able to figure it out. But I'm getting a mental block somewhere that just isn't allowing me to grasp something. Barry Volpe [EMAIL PROTECTED] wrote:Tiles can function stand alone from struts but is incorporated in struts 1.1. Here is the website of the originator of tiles. Part way down the page are some example tiles war files that I found helpful. http://www.lifl.fr/~dumoulin/tiles/ Barry - Original Message - From: Terry Brick To: Sent: Thursday, July 31, 2003 3:42 PM Subject: Please Help With Simple Tiles Problem I'm using struts 1.1 and having trouble with a simple Tile function. I've searched the archives and doc, but for some reason I just can't seem to get a grip on a lot of this tile stuff. All I want to do is embed a tile within a tile within a page. Here's what I have now: tiles-defx.xml (snippet) = In layout.jsp (snippet) === In wrapform.jsp (snippet) I get an error saying that my form-body attribute does not exist. And when I swap with , I don't get an error, but I also don't get my form-body content. I can see that what I have defined doesn't make much sense, but I can't figure it out. What I want is, when I call form.user for it to give me the folloing content structure (if these tags represented the content of JSP's) Could someone please show me how to do this? Thank you - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
Re: Please Help With Simple Tiles Problem
Ok, I've finally gotten this to work. However, I don't think it's the right solution and it's certainly not one I'm happy with. But maybe by showing how I'm getting it to work, that will better communicate to people what I'm trying SO HARD to do. This works: definition name=page path=page.jsp/ definition name=form1 extends=page put name=body value=form1a/ definition definition name=form1a path=form_wrapper.jsp put name=form-body value=form1.jsp/ /definition So this gives me... page.jsp form_wrapper.jsp form1.jsp/ /form_wrapper.jsp /page.jsp The problem is that form1.jsp will not always be form1.jsp. I want to be able to swap that for a form2.jsp, form3.jsp, etc. Using this method, I would have to add TWO definitions into the tile-defs.xml for each new form I wanted! (form2, form2a, form3, form3a, etc) There must be a better way where I only have to add a single definition for each new form. Any ideas? Advice is much appreciated. Thanks. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help: ActionForm Re-Population
On 07/14/2003 01:25:58 PM Aaron Longwell wrote: Oops, spoke too soon. You discussed 2 options: 1) All drop-down list data goes into session 2) input attribute for the update event goes back to edit Action instead of edit JSP I went with #2 and that brings up a new issue. Doing that causes all of the current values for the fields to be lost (i.e. the user inputs a bad number format in a field they click submit and receive the JSP with a list of errors at the top) Because the process went through the edit action again, the Action re-queried the database and updated the ActionForm with database values, overwriting all the user's values (including ones that were correctly edited and contained no errors). To avoid this I have to insert code in the edit Action to check for a populated ActionForm before querying the database. This feels a little messy. Of course I could use the session solution (#1), but I like to avoid using sessions unless absolutely necessary. In addition, these drop downs could have 100's of items in them, I'd like to keep big chunks of data like that in the request. So the alternative, I guess, is to have another action that NEVER queries the database, but just prepares a blank form. I actually already have one of these... it's my create action. Aaron, this sounds like a good idea if it works for you. You can also manually validate in your save action (the action your form submits to) by doing something like: // Validate form parameters ... ActionErrors errors = yourForm.validate(mapping, request); if (errors != null !errors.isEmpty()) { saveErrors(request, errors); //do whatever you need to do to put your //drop-down list values back into the request. return new ActionForward(mapping.getInput()); }// end validate And set validate=false in your edit action mapping. Susan Bradeen This appears to be the best practice in this situation anyone else have any feedback? Thanks again, Aaron Dirk Markert wrote: Hello Aaron, *** AL I am on the last leg of a web application, and I've run into problems AL adding validation to the mix. AL I have an edit Action that retrieves a database record, a list of AL drop-down options, and then populates the editor ActionForm. Works AL great, and I LOVE STRUTS! AL Now I've implemented validation (through the Validator Framework, but I AL think my problem is with validate() in general). AL After the user clicks submit, their post is sent to my update action. AL If they do not break any validation rules, all goes well. The problem AL occurs when a validation rule is broken They are returned to the AL form... but the drop-downs (which are populated in the edit Action) AL are empty. I have set breakpoints in the code... and I see that the page AL neither my edit Action code (the part where the drop-down data is AL retrieved), nor my update Action code is actually running. AL Question between pressing submit and returning the edit JSP with a AL populated ActionErrors object. Where is validate() actually called? After the RequestProcessor has populated your action form, validate is called. This happens before your action is called. AL Where can I insert code to populate a drop-down with a set of values so AL that it will appear both when the form is presented the first time, and AL after a validation error? You have at least 2 choices. 1) You can put your drop-down values into session scope. 2) You can set the input attribute of your action mapping to your edit action. AL Thank you for your help, AL Aaron Longwell AL - AL To unsubscribe, e-mail: [EMAIL PROTECTED] AL For additional commands, e-mail: [EMAIL PROTECTED] Regards, Dirk +--- Quality leads ---+ | Dirk Markert [EMAIL PROTECTED] | | Dr. Markert Softwaretechnik AG | | Joseph-von-Fraunhofer-Str. 20 | | 44227 Dortmund | +-- to success! -+ - 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: Please Help: ActionForm Re-Population
Oops, spoke too soon. You discussed 2 options: 1) All drop-down list data goes into session 2) input attribute for the update event goes back to edit Action instead of edit JSP I went with #2 and that brings up a new issue. Doing that causes all of the current values for the fields to be lost (i.e. the user inputs a bad number format in a field they click submit and receive the JSP with a list of errors at the top) Because the process went through the edit action again, the Action re-queried the database and updated the ActionForm with database values, overwriting all the user's values (including ones that were correctly edited and contained no errors). To avoid this I have to insert code in the edit Action to check for a populated ActionForm before querying the database. This feels a little messy. Of course I could use the session solution (#1), but I like to avoid using sessions unless absolutely necessary. In addition, these drop downs could have 100's of items in them, I'd like to keep big chunks of data like that in the request. So the alternative, I guess, is to have another action that NEVER queries the database, but just prepares a blank form. I actually already have one of these... it's my create action. This appears to be the best practice in this situation anyone else have any feedback? Thanks again, Aaron Dirk Markert wrote: Hello Aaron, *** AL I am on the last leg of a web application, and I've run into problems AL adding validation to the mix. AL I have an edit Action that retrieves a database record, a list of AL drop-down options, and then populates the editor ActionForm. Works AL great, and I LOVE STRUTS! AL Now I've implemented validation (through the Validator Framework, but I AL think my problem is with validate() in general). AL After the user clicks submit, their post is sent to my update action. AL If they do not break any validation rules, all goes well. The problem AL occurs when a validation rule is broken They are returned to the AL form... but the drop-downs (which are populated in the edit Action) AL are empty. I have set breakpoints in the code... and I see that the page AL neither my edit Action code (the part where the drop-down data is AL retrieved), nor my update Action code is actually running. AL Question between pressing submit and returning the edit JSP with a AL populated ActionErrors object. Where is validate() actually called? After the RequestProcessor has populated your action form, validate is called. This happens before your action is called. AL Where can I insert code to populate a drop-down with a set of values so AL that it will appear both when the form is presented the first time, and AL after a validation error? You have at least 2 choices. 1) You can put your drop-down values into session scope. 2) You can set the input attribute of your action mapping to your edit action. AL Thank you for your help, AL Aaron Longwell AL - AL To unsubscribe, e-mail: [EMAIL PROTECTED] AL For additional commands, e-mail: [EMAIL PROTECTED] Regards, Dirk +--- Quality leads ---+ | Dirk Markert [EMAIL PROTECTED] | | Dr. Markert Softwaretechnik AG | | Joseph-von-Fraunhofer-Str. 20 | | 44227 Dortmund | +-- to success! -+ - 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: Please help a Tiles problem
Then you must be using an old pre-Struts version of Tiles. Sorry but I can't help you there. David From: Vernon [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: Please help a Tiles problem Date: Sat, 05 Apr 2003 22:26:07 -0800 Where the plug-in configuration shall go? I don't use Struts, but Tiles only. According to the document on tiles-documentation.war, the TilesServlet shall be used, if my understanding is correct. On Sat, 05 Apr 2003 16:45:59 -0700, David Graham [EMAIL PROTECTED] wrote: I noticed in your debug output that you're using TilesServlet. Are you using Struts 1.1? You don't need the TilesServlet; all you need is to configure the TilesPlugin. plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml/ /plug-in David From: Vernon [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Please help a Tiles problem Date: Sat, 05 Apr 2003 15:23:14 -0800 I start getting quite frustrated on this issue after a few days of researching on the Tiles home page, Tiles Struts home page, Struts email archive, the tiles-documentation.war, and google on Tiles. The whole development is stop at this point. I have read somewhere at the email archive: it is not need to process the initialition if the definition is stored in a JSP file, which is the case I posted my previous post. I change the definition method, using a xml file instead. After having a xml file and modification of web.xml, I get the logging message when I start/reload the applicaiton: 8242 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:301) - definitions={FRONT={name=FRONT, path=/jsp/templates/mmSig nUpLayout.jsp, role=null, controller=null, controllerType=null, controllerInstan ce=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, header=/ jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8282 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:305) - factory loaded : {FRONT={name=FRONT, path=/jsp/templates/ mmSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerI nstance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, hea der=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8292 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:269) - default factory:{FRONT={name=FRONT, path=/jsp/templates/m mSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerIn stance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, head er=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8302 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:217) - Factory initialized from file '/WEB-INF/tiles- defs.xml'. 8312 INFO [main] org.apache.struts.tiles.TilesServlet (TilesServlet.java:1 17) - Tiles Factory successfully loaded The definition seems in place. However, when I point to the url of a page, I get the following error messages: java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag.processName(InsertTag.java:527) at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:486) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:444) at org.apache.jsp.page_jsp._jspx_meth_tiles_insert_0(page_jsp.java:73) at org.apache.jsp.page_jsp._jspService(page_jsp.java:52) ... And in the translated JSP Java file, there is public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) === line 52 return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } private boolean _jspx_meth_tiles_insert_0(javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* tiles:insert
Re: Please help a Tiles problem
I start getting quite frustrated on this issue after a few days of researching on the Tiles home page, Tiles Struts home page, Struts email archive, the tiles-documentation.war, and google on Tiles. The whole development is stop at this point. I have read somewhere at the email archive: it is not need to process the initialition if the definition is stored in a JSP file, which is the case I posted my previous post. I change the definition method, using a xml file instead. After having a xml file and modification of web.xml, I get the logging message when I start/reload the applicaiton: 8242 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:301) - definitions={FRONT={name=FRONT, path=/jsp/templates/mmSig nUpLayout.jsp, role=null, controller=null, controllerType=null, controllerInstan ce=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, header=/ jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8282 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:305) - factory loaded : {FRONT={name=FRONT, path=/jsp/templates/ mmSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerI nstance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, hea der=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8292 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:269) - default factory:{FRONT={name=FRONT, path=/jsp/templates/m mSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerIn stance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, head er=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8302 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:217) - Factory initialized from file '/WEB-INF/tiles- defs.xml'. 8312 INFO [main] org.apache.struts.tiles.TilesServlet (TilesServlet.java:1 17) - Tiles Factory successfully loaded The definition seems in place. However, when I point to the url of a page, I get the following error messages: java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag.processName(InsertTag.java:527) at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:486) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:444) at org.apache.jsp.page_jsp._jspx_meth_tiles_insert_0(page_jsp.java:73) at org.apache.jsp.page_jsp._jspService(page_jsp.java:52) ... And in the translated JSP Java file, there is public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) === line 52 return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } private boolean _jspx_meth_tiles_insert_0(javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* tiles:insert */ org.apache.struts.taglib.tiles.InsertTag _jspx_th_tiles_insert_0 = (org.apache.struts.taglib.tiles.InsertTag) _jspx_tagPool_tiles_insert_name_flush.get(org.apache.struts.taglib.tiles.InsertTag.class) ; _jspx_th_tiles_insert_0.setPageContext(pageContext); _jspx_th_tiles_insert_0.setParent(null); _jspx_th_tiles_insert_0.setName(FRONT); _jspx_th_tiles_insert_0.setFlush(true); int _jspx_eval_tiles_insert_0 = _jspx_th_tiles_insert_0.doStartTag(); if (_jspx_th_tiles_insert_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return true; _jspx_tagPool_tiles_insert_name_flush.reuse(_jspx_th_tiles_insert_0); return false; } If my understanding is right, the definition of FRONT can be found. The JSP file have the following two lines: % taglib uri='/WEB-INF/tlds/struts-tiles.tld' prefix='tiles' % tiles:insert name=FRONT flush=true / What is missing here? On Fri, 04 Apr 2003 07:01:55 -0800,
Re: Please help a Tiles problem
I noticed in your debug output that you're using TilesServlet. Are you using Struts 1.1? You don't need the TilesServlet; all you need is to configure the TilesPlugin. plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml/ /plug-in David From: Vernon [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Please help a Tiles problem Date: Sat, 05 Apr 2003 15:23:14 -0800 I start getting quite frustrated on this issue after a few days of researching on the Tiles home page, Tiles Struts home page, Struts email archive, the tiles-documentation.war, and google on Tiles. The whole development is stop at this point. I have read somewhere at the email archive: it is not need to process the initialition if the definition is stored in a JSP file, which is the case I posted my previous post. I change the definition method, using a xml file instead. After having a xml file and modification of web.xml, I get the logging message when I start/reload the applicaiton: 8242 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:301) - definitions={FRONT={name=FRONT, path=/jsp/templates/mmSig nUpLayout.jsp, role=null, controller=null, controllerType=null, controllerInstan ce=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, header=/ jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8282 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:305) - factory loaded : {FRONT={name=FRONT, path=/jsp/templates/ mmSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerI nstance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, hea der=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8292 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:269) - default factory:{FRONT={name=FRONT, path=/jsp/templates/m mSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerIn stance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, head er=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8302 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:217) - Factory initialized from file '/WEB-INF/tiles- defs.xml'. 8312 INFO [main] org.apache.struts.tiles.TilesServlet (TilesServlet.java:1 17) - Tiles Factory successfully loaded The definition seems in place. However, when I point to the url of a page, I get the following error messages: java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag.processName(InsertTag.java:527) at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:486) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:444) at org.apache.jsp.page_jsp._jspx_meth_tiles_insert_0(page_jsp.java:73) at org.apache.jsp.page_jsp._jspService(page_jsp.java:52) ... And in the translated JSP Java file, there is public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) === line 52 return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } private boolean _jspx_meth_tiles_insert_0(javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* tiles:insert */ org.apache.struts.taglib.tiles.InsertTag _jspx_th_tiles_insert_0 = (org.apache.struts.taglib.tiles.InsertTag) _jspx_tagPool_tiles_insert_name_flush.get(org.apache.struts.taglib.tiles.InsertTag.class) ; _jspx_th_tiles_insert_0.setPageContext(pageContext); _jspx_th_tiles_insert_0.setParent(null); _jspx_th_tiles_insert_0.setName(FRONT); _jspx_th_tiles_insert_0.setFlush(true
Re: Please help a Tiles problem
Where the plug-in configuration shall go? I don't use Struts, but Tiles only. According to the document on tiles-documentation.war, the TilesServlet shall be used, if my understanding is correct. On Sat, 05 Apr 2003 16:45:59 -0700, David Graham [EMAIL PROTECTED] wrote: I noticed in your debug output that you're using TilesServlet. Are you using Struts 1.1? You don't need the TilesServlet; all you need is to configure the TilesPlugin. plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml/ /plug-in David From: Vernon [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Please help a Tiles problem Date: Sat, 05 Apr 2003 15:23:14 -0800 I start getting quite frustrated on this issue after a few days of researching on the Tiles home page, Tiles Struts home page, Struts email archive, the tiles-documentation.war, and google on Tiles. The whole development is stop at this point. I have read somewhere at the email archive: it is not need to process the initialition if the definition is stored in a JSP file, which is the case I posted my previous post. I change the definition method, using a xml file instead. After having a xml file and modification of web.xml, I get the logging message when I start/reload the applicaiton: 8242 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:301) - definitions={FRONT={name=FRONT, path=/jsp/templates/mmSig nUpLayout.jsp, role=null, controller=null, controllerType=null, controllerInstan ce=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, header=/ jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8282 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:305) - factory loaded : {FRONT={name=FRONT, path=/jsp/templates/ mmSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerI nstance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, hea der=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8292 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:269) - default factory:{FRONT={name=FRONT, path=/jsp/templates/m mSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerIn stance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, head er=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}} } 8302 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n FactorySet.java:217) - Factory initialized from file '/WEB-INF/tiles- defs.xml'. 8312 INFO [main] org.apache.struts.tiles.TilesServlet (TilesServlet.java:1 17) - Tiles Factory successfully loaded The definition seems in place. However, when I point to the url of a page, I get the following error messages: java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag.processName(InsertTag.java:527) at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:486) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:444) at org.apache.jsp.page_jsp._jspx_meth_tiles_insert_0(page_jsp.java:73) at org.apache.jsp.page_jsp._jspService(page_jsp.java:52) ... And in the translated JSP Java file, there is public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) === line 52 return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } private boolean _jspx_meth_tiles_insert_0(javax.servlet.jsp.PageContext pageContext) throws Throwable { JspWriter out = pageContext.getOut(); /* tiles:insert */ org.apache.struts.taglib.tiles.InsertTag _jspx_th_tiles_insert_0 = (org.apache.struts.taglib.tiles.InsertTag) _jspx_tagPool_tiles_insert_name_flush.get(org.apache.struts.taglib.tiles.InsertTag.class) ; _jspx_th_tiles_insert_0.setPageContext(pageContext); _jspx_th_tiles_insert_0.setParent
Re: Please help a Tiles problem
The error message says that the definition factory is not found. Have you initialized the tile plugin ? Cedric Vernon wrote: 1. The error message: root cause javax.servlet.ServletException: Can't get definitions factory from context. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533) at org.apache.jsp.page_jsp._jspService(page_jsp.java:189) 2. The translated JSP file public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n); out.write(\r\n); out.write(\r\n\r\n); if (_jspx_meth_c_if_0(pageContext)) return; out.write(\r\n); if (_jspx_meth_c_if_1(pageContext)) return; // ... out.write(\r\n); if (_jspx_meth_c_if_37(pageContext)) return; out.write(\r\n\r\n\r\n\r\n\r\n\r\n\r\n); out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); line 189 } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } 3. The JSP file with the definitions % taglib prefix=tiles uri=/WEB-INF/tlds/struts-tiles.tld % % taglib prefix=c uri=/WEB-INF/tlds/c.tld % c:if test=${empty applicationScope.FRONT} tiles:definition id=FRONT template=/jsp/templates/myLayout.jsp put name=title value=Front Page / put name=header value=/jsp/signon/header.jsp / put name=footer value=/jsp/homepage/footer.jsp / put name=body value=/jsp/frontpage/content.jsp / /tiles:definition /c:if c:if test=${empty applicationScope.SIGNON} tiles:definition id=SIGNON extends=FRONT put name=title value=Sign On / put name=body value=/jsp/signon/content.jsp / /tiles:definition /c:if !-- -- If I erase all defintions, but keep the first one, the attributes wouldn't loaded. The Tiles is from http://www.lifl.fr/~dumoulin/tiles/. I don't have any JSP debugging tool. Can someone please tell me where is wrong or how to find out the cause. Vernon - 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: Please help a Tiles problem
Thanks very much for your information, Cedric. I have read through the Tiles related articles linked to the Struts-Tiles page, and have not seen the plug in procedure for standalone usage. A plugin procedure, I find, is on the following page http://www.onjava.com/pub/a/onjava/excerpt/progjakstruts_14/index2.html. It is about Struts. I don't use Struts however. How I initialize the Tiles? On Fri, 04 Apr 2003 10:12:48 +0200, Cedric Dumoulin [EMAIL PROTECTED] wrote: The error message says that the definition factory is not found. Have you initialized the tile plugin ? Cedric Vernon wrote: 1. The error message: root cause javax.servlet.ServletException: Can't get definitions factory from context. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533) at org.apache.jsp.page_jsp._jspService(page_jsp.java:189) 2. The translated JSP file public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n); out.write(\r\n); out.write(\r\n\r\n); if (_jspx_meth_c_if_0(pageContext)) return; out.write(\r\n); if (_jspx_meth_c_if_1(pageContext)) return; // ... out.write(\r\n); if (_jspx_meth_c_if_37(pageContext)) return; out.write(\r\n\r\n\r\n\r\n\r\n\r\n\r\n); out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); line 189 } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } 3. The JSP file with the definitions % taglib prefix=tiles uri=/WEB-INF/tlds/struts-tiles.tld % % taglib prefix=c uri=/WEB-INF/tlds/c.tld % c:if test=${empty applicationScope.FRONT} tiles:definition id=FRONT template=/jsp/templates/myLayout.jsp put name=title value=Front Page / put name=header value=/jsp/signon/header.jsp / put name=footer value=/jsp/homepage/footer.jsp / put name=body value=/jsp/frontpage/content.jsp / /tiles:definition /c:if c:if test=${empty applicationScope.SIGNON} tiles:definition id=SIGNON extends=FRONT put name=title value=Sign On / put name=body value=/jsp/signon/content.jsp / /tiles:definition /c:if !-- -- If I erase all defintions, but keep the first one, the attributes wouldn't loaded. The Tiles is from http://www.lifl.fr/~dumoulin/tiles/. I don't have any JSP debugging tool. Can someone please tell me where is wrong or how to find out the cause. Vernon - 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] -- Vernon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please help no getter method nightmare
I partially solved this error writing html-el:form action=/main name=chooseAgendaForm type=com.wingstech.webappointments.ChooseAgendaForm but why does this work only with this deprecated solution??? Thanks in advance, kiuma kiuma ha scritto: Hi all, I've a big problem in my project: I can't add any getter method in any new form since on every jsp form i get back message. javax.servlet.jsp.JspException: No getter method for property fooProp of bean org.apache.struts.taglib.html.BEAN I tryed with several foms (also the famous FooForm), but the result is always the same. I attach my struts-config.xml file. The thing I really can't understand is that all forms perfectly work except the one defined in /chooseAgenda action or those created from scratch and inserted (no matter the position). Please I really need help !! kiuma ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config form-beans form-bean name=userForm type=com.wingstech.webappointments.ChkForm / form-bean name=listedCustomerForm type=com.wingstech.webappointments.ListedCustomerForm / form-bean name=customerEditForm type=com.wingstech.webappointments.CustomerEditForm / form-bean name=listedUserForm type=com.wingstech.webappointments.ListedUserForm / form-bean name=userEditForm type=com.wingstech.webappointments.UserEditForm / form-bean name=listedCalendarForm type=com.wingstech.webappointments.ListedCalendarForm / form-bean name=calendarEditForm type=com.wingstech.webappointments.CalendarEditForm / form-bean name=wwDayEditForm type=com.wingstech.webappointments.WwDayEditForm / form-bean name=holydayEditForm type=com.wingstech.webappointments.HolydayEditForm / form-bean name=listedSpecialitiesForm type=com.wingstech.webappointments.ListedSpecialitiesForm / form-bean name=specialityEditForm type=com.wingstech.webappointments.SpecialityEditForm / form-bean name=activityEditForm type=com.wingstech.webappointments.ActivityEditForm / form-bean name=listedActivCentersForm type=com.wingstech.webappointments.ListedActivCentersForm / form-bean name=activCenterEditForm type=com.wingstech.webappointments.ActivCenterEditForm / form-bean name=specialityViewForm type=com.wingstech.webappointments.SpecialityViewForm / form-bean name=activityViewForm type=com.wingstech.webappointments.ActivityViewForm / form-bean name=activityCenterViewForm type=com.wingstech.webappointments.ActivityCenterViewForm / form-bean name=freeAgendaViewForm type=com.wingstech.webappointments.FreeAgendaViewForm / form-bean name=customerAppendBookForm type=com.wingstech.webappointments.CustomerAppendBookForm / form-bean name=bookViewForm type=com.wingstech.webappointments.BookViewForm / form-bean name=chooseAgendaForm type=com.wingstech.webappointments.ChooseAgendaForm / /form-beans !-- == Global Forward Definitions == -- global-forwards forward name=index path=/index.jsp / forward name=SystemError path=/error.html / /global-forwards !-- == Action Mapping Definitions == -- action-mappings !-- Customer -- action path=/openCustomerList type=org.apache.struts.actions.ForwardAction name=listedCustomerForm parameter=/secure/customerlist.jsp input=/index.jsp validate=false /action action name=listedCustomerForm input=/secure/customerlist.jsp path=/listedCustomer type=com.wingstech.webappointments.ListedCustomerAction parameter=action validate=false forward name=Success path=/secure/customerlist.jsp redirect=true / forward name=CustomerAppend path=/openCustomerEdit.do?id= redirect=true / /action action path=/openCustomerEdit name=customerEditForm input=/secure/customeredit.jsp type=com.wingstech.webappointments.OpenCustomerEditAction validate=false forward name=Success path=/secure/customeredit.jsp redirect=true / forward name=Failure path=/secure/customerlist.jsp redirect=true / /action action path=/customerPostChanges name=customerEditForm input=/secure/customeredit.jsp type=com.wingstech.webappointments.CustomerEditAction validate=true forward name=Success path=/listedCustomer.do?id= redirect=true / forward name=Failure path=/secure/customeredit.jsp redirect=true / /action !-- User -- action path=/openUserList type=org.apache.struts.actions.ForwardAction name=listedUserForm parameter=/secure/userlist.jsp input=/index.jsp validate=false /action
Re: Please Help! Nested form property attributes.
On Monday, January 6, 2003, 12:44:38 PM, Paul wrote: PI rootCause PI java.lang.IllegalArgumentException: argument type mismatch at PI sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at PI sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 snip PI What do I do? enrollDate should be a String in your formBean. Are you sure you aren't trying setting enrollDate as a Date type in your form bean? I cc'd Samir as well, since I think he is having similar problems. I think it's nice and clean to deal with Dates in forms this way: 1) Have a form bean with all Strings representing your jsp form. So something like birthDate would be set up as a String. 2) Have a business bean with the correct data types. For example.. java.util.Date birthDate, double someNumber, etc. 3) When you submit your jsp page to your action you can take care of the conversion of the FormBean(all Strings) to the correct data types and populate your business bean (usually called a DTO or ValueObject). Similarly, when going the other direction you can take a business bean and convert the Date fields into Strings (with the format you like) and populate your FormBean and display that to the user. As far as doing the conversion I usually take care of that outside of the Action and use the BeanUtils.copyProperties(..) but you can also just create your own helper class to do the conversions for you if you like. -- Rick mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Please Help! Nested form property attributes.
I modified the formbean and action class to accept a date string and it work Thanks Thanks Thanks. Sincerely, Paul Idusogie Email: [EMAIL PROTECTED] Tel: 651.714.8779 -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 12:42 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Cc: Samir Shah Subject: Re: Please Help! Nested form property attributes. On Monday, January 6, 2003, 12:44:38 PM, Paul wrote: PI rootCause PI java.lang.IllegalArgumentException: argument type mismatch at PI sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at PI sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 snip PI What do I do? enrollDate should be a String in your formBean. Are you sure you aren't trying setting enrollDate as a Date type in your form bean? I cc'd Samir as well, since I think he is having similar problems. I think it's nice and clean to deal with Dates in forms this way: 1) Have a form bean with all Strings representing your jsp form. So something like birthDate would be set up as a String. 2) Have a business bean with the correct data types. For example.. java.util.Date birthDate, double someNumber, etc. 3) When you submit your jsp page to your action you can take care of the conversion of the FormBean(all Strings) to the correct data types and populate your business bean (usually called a DTO or ValueObject). Similarly, when going the other direction you can take a business bean and convert the Date fields into Strings (with the format you like) and populate your FormBean and display that to the user. As far as doing the conversion I usually take care of that outside of the Action and use the BeanUtils.copyProperties(..) but you can also just create your own helper class to do the conversions for you if you like. -- Rick 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: Please help! More nested tag trouble with DynaValidatorForm!
Gemes Tibor wrote: 2002-11-30, szo keltezssel Seth Milder ezt rta: Does anyone have a workaround? Am I doing some stupid thing here? The dot separator is for subbeans' properties. It follows the commons beanutils' PropertyUtils notation. http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/PropertyUtils.html Hth Tib I figured out a workaround for my problem. I looked at the link you provided and I just wanted to thank you for it. The above has greatly simplified my code. -- Seth Milder Department of Physics and Astronomy MS 3f3 George Mason University Fairfax, VA http://www.mrseth.org -- The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts. --Bertrand Russell -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Please help! More nested tag trouble with DynaValidatorForm!
2002-11-30, szo keltezssel Seth Milder ezt rta: Does anyone have a workaround? Am I doing some stupid thing here? The dot separator is for subbeans' properties. It follows the commons beanutils' PropertyUtils notation. http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/PropertyUtils.html Hth Tib -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: PLEASE HELP - struts-tiles no longer work
Micael, Thanks for your help! I corrected my mistake by using the String equals() method, and it works fine. Tuan -Original Message- From: micael [mailto:caraunltd;harbornet.com] Sent: Saturday, October 19, 2002 12:21 AM To: Struts Users Mailing List Subject: Re: PLEASE HELP - struts-tiles no longer work I don't know, but my guess is that you meant to use someString.equals(someOtherString) rather than someString == someOtherString, unless you somehow are using a hidden myString.intern() in there. My guess, in other words, is that you are getting nothing because all your == tests yield false. Try sticking a ! or two in there and see if something miraculously appears. Debuggers are not very clever at finding the real problems, like this one, if this is right. At 12:03 AM 10/19/2002 -0700, you wrote: Why don't you look at the source? My guess is that if you are looking at a blank page, the page, except for tags, is blank. At 08:41 PM 10/18/2002 -0700, you wrote: Hi, My app was working fine using struts-tiles with frameset. But since this afternoon, it does not work any more. It displays a blank page (NOT a 404 error). I have tried with debug code, but couldn't figure out. The action forward seems to work fine after the user login. I tested and it forwarded to the right View (JSP) which is the MainMenu.jsp. I have been debugging this issue for the last 5 hrs, and I ran out of idea where to look for a solution to this problem. Please help! Thanks, Tuan ** MainMenu.jsp *** % page import=com.phs.ezhr.constant.IConstants % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); % % if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { % tiles:insert definition=summaryLayout flush=true / % } ** Layout.jsp % page language=java % % taglib uri=/WEB-INF/struts-html.tld prefix=html % % taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % taglib uri=/WEB-INF/struts-logic.tld prefix=logic % % page import=com.phs.ezhr.constant.IConstants % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); // set the frameset row heights for each tab header String rh1 = null; String rh2 = *; String rh3 = null; String cw1 = null; String cw2 = *; if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { rh1 = 99; rh3 = 55; cw1 = 95%; } else if ( selTab == IConstants.SALARY_TAB ) { rh1 = 201; rh3 = 125; cw1 = 97%; } else if ( selTab == IConstants.BONUS_TAB ) { rh1 = 229; rh3 = 125; cw1 = 95%; } % !-- FOR DEBUG PURPOSE ONLY == GOT CORRECT DATA RETURNED HERE -- %=request.getContextPath()%tiles:getAsString name=header /BR %=request.getContextPath()%tiles:getAsString name=body /BR %=request.getContextPath()%tiles:getAsString name=rightSide /BR %=request.getContextPath()%tiles:getAsString name=footer /BR Select Tab = %= selTab %BR !-- END DEBUG -- !-- frame -- ' name=header id=top frameborder=0 scrolling=no noresize marginwidth=0 marginheight=0 framespacing=0 ' name=body marginwidth=0 marginheight=0 scrolling=yes frameborder=0 noresize framespacing=0 ' name=rightSide marginwidth=10 marginheight=10 scrolling=no frameborder=0 noresize framespacing=0 ' name=footer id=bottom frameborder=0 scrolling=no marginwidth=0 marginheight=0 noresize framespacing=0 *** tiles-definitions.xml * ?xml version=1.0 encoding=ISO-8859-1 ? -- To unsubscribe, e-mail: For additional commands, e-mail: Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org Micael --- This electronic mail transmission and any accompanying documents contain
RE: PLEASE HELP - struts-tiles no longer work
The debug code below returned the correct paths to JSP pages for header, body, rightside and footer, but none of them get displayed. It returns a blank page. %=request.getContextPath()%tiles:getAsString name=header /BR %=request.getContextPath()%tiles:getAsString name=body /BR %=request.getContextPath()%tiles:getAsString name=rightSide /BR %=request.getContextPath()%tiles:getAsString name=footer /BR Thanks! Tuan -Original Message- From: Tuan H. Le Sent: Friday, October 18, 2002 8:41 PM To: Struts Users Mailing List (E-mail) Subject: PLEASE HELP - struts-tiles no longer work Hi, My app was working fine using struts-tiles with frameset. But since this afternoon, it does not work any more. It displays a blank page (NOT a 404 error). I have tried with debug code, but couldn't figure out. The action forward seems to work fine after the user login. I tested and it forwarded to the right View (JSP) which is the MainMenu.jsp. I have been debugging this issue for the last 5 hrs, and I ran out of idea where to look for a solution to this problem. Please help! Thanks, Tuan ** MainMenu.jsp *** % page import=com.phs.ezhr.constant.IConstants % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); % % if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { % tiles:insert definition=summaryLayout flush=true / % } ** Layout.jsp % page language=java % % taglib uri=/WEB-INF/struts-html.tld prefix=html % % taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % taglib uri=/WEB-INF/struts-logic.tld prefix=logic % % page import=com.phs.ezhr.constant.IConstants % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); // set the frameset row heights for each tab header String rh1 = null; String rh2 = *; String rh3 = null; String cw1 = null; String cw2 = *; if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { rh1 = 99; rh3 = 55; cw1 = 95%; } else if ( selTab == IConstants.SALARY_TAB ) { rh1 = 201; rh3 = 125; cw1 = 97%; } else if ( selTab == IConstants.BONUS_TAB ) { rh1 = 229; rh3 = 125; cw1 = 95%; } % !-- FOR DEBUG PURPOSE ONLY == GOT CORRECT DATA RETURNED HERE -- %=request.getContextPath()%tiles:getAsString name=header /BR %=request.getContextPath()%tiles:getAsString name=body /BR %=request.getContextPath()%tiles:getAsString name=rightSide /BR %=request.getContextPath()%tiles:getAsString name=footer /BR Select Tab = %= selTab %BR !-- END DEBUG -- !-- frame -- html:html HEAD html:base/ TITLEbean:message key=app.label.title //TITLE /HEAD frameset rows=%=rh1%,%=rh2%,%=rh3% frameborder=0 noresize framespacing=0 frame src='%=request.getContextPath()%tiles:getAsString name=header/' name=header id=top frameborder=0 scrolling=no noresize marginwidth=0 marginheight=0 framespacing=0 frameset cols=%=cw1%,%=cw2% framespacing=0 frame src='%=request.getContextPath()%tiles:getAsString name=body/' name=body marginwidth=0 marginheight=0 scrolling=yes frameborder=0 noresize framespacing=0 frame src='%=request.getContextPath()%tiles:getAsString name=rightSide/' name=rightSide marginwidth=10 marginheight=10 scrolling=no frameborder=0 noresize framespacing=0 /frameset frame src='%=request.getContextPath()%tiles:getAsString name=footer/' name=footer id=bottom frameborder=0 scrolling=no marginwidth=0 marginheight=0 noresize framespacing=0 /frameset noframes bean:message key=app.msg.noframe / /noframes /html:html *** tiles-definitions.xml * ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration//EN http://jakarta.apache.org/struts/dtds/tiles-config.dtd; !-- Definitions for Tiles documentation -- tiles-definitions !-- === -- !-- Master definition -- !-- === -- definition name=summaryLayout path=/Layout.jsp put name=title value=Online Focal Tool Application/ put name=header value=/Header.jsp/ put name=footer value=/Footer.jsp/ put name=body value=/ManagerSummaryContent.jsp/ put name=rightSide
Re: PLEASE HELP - struts-tiles no longer work
Why don't you look at the source? My guess is that if you are looking at a blank page, the page, except for tags, is blank. At 08:41 PM 10/18/2002 -0700, you wrote: Hi, My app was working fine using struts-tiles with frameset. But since this afternoon, it does not work any more. It displays a blank page (NOT a 404 error). I have tried with debug code, but couldn't figure out. The action forward seems to work fine after the user login. I tested and it forwarded to the right View (JSP) which is the MainMenu.jsp. I have been debugging this issue for the last 5 hrs, and I ran out of idea where to look for a solution to this problem. Please help! Thanks, Tuan ** MainMenu.jsp *** % page import=com.phs.ezhr.constant.IConstants % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); % % if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { % tiles:insert definition=summaryLayout flush=true / % } ** Layout.jsp % page language=java % % taglib uri=/WEB-INF/struts-html.tld prefix=html % % taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % taglib uri=/WEB-INF/struts-logic.tld prefix=logic % % page import=com.phs.ezhr.constant.IConstants % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); // set the frameset row heights for each tab header String rh1 = null; String rh2 = *; String rh3 = null; String cw1 = null; String cw2 = *; if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { rh1 = 99; rh3 = 55; cw1 = 95%; } else if ( selTab == IConstants.SALARY_TAB ) { rh1 = 201; rh3 = 125; cw1 = 97%; } else if ( selTab == IConstants.BONUS_TAB ) { rh1 = 229; rh3 = 125; cw1 = 95%; } % !-- FOR DEBUG PURPOSE ONLY == GOT CORRECT DATA RETURNED HERE -- %=request.getContextPath()%tiles:getAsString name=header /BR %=request.getContextPath()%tiles:getAsString name=body /BR %=request.getContextPath()%tiles:getAsString name=rightSide /BR %=request.getContextPath()%tiles:getAsString name=footer /BR Select Tab = %= selTab %BR !-- END DEBUG -- !-- frame -- ' name=header id=top frameborder=0 scrolling=no noresize marginwidth=0 marginheight=0 framespacing=0 ' name=body marginwidth=0 marginheight=0 scrolling=yes frameborder=0 noresize framespacing=0 ' name=rightSide marginwidth=10 marginheight=10 scrolling=no frameborder=0 noresize framespacing=0 ' name=footer id=bottom frameborder=0 scrolling=no marginwidth=0 marginheight=0 noresize framespacing=0 *** tiles-definitions.xml * ?xml version=1.0 encoding=ISO-8859-1 ? -- To unsubscribe, e-mail: For additional commands, e-mail: Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: PLEASE HELP - struts-tiles no longer work
I don't know, but my guess is that you meant to use someString.equals(someOtherString) rather than someString == someOtherString, unless you somehow are using a hidden myString.intern() in there. My guess, in other words, is that you are getting nothing because all your == tests yield false. Try sticking a ! or two in there and see if something miraculously appears. Debuggers are not very clever at finding the real problems, like this one, if this is right. At 12:03 AM 10/19/2002 -0700, you wrote: Why don't you look at the source? My guess is that if you are looking at a blank page, the page, except for tags, is blank. At 08:41 PM 10/18/2002 -0700, you wrote: Hi, My app was working fine using struts-tiles with frameset. But since this afternoon, it does not work any more. It displays a blank page (NOT a 404 error). I have tried with debug code, but couldn't figure out. The action forward seems to work fine after the user login. I tested and it forwarded to the right View (JSP) which is the MainMenu.jsp. I have been debugging this issue for the last 5 hrs, and I ran out of idea where to look for a solution to this problem. Please help! Thanks, Tuan ** MainMenu.jsp *** % page import=com.phs.ezhr.constant.IConstants % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); % % if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { % tiles:insert definition=summaryLayout flush=true / % } ** Layout.jsp % page language=java % % taglib uri=/WEB-INF/struts-html.tld prefix=html % % taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % % taglib uri=/WEB-INF/struts-logic.tld prefix=logic % % page import=com.phs.ezhr.constant.IConstants % % // get the user's selected navigation String selTab = (String)session.getAttribute( IConstants.USER_SEL_TAB_KEY ); String selSubTab = (String)session.getAttribute( IConstants.USER_SEL_SUBTAB_KEY ); // set the frameset row heights for each tab header String rh1 = null; String rh2 = *; String rh3 = null; String cw1 = null; String cw2 = *; if ( selTab == IConstants.MANAGER_SUMMARY_TAB ) { rh1 = 99; rh3 = 55; cw1 = 95%; } else if ( selTab == IConstants.SALARY_TAB ) { rh1 = 201; rh3 = 125; cw1 = 97%; } else if ( selTab == IConstants.BONUS_TAB ) { rh1 = 229; rh3 = 125; cw1 = 95%; } % !-- FOR DEBUG PURPOSE ONLY == GOT CORRECT DATA RETURNED HERE -- %=request.getContextPath()%tiles:getAsString name=header /BR %=request.getContextPath()%tiles:getAsString name=body /BR %=request.getContextPath()%tiles:getAsString name=rightSide /BR %=request.getContextPath()%tiles:getAsString name=footer /BR Select Tab = %= selTab %BR !-- END DEBUG -- !-- frame -- ' name=header id=top frameborder=0 scrolling=no noresize marginwidth=0 marginheight=0 framespacing=0 ' name=body marginwidth=0 marginheight=0 scrolling=yes frameborder=0 noresize framespacing=0 ' name=rightSide marginwidth=10 marginheight=10 scrolling=no frameborder=0 noresize framespacing=0 ' name=footer id=bottom frameborder=0 scrolling=no marginwidth=0 marginheight=0 noresize framespacing=0 *** tiles-definitions.xml * ?xml version=1.0 encoding=ISO-8859-1 ? -- To unsubscribe, e-mail: For additional commands, e-mail: Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the
RE: Please help decide a religious discussion
+1 on initializing static data at application start up time and caching it. In addition we found that putting the Collection directly into some scope with a well defined Constant.KEY_XXX was much better in the long run as opposed to trying to put in the form bean. This way the control on the page only needs to know the name of the collection but not where to get it. Why not just populate the form with the collection and use the nested tags to render the data from the form. This way you don't have to manage any attribute keys and the nested control only needs to know which property to access. robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 11:38 AM To: Struts Users Mailing List Subject: RE: Please help decide a religious discussion We have done alot of this and have tried many things. In our case, If possible all of our static lists (provinces ect) are loaded at application startup and put into application scope. The plug-in's are great for this but there are many other ways. If the lists are User specific, they go into session. And as a last resort if they are required at request time, they are absolutely put in the LoadAction for that page. In the case of validation we route back to the LoadAction and not the page. The only problem is that this forces us to consider when to pre-populate the form fields from the backend or let them be prepopulate from the request(in the case of a bad validation). There is usally some type of a flag in the page that will let us know what state the page is in. In addition we found that putting the Collection directly into some scope with a well defined Constant.KEY_XXX was much better in the long run as opposed to trying to put in the form bean. This way the control on the page only needs to know the name of the collection but not where to get it. As well we now use LabelValueBeans for every list. just my 2 canadian cents. Andrew Hill [EMAIL PROTECTED] on 09/27/2002 10:04:00 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To:Struts Users Mailing List [EMAIL PROTECTED] cc: Subject:RE: Please help decide a religious discussion Well if the Action is needed to populate the drop-downs (these values being in request scope I presume?) then after the form is submitted and validation has failed, you will need to reload these values. If you are loading the values in an action you will need to go through that action. (The other alternative is to store the info in session scope, but that creates the potential problem of knowing when to get rid of it) Perhaps the idea might be to have an action whose sole responsibility is to populate the drop-downs and instead of forwarding directly to the view, you go through this one first and it forwards you to the view after populating the drop-downs. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:54 To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: RE: Please help decide a religious discussion If I do that, will validation always go to the action class, even when it fails? Steve Andrew Hill andrew.david.hill@gri To: Struts Users Mailing List [EMAIL PROTECTED] dnode.com cc: Subject: RE: Please help decide a religious discussion 09/27/2002 09:50 AM Please respond to Struts Users Mailing List Sounds like you need to define the action and not the jsp as your input in struts-config. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:40 To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list
RE: Please help with iteration problem
There was a bug in 4.1.10 Jasper that did not compile the nested iterate tags - it has been fixed. Try 4.1.12 - I have a three deep nested iterate and it works on 4.1.12. Cal http://www.calandva.com/ -Original Message- From: Michael Bowman [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 26, 2002 19:48 To: Struts Users Mailing List Subject: Re: Please help with iteration problem Correction, it seems that the version of Tomcat doesn't matter after all. A JSP with nested logic:iterate tags worked before, but not now. Maybe it was with an earlier version of Struts. Does anyone know if the behavior of logic:iterate changed with respect to nesting the tags between Struts 1.0 and Struts 1.1b? On Thu, 26 Sep 2002 19:02:19 -0400 Michael Bowman [EMAIL PROTECTED] wrote: One further complication: I found that nested logic:iterate tags work on Tomcat 4.0.3, but not on Tomcat 4.1.10. Thats kind of weird. I don't see the struts-el tags listed on the Struts Resources/Contributor Taglibs page. Can you tell me where to find them? Thanks. On Thu, 26 Sep 2002 17:48:30 -0500 Eddie Bush [EMAIL PROTECTED] wrote: Find out about, download, install, and use the new contributed taglib struts-el. Michael Bowman wrote: Thanks for the reply. I'm going to try it. As a matter of fact, I do have IDs that I'm using for the segments and objects contained within the segments. I want to use html:link tags within the loops to build links displaying various information about these objects. Do you know if I can use Struts tags inside of the JSTL tags? If the JSTL tags just put beans in some scope, will the Struts tags know any difference? On Thu, 26 Sep 2002 15:20:45 -0500 Eddie Bush [EMAIL PROTECTED] wrote: c:set var=routes value=${pageScope['routesKey']}/ - or - c:set var=routes value=${requestScope['routesKey']}/ - or - c:set var=routes value=${sessionScope['routesKey']}/ - or - c:set var=routes value=${applicationScope['routesKey']}/ Do I need the above if I put the java.util.List on the request object in my Struts Action class prior to forwarding to the JSP? No. You could reference it as ${requestScope['key']} I believe. In fact ... *ponder* ... you could possible access it by ${key}. I think that may work too. I always go through the scope ... -- Eddie Bush -- 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: Please help decide a religious discussion
The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Please help decide a religious discussion
+1 David Graham wrote: The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave -- Eddie Bush -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Please help decide a religious discussion
That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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: Please help decide a religious discussion
Put the list of objects to go in your select box in the session. Your jsp will use that session attribute to populate the select box, either using a struts tag or anything else. Your ActionForm only needs a String variable to hold the one option the user selected (for multiple selects I assume you'll need a String array). The ActionForm doesn't actually hold all of the choices just the selected value. Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:40:07 -0500 That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Please help decide a religious discussion
Sounds like you need to define the action and not the jsp as your input in struts-config. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:40 To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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: Please help decide a religious discussion
Wait a minute. Is this the current setup? Action-A (does stuff, preps form-B for page-B) -- Forward to Page-B -- User does stuff and submits -- Validation of form-B fails -- Page-B re-displayed but with empty selects? Hard to believe! I say so because the population of the selects is done by the business logic invoked by Action-A which is no longer in the picture. All that your validate should be doing is *test* the data and set ActionErrors if necessary. Make sure you aren't wiping out your collections. Sri -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 10:40 AM To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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: Please help decide a religious discussion
If I do that, will validation always go to the action class, even when it fails? Steve Andrew Hill andrew.david.hill@gri To: Struts Users Mailing List [EMAIL PROTECTED] dnode.com cc: Subject: RE: Please help decide a religious discussion 09/27/2002 09:50 AM Please respond to Struts Users Mailing List Sounds like you need to define the action and not the jsp as your input in struts-config. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:40 To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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: Please help decide a religious discussion
No, it is a little different. The user calls Page-A --- form-A is instantiated ---action-A is run and the execute method is called, prepopulating the drop downs -- the user does stuff and submits -- Validation of form-A fails and does not go to Action-A -- Page-A re-displayed, but with empty drop downs I hope this helps. Steve Sri Sankaran Sri.Sankaran@ To: Struts Users Mailing List [EMAIL PROTECTED] sas.com cc: Subject: RE: Please help decide a religious discussion 09/27/2002 09:51 AM Please respond to Struts Users Mailing List Wait a minute. Is this the current setup? Action-A (does stuff, preps form-B for page-B) -- Forward to Page-B -- User does stuff and submits -- Validation of form-B fails -- Page-B re-displayed but with empty selects? Hard to believe! I say so because the population of the selects is done by the business logic invoked by Action-A which is no longer in the picture. All that your validate should be doing is *test* the data and set ActionErrors if necessary. Make sure you aren't wiping out your collections. Sri -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 10:40 AM To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional
RE: Please help decide a religious discussion
Well if the Action is needed to populate the drop-downs (these values being in request scope I presume?) then after the form is submitted and validation has failed, you will need to reload these values. If you are loading the values in an action you will need to go through that action. (The other alternative is to store the info in session scope, but that creates the potential problem of knowing when to get rid of it) Perhaps the idea might be to have an action whose sole responsibility is to populate the drop-downs and instead of forwarding directly to the view, you go through this one first and it forwards you to the view after populating the drop-downs. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:54 To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: RE: Please help decide a religious discussion If I do that, will validation always go to the action class, even when it fails? Steve Andrew Hill andrew.david.hill@gri To: Struts Users Mailing List [EMAIL PROTECTED] dnode.com cc: Subject: RE: Please help decide a religious discussion 09/27/2002 09:50 AM Please respond to Struts Users Mailing List Sounds like you need to define the action and not the jsp as your input in struts-config. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:40 To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Please help decide a religious discussion
Drop down list data should be cached, if data is not updated dynamicly. With Struts, if you are using Tiles, you can created a drop down list components get the list data from cache via controller class. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 7:50 AM To: Struts Users Mailing List Subject: RE: Please help decide a religious discussion Sounds like you need to define the action and not the jsp as your input in struts-config. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 22:40 To: Struts Users Mailing List Subject: Re: Please help decide a religious discussion That is what we are doing now. It goes through a controller to the database, but we are using the validator and when an error occurs, the form does not go to the Action class and the helper methods are not called and as a result, the drop downs are empty. Steve David Graham dgraham1980@ho To: [EMAIL PROTECTED] tmail.comcc: Subject: Re: Please help decide a religious discussion 09/27/2002 09:17 AM Please respond to Struts Users Mailing List The Action class...but the action should be asking a helper object for a list of whatever goes in your drop down. It shouldn't know about the database directly. So you might have in your action.execute(): List list = StateHelper.getStateList(); // put list in your form Dave From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Please help decide a religious discussion Date: Fri, 27 Sep 2002 09:13:35 -0500 All, My team is currently at loggerheads about the correct place to put the database calls that are prepopulating our drop downs. We can not decide if they should be in the ActionForm or in the Action class. We are trying to stick them in the validate method in the ActionForm to make sure they are always called in instances where the form does not get to the action class (i.e. validation fails). But is this the correct way? I am thinking this is nothing new. What is the correct way to initialize drop downs? And then what about closing the database connection? I would much appreciate any help. It would make our Friday alot smoother. Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- 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]