using a Collection from nested attributes for option tag
I have previously been populating my options form elements from ArrayLists I have stored in the application scope. I am now implementing a more robust caching mechanism for this information and am trying to find the best way to access these collections now. For example to get to one of my collections now, I would use the following call: ArrayList countries = CacheManager.getMenuCache().getCountries(); CacheManager is stored at the application scope, under Const.CACHE_MANAGER_KEY. Is there a way to just use the options tag, with something like: or do I need to have a tag to get to the collection? Thanks, Alex
RE: Automatic Form Validation - A further question
To get around this I did something very similar to your isVirgin() solution, except I don't need to check all of the fields and can initialize them if need be. I simply added a 'private boolean accessed = false;' member variable to the ActionForm. In the jsp I have The body of the ActionForm validate is contained in an 'if(accessed) {' statement, and at the top of the ActionForm is if (!form.getAccessed()) { return (new ActionForward(mapping.getInput())); } This way, you can still have it automatically validate the form and initialize member variables. The first time the form is used, accessed will be false, so all validation is skipped and it immediately returns to the jsp. The jsp then sets accessed to true, so that it will then be validated. - Original Message - From: "Emaho, Ghoot" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 01, 2001 8:26 AM Subject: RE: Automatic Form Validation - A further question I have a solution which is acceptable for now. I have switched automatic validation off for the form bean, although i have kept the type/formatting validation logic in the validate method of the form bean. I have also added an additional function to the form bean 'isVirgin()' which my action class calls. This tells the action wether or not it's the first time round. This is achieved by checking all the form bean attributes against null - which they are the first time it is created [providing you dont initialise the private member variables in your form bean] As this method is in the form bean itself, the action is unaware of how this is determined, allowing it to change in the future. If the form is a virgin [excuse the language :)] the action justs forwards on to the input page. If it's not a virgin, it then calls the validate method on the form bean, and then does whatever else it needs to do. This seems to work well and is portable across all my form beans which means i have a consistent implementation. Thanks for your input David Cheers Ghoot > -Original Message- > From: David Winterfeldt [mailto:[EMAIL PROTECTED]] > Sent: 01 August 2001 16:11 > To: [EMAIL PROTECTED] > Subject: RE: Automatic Form Validation - A further question > > > > --- "Emaho, Ghoot" <[EMAIL PROTECTED]> wrote: > > Thanks again David. > > > > I have explored extending ActionForm to check for > > and ignore first time > > validation. However, it seems from my debug, that > > the form bean is > > created a new each time. Can someone else confirm > > this ? > If you have the scope of the action set to 'request', > then the bean is only around for the request. So it > would be created each time. > > > > > My further question is this: > > > > If I choose NOT to use automatic validation, and my > > request goes to the > > Action first [not the JSP], then what isthe best way > > to determine in the > > action that this is the 'first time' for this form > > bean i.e. it has been > > created only as a result of the ActionServlet, not > > because it's coming > > from the form on a JSP ? > > > > I know you can check the values of the form bean, > > but this seems a > > little messy. Any suggestions ? > I think checking for values is the best way. How else > can you tell one instance from another? The only > other way I can think of is to have the a class and a > subclass(es) that doesn't do anything, but represents > what state the bean is in. > > > > > Any help is appreciated, as this is an important > > issue for us. > > > > Cheers > > > > Ghoot > > > > > > > -Original Message- > > > From: David Winterfeldt > > [mailto:[EMAIL PROTECTED]] > > > Sent: 31 July 2001 18:43 > > > To: [EMAIL PROTECTED] > > > Subject: RE: Automatic Form Validation > > > > > > > > > > > > --- "Emaho, Ghoot" <[EMAIL PROTECTED]> > > wrote: > > > > Thanks for the reply David. > > > > > > > > Yeah, 'action' checking is another way of > > > > determining wether or not to > > > > do the validation. > > > > > > > > I guess I was wondering if it was possible to > > > > configure the Form to > > > > prevent first time checking ? Would anyone else > > find > > > > this useful ? > > > > > > > > Given the recent discussions about preventing > > direct > > > > acces to JSP's, it > > > > seems that the Form validation is designed [in > > > > default operation] in > > > > such a way as to expect that you have gone > > directly > > > > to the JSP first. > > > > This is one thing I wouldnt really ever want to > > do, > > > > as I prefer all > > > > requests to go through an action - even if it is > > > > just to redirect to the > > > > JSP [call me a control freak! but there area lot > > of > > > > others that feel the > > > > same :) ] > > > I think it is good to go through the controller if > > you > > > really want to keep the view separate. > > > > > > > > > > > I wonder if the Auto Validation should > > accomodate > > > > the more common > > > > scenario [certainly in larger applications] > > where > >
RE: Struts + Tomcat/Apache
Currently I am using both. Initially I just had these lines: AddType text/jsp .jsp AddHandler jserv-servlet .jsp AddHandler jserv-servlet .do in my tomcat-apache.conf file, which is included at the end of httpd.conf. This was returning the errors. So I added JkMount /*.jsp ajp13 JkMount /*.do ajp13 JkMount /servlet/* ajp13 to my httpd.conf as you indicated. This still returned the error. I tried taking out the jserv lines from the other file and I still get the same thing. Thanks. -Original Message- From: Rakesh To: [EMAIL PROTECTED] Sent: 7/26/01 2:59 AM Subject: Re: Struts + Tomcat/Apache are u using mod_jserv or mod_jk ? Rakesh Ayilliath (Software Engineer) Synergy IT Innovations Pvt Ltd, #196, 1st Floor, 9th Cross, HMT Layout, RT Nagar Bangalore 560032 [EMAIL PROTECTED] www.ayilliath.8m.com - Original Message - From: "Sorenson, Alexander" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 26, 2001 1:26 AM Subject: Struts + Tomcat/Apache > I am still having trouble configuring struts with tomcat and apache. Going > through the archives, I have put the following lines in my httpd.conf, which > solved the problem I was having before of Apache returning a 404: > > JkMount /*.jsp ajp13 > JkMount /*.do ajp13 > JkMount /servlet/* ajp13 > > Unfortunately now it returns a 500 internal server error. looking at > apache's logs, I find the following: > mod_jserv.log: > [25/07/2001 19:57:13:989] (EMERGENCY) ajp12[1]: cannot scan servlet headers > (500) > [25/07/2001 19:57:13:989] (ERROR) an error returned handling request via > protocol "ajpv12" > > error.log: > [Wed Jul 25 15:57:13 2001] [error] [client 64.111.2.62] Premature end of > script headers: g:/jakarta-tomcat-3.2.2/webapps/bmp/custlogin.do > > in the tomcat mod_jk.log: > [jk_connect.c (143)]: jk_open_socket, connect() failed errno = 61 > [jk_ajp13_worker.c (174)]: In jk_endpoint_t::connect_to_tomcat, failed errno > = 61 > [jk_ajp13_worker.c (587)]: Error connecting to the Tomcat process. > > Can anyone tell me what's going on here / how to fix it? > Thanks >
Struts + Tomcat/Apache
I am still having trouble configuring struts with tomcat and apache. Going through the archives, I have put the following lines in my httpd.conf, which solved the problem I was having before of Apache returning a 404: JkMount /*.jsp ajp13 JkMount /*.do ajp13 JkMount /servlet/* ajp13 Unfortunately now it returns a 500 internal server error. looking at apache's logs, I find the following: mod_jserv.log: [25/07/2001 19:57:13:989] (EMERGENCY) ajp12[1]: cannot scan servlet headers (500) [25/07/2001 19:57:13:989] (ERROR) an error returned handling request via protocol "ajpv12" error.log: [Wed Jul 25 15:57:13 2001] [error] [client 64.111.2.62] Premature end of script headers: g:/jakarta-tomcat-3.2.2/webapps/bmp/custlogin.do in the tomcat mod_jk.log: [jk_connect.c (143)]: jk_open_socket, connect() failed errno = 61 [jk_ajp13_worker.c (174)]: In jk_endpoint_t::connect_to_tomcat, failed errno = 61 [jk_ajp13_worker.c (587)]: Error connecting to the Tomcat process. Can anyone tell me what's going on here / how to fix it? Thanks
RE: action mapping difficulties
The getters (and setters) were of the form getSFirstName(), but that wasn't working. I changed them to getStFirstName() and it got past that (I still need to change all of the other getSXXX() methods, but it looks like that may fix the problem. Thanks. -Original Message- From: Rama Krishna To: [EMAIL PROTECTED] Sent: 7/24/01 2:39 PM Subject: Re: action mapping difficulties if you have a property with "sFirstName" then your getter methos should be getSFirstName(). if this doesn't work try changing your sFirstName to something else in lower case. eg: "abc" and getter will be getAbc(); hope this helps, rama. - Original Message ----- From: "Sorenson, Alexander" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 24, 2001 11:08 AM Subject: action mapping difficulties > I am getting a compilation error on my jsp, which seems to indicate a > problem with the action mappings. One jsp, the custLogin.jsp compiles fine, > whereas the custJoin.jsp throws this exception compiling > "javax.servlet.ServletException: No getter method for property > sFirstName of bean org.apache.struts.taglib.html.BEAN ". > I do have all of the getters and setters in the customerJoinForm. The action > mappings for these two forms seem to be consistent. The relevant code: > > custJoin.jsp: > <%@ 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" %> > ... > > ... > First Name: > > > ... > > > custLogin.jsp: > ... > > ... > > struts-config.xml: > > > > type="com.bmp.action.CustomerJoinForm"/> > > > type="com.bmp.action.CustomerLoginForm"/> > > > > > > > > > > > type="com.bmp.action.CustomerJoinAction" >name="customerJoinForm" >scope="request" >input="/custJoin.jsp" >validate="true"> > > > > > > type="com.bmp.action.CustomerLoginAction" >name="customerLoginForm" >scope="request" >input="/custLogin.jsp" >validate="true"> > > > > > > > Any ideas what's going on here? I am using Tomcat3.2.2, Struts 1.0 and > Apache1.3.20. > > Thanks, > Alex >
action mapping difficulties
I am getting a compilation error on my jsp, which seems to indicate a problem with the action mappings. One jsp, the custLogin.jsp compiles fine, whereas the custJoin.jsp throws this exception compiling "javax.servlet.ServletException: No getter method for property sFirstName of bean org.apache.struts.taglib.html.BEAN ". I do have all of the getters and setters in the customerJoinForm. The action mappings for these two forms seem to be consistent. The relevant code: custJoin.jsp: <%@ 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" %> ... ... First Name: ... custLogin.jsp: ... ... struts-config.xml: Any ideas what's going on here? I am using Tomcat3.2.2, Struts 1.0 and Apache1.3.20. Thanks, Alex
RE: Struts + Tomcat/Apache (again)
This is the same problem I am having I believe. I tried adding the JkMount lines, but when I restart Apache it gives me a Syntax error, with 'JkMount' as an invalid command. I am running Tomcat 3.2.2 with Apache 1.3.2 on Windows. Thanks Alex -Original Message- From: Steve Knight [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 24, 2001 9:43 AM To: [EMAIL PROTECTED]; Rakesh Subject: Re: Struts + Tomcat/Apache (again) I am having a very similar problem with Resin 1.2.7. I doesn't seem to be able to understand the *.do and I keep getting 404 Not Found pages. Is there anything I should be adding to my .conf file (like the JkMount/*.do ajp 13)? Thanks! Steve - Original Message - From: "Rakesh" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 24, 2001 6:12 AM Subject: Re: Struts + Tomcat/Apache (again) > its > JkMount /*.do ajp13 > > remember the / > > this needs to be added as follows to your httpd conf. > > JkMount /*.jsp ajp13 > JkMount /*.do ajp13 > JkMount /servlet/* ajp13 > > > > > Rakesh Ayilliath > (Software Engineer) > > Synergy IT Innovations Pvt Ltd, > #196, 1st Floor, 9th Cross, > HMT Layout, RT Nagar > Bangalore 560032 > > [EMAIL PROTECTED] > www.ayilliath.8m.com > - Original Message - > From: "Chuong Huynh" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, July 24, 2001 10:31 AM > Subject: Struts + Tomcat/Apache (again) > > > > Hi all, > > > > There were some discussion about this matter but I can't find a workable > > answer. > > > > I still can't manage to make Strut work on Tomcat with Apache: the server > > can't understand .do extension (using Tomcat alone work fine). I've > followed > > the doc carefully, and also followed the advise on the mailing list: add > the > > line > > > > JkMount *.do ajp12 > > > > to the config file, and the problem is still the same: HTTP 404 - File not > > found > > > > Could anyone please help me. > > > > By the way, I used: > > Apache 1.3.17 > > Tomcat 3.2.2 > > Strut 1.0 > > > > Thanks, > > - Chuong > > = > > HUYNH, N. CHUONG > > TMA Software Solutions, Vietnam > > Tel: (84-8) 990 3848 - Ext: 5272 > > Email: [EMAIL PROTECTED] > > = > > > > > > >
Struts configuration problems
I am having two different problems with my struts configuration: 1) Actions don't seem to be handled correctly. Anytime a submit button is clicked (this happens on my application as well as any example applications I have deployed) it comes back with a 404. I assume this is the setup with Apache / Tomcat. I have "Include G:/jakarta-tomcat-3.2.2/conf/struts-tomcat-apache.conf" at the bottom of the httpd.conf file for apache, and in the struts-tomcat-apache.conf file, I have the following lines: AddType text/jsp .jsp AddHandler jserv-servlet .jsp AddHandler jserv-servlet .do Is there something else I am missing? 2) Only my simple login form jsp's compile. My more complex forms do not compile at all, but return with an error such as "javax.servlet.ServletException: No getter method for property sFirstName of bean org.apache.struts.taglib.html.BEAN ". I do have all of the getters and setters in the FormBean. I have checked the configuration between the different jsps and the action mappings and they seem consistent. The relevant code: custJoin.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" %> Customer Join First Name: ... struts-config.xml: Thanks, Alex
Struts configuration problems
I am having two different problems with my struts configuration: 1) Actions don't seem to be handled correctly. Anytime a submit button is clicked (this happens on my application as well as any example applications I have deployed) it comes back with a 404. I assume this is the setup with Apache / Tomcat. I have "Include G:/jakarta-tomcat-3.2.2/conf/struts-tomcat-apache.conf" at the bottom of the httpd.conf file for apache, and in the struts-tomcat-apache.conf file, I have the following lines: AddType text/jsp .jsp AddHandler jserv-servlet .jsp AddHandler jserv-servlet .do Is there something else I am missing? 2) Only my simple login form jsp's compile. My more complex forms do not compile at all, but return with an error such as "javax.servlet.ServletException: No getter method for property sFirstName of bean org.apache.struts.taglib.html.BEAN ". I do have all of the getters and setters in the FormBean. I have checked the configuration between the different jsps and the action mappings and they seem consistent. The relevant code: custJoin.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" %> Customer Join First Name: ... struts-config.xml: Thanks, Alex