Struts and MySQL
Hi all, I tried to use struts with MySQL (driver "mm.mysql.jdbc-1.2c" = class "org.gjt.mm.mysql.Driver") and ran into an Exception each time I tried to start Tomcat: Exception in thread "main" java.lang.AbstractMethodError at org.apache.struts.util.GenericConnection.init(GenericConnection.java:118) at org.apache.struts.util.GenericDataSource.createConnection(GenericDataSource.java:623) at org.apache.struts.util.GenericDataSource.open(GenericDataSource.java:561) at org.apache.struts.action.ActionServlet.initDataSources(ActionServlet.java:998) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:444) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317) at org.apache.tomcat.core.Handler.init(Handler.java:215) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296) at org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnStartupInterceptor.java:130) at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:491) at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) Digging into the GenericConnection class code teached me the following: The mysql driver's Connection.getTypeMap() method throws an AbstractMethodError exception when called in: public GenericConnection(GenericDataSource source, Connection conn, boolean autoCommit, boolean readOnly) throws SQLException { at this location: try { this.map = conn.getTypeMap(); } catch (SQLException e) { ; // PostgreSQL throws a "not yet implemented" exception } catch (UnsupportedOperationException e) { ; // JDBC-ODBC bridge throws this } So I changed the catch statements in order to fix it for me. try { this.map = conn.getTypeMap(); } catch (SQLException e) { ; // PostgreSQL throws a "not yet implemented" exception } catch (UnsupportedOperationException e) { ; // JDBC-ODBC bridge throws this } catch (AbstractMethodError e) { ; // mm.mysql driver throws this one } I think it would make sense to include this little change in the official struts code. What do you developers think? If would be happy if someone could make this change. Thanks, --- Matthias Matthias Bauer +++ [EMAIL PROTECTED] +++ LivingLogic AG +++ www.livinglogic.de
db connection pool
Hello, i just looked at the GenericDataSource and thought it would be a nice feature to shrink the pool size when the connections are not needed anymore. If you all agree, imho there should be two more values in the dtd for the data-source and GenericDataSource. allow-shrinkingtrue/false/allow-shrinking shrink-period-min100/shrink-period-min What you think? Andre
RE: Struts installation notes - example's setLocale on JRun
* The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. * My project got hold of JRun 3 SP2 yesterday and noticed that this is a Known Issue (e.g. Unfixed Bug) in the service pack. I don't have the bug number handy. There is no news on when an SP3 might be available. I had complained about this a few weeks ago in the JRun support forum, but there was no response from any Allaire folks. Mark -Original Message-From: Peter Doyle [mailto:[EMAIL PROTECTED]]Sent: Tuesday, January 30, 2001 11:35 AMTo: [EMAIL PROTECTED]Subject: Struts installation notes - example's setLocale on JRun Hi, I was writing up the Installation notes for the example and documentation web applications for JRun whenI came across the same problem. (I haven't installed the example app since 0.5) allaire.jrun.scripting.DefaultCFE: Errors reported by compiler:D:/smartserver/peter/serving_eng/Struts-Example/WEB-INF/jsp/jrun__index2ejspa.java:44:1:44:27: Error: No match was found for method "setLocale(java.lang.String)". The deployment is grand, its this setLocale method that stops the example. I'll check out Allaire and the JRun postings for updates and include any findings. I'm not on struts-dev soI will check there for updates. Peter PS what's with this funny background? -Original Message-From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]Sent: 28 January 2001 05:03To: [EMAIL PROTECTED]Subject: Re: Can't run nightly releasesCarl Tallis wrote: Hi, all - I'm using JRun, and the 0.5 classes/tags work great, but I can't even get the later sample application to run:/newstrutsdemo/: javax.servlet.ServletException: Compilation error occured: allaire.jrun.scripting.DefaultCFE: Errors reported by compiler:C:/Program Files/Allaire/JRun/servers/default/New Struts Demo/WEB-INF/jsp/jrun__index2ejspa.java:41:1:41:27: Error: No match was found for method "setLocale(java.lang.String)". Pretty basic stuff. However, looking at the messages on this list, it's obvious that people *are* using the nightly builds. Anyone ever seen this error? What execution environments are people using who can run the later distributions (i.e. post 0.5)?Carl TallisDirector Of ProductsSupplyLinks, Inc.Tel: (703) 796-6010Fax: (703) 796-6014email: [EMAIL PROTECTED]Unfortunately, it appears that JRun has an implementation bug. The servlet container is supposed to do automatic type conversions when the data type of a custom tag property is something other than a String. In this particular case, the "locale" property accepts a boolean value. The set of required conversions are in Table 2-4 on page 65 of the JSP 1.1 specification. Originally, it was not clear (in the spec) that these conversions applied to custom tag attributes, as well as jsp:setProperty/, but this was cleared up in an errata to the spec that was published last April, at: http://java.sun.com/products/jsp/errata_1_1_a_042800.html As a workaround on JRun, you can add a String setter for each non-String property, but this is not a good long term solution, because such a tag will not work on any other servlet engine (because the Java reflection code will see two setter methods, and therefore decide that neither of them is appropriate -- so the property will be considered read only). Craig McClanahan
Re: Struts and MySQL
Hi Ted, thanks for the quick response. Pls see my comments below. I've been using MySQL locally on Tomcat and Resin for some time without any problem. MySQL doesn't support transactions, so I have to keep autocommit off. This is true. Here is my datasource config section (looks pretty much equivalent to yours): data-sources data-source autoCommit="true" description="Data Source Configuration" driverClass="org.gjt.mm.mysql.Driver" maxCount="4" minCount="2" password="" url="jdbc:mysql://localhost/AKTIONAER" user="root" / /data-sources (driver "mm.mysql.jdbc-1.2c" = class "org.gjt.mm.mysql.Driver") I'm not sure what you are saying here. All I wanted to say is what version I am using: 1.2c (from mm.mysql.jdbc-1.2c.tar.gz) I have a recent mm-mysql.jar on my classpath, and then use this datasource config, but that's it. [...] I have a mm-mysql.jar in my classpath, too. And as I already said, my datasource config looks almost perfectly the same. What I did in order to narrow down the error was a call to conn.getTypeMap() in a separate (non truts test application). This call always throws an AbstractMethodError exception. Maybe you are using a different version of the MySQL driver? Maybe 2.0preX (which is pre-release beta)? --- Matthias Matthias Bauer +++ [EMAIL PROTECTED] +++ LivingLogic AG +++ www.livinglogic.de
Re: Struts and MySQL
I have the same experience as Matthias with autocommit off. I simply need to comment off the conn.getTypeMap() statement because I found the method is not supported by mm-mysql 1.2c jdbc driver Connection. I think it should actually throw UnsupportedOperationException or SQLException in the get/setTypeMap(). Ted, could you possibly be using Caucho Mysql driver? Carl Ted Husted wrote: I've been using MySQL locally on Tomcat and Resin for some time without any problem. MySQL doesn't support transactions, so I have to keep autocommit off. (driver "mm.mysql.jdbc-1.2c" = class "org.gjt.mm.mysql.Driver") I'm not sure what you are saying here. I have a recent mm-mysql.jar on my classpath, and then use this datasource config, but that's it. data-sources data-source autoCommit="true" description="wxxi-gavel" driverClass="org.gjt.mm.mysql.Driver" maxCount="4" minCount="2" password="" url="jdbc:mysql://localhost/test" user="admin" / /data-sources *** REPLY SEPARATOR *** On 1/31/2001 at 1:11 PM Matthias Bauer wrote: Hi all, I tried to use struts with MySQL (driver "mm.mysql.jdbc-1.2c" = class "org.gjt.mm.mysql.Driver") and ran into an Exception each time I tried to start Tomcat: Exception in thread "main" java.lang.AbstractMethodError at org.apache.struts.util.GenericConnection.init(GenericConnection.java:1 18) at org.apache.struts.util.GenericDataSource.createConnection(GenericDataSou rce.java:623) at org.apache.struts.util.GenericDataSource.open(GenericDataSource.java:561 ) at org.apache.struts.action.ActionServlet.initDataSources(ActionServlet.jav a:998) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:444) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317) at org.apache.tomcat.core.Handler.init(Handler.java:215) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296) at org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnSta rtupInterceptor.java:130) at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:49 1) at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) Digging into the GenericConnection class code teached me the following: The mysql driver's Connection.getTypeMap() method throws an AbstractMethodError exception when called in: public GenericConnection(GenericDataSource source, Connection conn, boolean autoCommit, boolean readOnly) throws SQLException { at this location: try { this.map = conn.getTypeMap(); } catch (SQLException e) { ; // PostgreSQL throws a "not yet implemented" exception } catch (UnsupportedOperationException e) { ; // JDBC-ODBC bridge throws this } So I changed the catch statements in order to fix it for me. try { this.map = conn.getTypeMap(); } catch (SQLException e) { ; // PostgreSQL throws a "not yet implemented" exception } catch (UnsupportedOperationException e) { ; // JDBC-ODBC bridge throws this } catch (AbstractMethodError e) { ; // mm.mysql driver throws this one } I think it would make sense to include this little change in the official struts code. What do you developers think? If would be happy if someone could make this change. Thanks, --- Matthias Matthias Bauer +++ [EMAIL PROTECTED] +++ LivingLogic AG +++ www.livinglogic.de -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/about/struts/
Tag Library Definition Inheritence
Just as functionality can be inherited as you subclass the tag handlers, is it also possible to inherit the corresponding tag interface definitions in the library file? The TLD files are growing unnecessarily large. Thanks.
Re: Struts and MySQL
I've been using mm.mysql-2.0.2 - but checking http://mmmysql.sourceforge.net/ . I see 2.0.4 is the latest stable version as of 25-JAN. (The MySQL page is stale.) I installed Resin last week, but had been using Tomcat 3.2 - and both still work. I just updated my MySQL version to 3.23 (declared "stable" as of 22-JAN), but it had worked with an early version too. -T. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/about/struts/
RE: Struts and MySQL
I have been using mm.mysql-2.0.3 with the struts GenericDataSource for the past fortnight without any problems, using the jRelationalFramework at http://sourceforge.net/projects/jrf/ (you will have to apply the uncommited MySQLDatabasePolicy patch as listed at http://sourceforge.net/patch/?group_id=8796 and create any needed custom ColumnSpec classes (pretty simple cut and paste job). I am quite taken with jRelation; it does most of the work for you, but still leaves you with quite a bit of flexibility and portability across most serious databases. If you are not going to use EJBs for data access, take a look. /alix I've been using mm.mysql-2.0.2 - but checking http://mmmysql.sourceforge.net/ . I see 2.0.4 is the latest stable version as of 25-JAN. (The MySQL page is stale.) I installed Resin last week, but had been using Tomcat 3.2 - and both still work. I just updated my MySQL version to 3.23 (declared "stable" as of 22-JAN), but it had worked with an early version too. -T. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/about/struts/
Help: DiskMultipartRequestHandler
Where in the ActionServlet is the DiskMultipartRequestHandler class instantiated ? What makes the handleRequest() to be called as the first method automatically ? Who calls it ?
Re: Testing equality of bean properties
You could retrieve the bean2:prop2 value into a JSP scriptlet and then pass it to the logic:equal tag. % theValue = yourBean.property2() % logic:equal name="bean1" property="prop1" value="%=theValue%" Lind Jrgen wrote: Hi there, is there a possibbility within a struts-enabled jsp to compare two bean properties? I am looking for something like logic:equal name="bean1" property="prop1" value=bean:write name="bean2" property="prop2" ...do something... /logic:equal which is not possible currently since the logic:equal tag only supports comparison between a bean property and and constant value... Any ideas? Regards, Jrgen begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Re: Testing equality of bean properties
which is not possible currently since the logic:equal tag only supports comparison between a bean property and and constant value... Any ideas? It might be time to resort to a scriplet. (But then, in other languages, I've been also known to use a (gasp!) GOTO). *** REPLY SEPARATOR *** On 1/31/2001 at 5:13 PM Lind Jrgen wrote: Hi there, is there a possibbility within a struts-enabled jsp to compare two bean properties? I am looking for something like logic:equal name="bean1" property="prop1" value=bean:write name="bean2" property="prop2" ...do something... /logic:equal which is not possible currently since the logic:equal tag only supports comparison between a bean property and and constant value... Any ideas? Regards, Jrgen -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/about/struts/
Re: paging for web application
check out the pager taglib: http://jsptags.com/tags/navigation/pager/ "Boulatian, Misak" wrote: Hi alI, I am trying to implement paging for web application. The query may return over thousand records and it is a bad idea to dump all of those to the client. I was thinking to feed only 50 records at a time and have client to click for next or previous page. We are using struts with EJBs. Our action classes call session EJBs, which return information as a javabean. Does anyone have any ideas or done anything with struts in regards to paging (it may not even have to do anything with struts). I appreciate any responses. Thanks, Misak begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Re: WebLogic 6 Example App
Carl, I was wondering if you could give me a hand. I have been trying to migrate a Struts 0.5 App that ran on weblogic 5.1sp6 to weblogic 6. Perhaps you could answer the following: What version of struts are you using? Did you upgrade Weblogic 6 to use the EJB 2.0 jar In weblogic5.1 there needed to be a WebAppStartup.class, which I believe modified the order in which classes where loaded. Did you need this class in weblogic 6? If so how did you specify where to find the class in weblogic 6? Could you share your config.xml file? Finally, could you share any other details that may be of use. Any help you can provide would be appreciated. Thanks!!! John LeGassic Nightfire Software Carl Tallis wrote: All - Never mind. Turns out that was the only error, and the app runs fine, now. One interesting note - to compile Struts, you need Xalan version 1.x - version 2.x won't work.Carl TallisDirector Of ProductsSupplyLinks, Inc.Tel: (703) 796-6010Fax: (703) 796-6014email: [EMAIL PROTECTED] -Original Message- From: Carl Tallis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 30, 2001 9:52 PM To: Struts Users Mailing List Subject: WebLogic 6 Example App Hi - Testing a seventh (!) app server, my luck continues unabated:Parsing of JSP File '/index.jsp' failed: /index.jsp(3): Error in using tag library uri='html' prefix='/WEB-INF/struts-html.tld': There is no setter method for property 'lowsrc', for Tag class 'org.apache.struts.taglib.html.ImgTag' probably occurred due to an error in /index.jsp line 3: %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> Tue Jan 30 21:23:26 EST 2001Sure enough, this class has methods getlowSrc and setLowsrc. How is this not hosing everyone? Is there a flag to keep WebLogic from validating all the setter/getters in an application? This looks like an error that _someone_ must have solved, simply.Carl TallisDirector Of ProductsSupplyLinks, Inc.Tel: (703) 796-6010Fax: (703) 796-6014email: [EMAIL PROTECTED] begin:vcard n:le gassic;john tel;fax:510.500.1100 tel;work:510.500.1146 x-mozilla-html:FALSE org:Nightfire Software version:2.1 email;internet:[EMAIL PROTECTED] title:Software Engineer adr;quoted-printable:;;300 Lakeside Drive=0D=0ASuite 2100;Oakland;CA;94612; fn:john le gassic end:vcard
Re: IE4.0 / linked stylesheet problem?
Ignore me! This is not a webserver problem. The stylesheets I was given had underscores in their class names - that's what was screwing IE4, but it appeared fine in IE5 sorry everyone Ned From: "Ned Seagoon" [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: IE4.0 / linked stylesheet problem? Date: Wed, 31 Jan 2001 17:05:42 - Hi all, I hope you can really help me out here, I'm really stuck for ideas. I'm running Struts 28/1/01, tomcat 3.2.1 and IE 4 version 4.72.3110.8 I have just spotted a problem that does not replicate under IE 5 (which i have always used). I have a jsp could be accessed by localhost:8080/test/showsomething.jsp . That jsp has the following link rel='stylesheet' href='/test/site.css' (have have tried with no directory and at root, still not working). Now under IE 5, the site displays correctly with the stylesheets. If I access from IE 4, then the stylesheets are not loaded. However if I enter localhost:8080/test/site.css, I can access the stylesheet. Other sites with css can be seen from this browser. Is this a struts or tomcat issue do you think? Cheers Ned _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: IE4.0 / linked stylesheet problem?
have you tried adding the type attribute? link rel='stylesheet' href='/test/site.css' type='text/css' Ned Seagoon wrote: Hi all, I hope you can really help me out here, I'm really stuck for ideas. I'm running Struts 28/1/01, tomcat 3.2.1 and IE 4 version 4.72.3110.8 I have just spotted a problem that does not replicate under IE 5 (which i have always used). I have a jsp could be accessed by localhost:8080/test/showsomething.jsp . That jsp has the following link rel='stylesheet' href='/test/site.css' (have have tried with no directory and at root, still not working). Now under IE 5, the site displays correctly with the stylesheets. If I access from IE 4, then the stylesheets are not loaded. However if I enter localhost:8080/test/site.css, I can access the stylesheet. Other sites with css can be seen from this browser. Is this a struts or tomcat issue do you think? Cheers Ned _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Help Please: Resource not found
When trying to call a JSP I receive the following message from Tomcat: javax.servlet.ServletException: Cannot find bean under name org.apache.struts.taglib.html.BEAN at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459) I checked the STRUTS distribution and did not find it. Has anyone encountered this before? Thanks.
Is request shared across a redirect?
I have two JSP pages which I want to have share a bean. In the first JSP page I do something like this: [...] jsp:useBean id="bean" scope="request" class="package.BeanClass"/ jsp:setProperty name="bean" property="prop" value='Some Value'/ logic:redirect href="foo.jsp"/ [...] In "foo.jsp", I have code which looks like this: [...] logic:notPresent name="bean" scope="request" h3Message not available/h3 /logic:notPresent logic:present name="bean" scope="request" jsp:useBean id="bean" scope="request" class="package.BeanClass"/ h3bean:write name="bean" property="prop" filter="true"//h3 /logic:present [...] When I invoke the first page, I make the transition to the second page, but the bean property is never found. I've debugged the code and it appears that the request object used by the second page does not have the attribute defined by the first page. I guess I thought that objects put into the request scope were maintained across a redirection. Was I wrong or am I just doing something stupid? Thanks.
Re: Is request shared across a redirect?
Requests are not preserved over a redirect because this generates a redirect response back to the browser. The browser responds by requesting the URL provided in the redirect response. Request and response objects are preserved over forward because this is internal to the webserver. -- Jason James Howe wrote: I have two JSP pages which I want to have share a bean. In the first JSP page I do something like this: [...] jsp:useBean id="bean" scope="request" class="package.BeanClass"/ jsp:setProperty name="bean" property="prop" value='Some Value'/ logic:redirect href="foo.jsp"/ [...] In "foo.jsp", I have code which looks like this: [...] logic:notPresent name="bean" scope="request" h3Message not available/h3 /logic:notPresent logic:present name="bean" scope="request" jsp:useBean id="bean" scope="request" class="package.BeanClass"/ h3bean:write name="bean" property="prop" filter="true"//h3 /logic:present [...] When I invoke the first page, I make the transition to the second page, but the bean property is never found. I've debugged the code and it appears that the request object used by the second page does not have the attribute defined by the first page. I guess I thought that objects put into the request scope were maintained across a redirection. Was I wrong or am I just doing something stupid? Thanks.
Struts on WebSphere
Has anyone installed a current version of struts on WebSphere3.5.2? Any problems/hints? Thanx, Andreas
Re: Is request shared across a redirect?
A redirect instructs the client to generate a new request, so by the time foo.jsp is invoked the request containing the bean is gone. James Howe wrote: I have two JSP pages which I want to have share a bean. In the first JSP page I do something like this: [...] jsp:useBean id="bean" scope="request" class="package.BeanClass"/ jsp:setProperty name="bean" property="prop" value='Some Value'/ logic:redirect href="foo.jsp"/ [...] In "foo.jsp", I have code which looks like this: [...] logic:notPresent name="bean" scope="request" h3Message not available/h3 /logic:notPresent logic:present name="bean" scope="request" jsp:useBean id="bean" scope="request" class="package.BeanClass"/ h3bean:write name="bean" property="prop" filter="true"//h3 /logic:present [...] When I invoke the first page, I make the transition to the second page, but the bean property is never found. I've debugged the code and it appears that the request object used by the second page does not have the attribute defined by the first page. I guess I thought that objects put into the request scope were maintained across a redirection. Was I wrong or am I just doing something stupid? Thanks.
Re: Is request shared across a redirect?
James, A redirect causes the client to make a new request of the server. As such, the target of the redirect is a new request and will not share attributes with the previous request. hth, bear At 02:46 PM 1/31/2001 -0500, you wrote: I have two JSP pages which I want to have share a bean. In the first JSP page I do something like this: [...] jsp:useBean id="bean" scope="request" class="package.BeanClass"/ jsp:setProperty name="bean" property="prop" value='Some Value'/ logic:redirect href="foo.jsp"/ [...] In "foo.jsp", I have code which looks like this: [...] logic:notPresent name="bean" scope="request" h3Message not available/h3 /logic:notPresent logic:present name="bean" scope="request" jsp:useBean id="bean" scope="request" class="package.BeanClass"/ h3bean:write name="bean" property="prop" filter="true"//h3 /logic:present [...] When I invoke the first page, I make the transition to the second page, but the bean property is never found. I've debugged the code and it appears that the request object used by the second page does not have the attribute defined by the first page. I guess I thought that objects put into the request scope were maintained across a redirection. Was I wrong or am I just doing something stupid? Thanks.
Re: Is request shared across a redirect?
Certainly makes sense. I was able to change to using forward and now I'm getting the results I expected. Thanks! At 02:51 PM 1/31/2001 -0500, you wrote: Requests are not preserved over a redirect because this generates a redirect response back to the browser. The browser responds by requesting the URL provided in the redirect response. Request and response objects are preserved over forward because this is internal to the webserver. -- Jason James Howe wrote: I have two JSP pages which I want to have share a bean. In the first JSP page I do something like this: [...] jsp:useBean id="bean" scope="request" class="package.BeanClass"/ jsp:setProperty name="bean" property="prop" value='Some Value'/ logic:redirect href="foo.jsp"/ [...] In "foo.jsp", I have code which looks like this: [...] logic:notPresent name="bean" scope="request" h3Message not available/h3 /logic:notPresent logic:present name="bean" scope="request" jsp:useBean id="bean" scope="request" class="package.BeanClass"/ h3bean:write name="bean" property="prop" filter="true"//h3 /logic:present [...] When I invoke the first page, I make the transition to the second page, but the bean property is never found. I've debugged the code and it appears that the request object used by the second page does not have the attribute defined by the first page. I guess I thought that objects put into the request scope were maintained across a redirection. Was I wrong or am I just doing something stupid? Thanks. James W. Howe mailto:[EMAIL PROTECTED] Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html Ann Arbor, MI 48103
ActionForward: scope of modifications?
I didn't do a thorough walk through the source, but it appears that if I modify an ActionForward returned from an ActionMapping passed to Action.perform I am changing global state in struts. Is this correct? If so, I think this should be in the javadoc for ActionMapping, and ActionForward should be cloneable or have a copy constructor. Thanks, John
RE: logic:greaterEqual tag (also logic:iterate with Arrays thread)
Does anybody know whether this will be the preferred method of accessing bean methods using logic tags in Struts? It seems a little confusing that you have to know the names of the bean you are using when you use logic:xxx tags, but not with html:xxx tags. If it counts for anything, my vote would be to keep the default case in all the tags consistent - when there is no name parameter defined, the property tag refers to the bean bound to the current action in struts-config.xml. It makes things clean and magical like they should be. Is the current behaviour set in stone for version 1? Thanks -Pete -Original Message- From: Ted Husted [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 01, 2001 3:04 AM To: Struts List Subject: RE: logic:greaterEqual tag I don't have to specify, for example, html:text id="myBean" property="myText", i can just say html:text property="myText".. shouldn't the logic tags follow this model by default? I think here the logic tags are following the general bean-tag model by default. In the case of the HTML tag there is an implicit, default name="[formbean]" parameter to the html:form tags, which is then made the default name parameter to the tags nested within the form. Of course, you can override this in either case by supplying another name parameter. I'm actually surprised that you were able to use the greaterEqual tag without a name parameter. I hadn't realized the logic tags were consulting the action mappings now. *** REPLY SEPARATOR *** On 1/31/2001 at 3:41 PM Pete Black wrote: That fixed my problem, but worries me a little. Shouldn't this be implicit - i.e. whatever FormBean is associated with the Action in struts-config.xml is the default 'id' attribute? This is how the html:text tags etc. work. I don't have to specify, for example, html:text id="myBean" property="myText", i can just say html:text property="myText".. shouldn't the logic tags follow this model by default? -Pete -Original Message- From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, January 31, 2001 3:37 PM To: [EMAIL PROTECTED] Subject:Re: logic:greaterEqual tag Pete, You need to also specify the 'id' attribute, supplying the name of the bean (within some scope) that the value of the 'property' attribute is a property of! Regards, James W. -- This e-mail is from Cards Etc Pty Ltd (ACN: 069 533 302). It may contain privileged and confidential information. It is intended for the named recipient(s) only. If you are not an intended recipient, please notify us immediately by reply e-mail or by phone on +61 2 9212 7773 delete this e-mail from your system. -- -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/about/struts/
Re: ActionForm in this case
Anand Raman wrote: Hi Hunt Sorry for the late response but i just managed doing something very similar.. its quite easy to do and can be comfortably accomplished using struts.. The link which leads to ur edit page will have the action mapping and also a requestParameter to identify the operation that needs to be performed.. eg myActionClass.do?perform="populate" The Struts example application does something similar to this -- the only difference is that I chose to use two different actions (/editSubscription.do versus /saveSubscription.do) for the two distinct functions of populating the form bean versus saving the results to the database. Craig McClanahan
RE: Help: DiskMultipartRequestHandler
Hi Mike, Thanx for your reply. I think there is a bug in the upload package. The file is getting uploaded into the specified directory (tempDir parameter) but is not getting renamed to the original name. It remains as strts.tmp. The data inside is valid and so is the file size. I am forced to use struts 0.5. Hence I pulled back the upload package into struts 0.5. I instantiated DiskMultipartRequestHandler and called it's handleRequest(). Or am I doing something wrong ? Any help would be greatly appreciated. Thanx Prasad. "Schachter, Michael" [EMAIL PROTECTED] on 01/31/2001 11:23:36 AM Please respond to [EMAIL PROTECTED] To: "'[EMAIL PROTECTED]'" [EMAIL PROTECTED] cc: Subject: RE: Help: DiskMultipartRequestHandler Where in the ActionServlet is the DiskMultipartRequestHandler class instantiated ? DiskMultipartRequestHandler (or whatever implementation is used) is created inside of RequestUtils.populate(Object,String,String,HttpServletRequest). The RequestUtils.populate method is called from ActionServlet.processPopulate() What makes the handleRequest() to be called as the first method automatically ? Who calls it ? handleRequest(HttpServletRequest request) is an interface method in MultipartRequestHandler that is specified to be called on to handle multipart requests. "Handling" multipart requests consists of doing whatever the implementation wants it to do. The DiskMultipartRequestHandler reads the ServletInputStream and obtains form input entries and file input entries. It's called inside of RequestUtils.populate() soon after the MultipartRequestHandler class is instantiated.
RE: Templates in Struts
Title: Blank The subordinate file tags are processed. The subordinate files are included via a PageContext.include() which is like a jsp:include. The subordinate file can be a full fledged jsp but it will inherit some things from the outer jsp (like the buffer size) and share the same request/respone objects. -Original Message-From: Carl Tallis [mailto:[EMAIL PROTECTED]]Sent: Wednesday, January 31, 2001 5:14 PMTo: Struts Users Mailing ListSubject: Templates in Struts Hi - Am I correct in inferring that the Struts templates don't process Struts tags in the subordinate files? Carl Tallis Director Of Products SupplyLinks, Inc. Tel:(703) 796-6010 Fax:(703) 796-6014 email: [EMAIL PROTECTED] *** This email message contains confidential information for the above addressee only. If you are not the intended addressee you must not disclose or use the information in any manner whatsoever. Any opinion or views contained in this email message are those of the sender, do not represent those of the Company in any way and reliance should not be placed upon its contents. Unless otherwise stated this email message is not intended to be contractually binding. Where an Agreement exists between our respective companies and there is conflict between the contents of this email message and the Agreement then the terms of that Agreement shall prevail. ***
Re: Tag Library Definition Inheritence
[EMAIL PROTECTED] wrote: Just as functionality can be inherited as you subclass the tag handlers, is it also possible to inherit the corresponding tag interface definitions in the library file? The TLD files are growing unnecessarily large. Thanks. Unfortunately, it is not. There is no way to say that "this tag has all the same attributes as that tag, plus a few more." Craig McClanahan
Re: Is request shared across a redirect?
James Howe wrote: I have two JSP pages which I want to have share a bean. In the first JSP page I do something like this: [...] jsp:useBean id="bean" scope="request" class="package.BeanClass"/ jsp:setProperty name="bean" property="prop" value='Some Value'/ logic:redirect href="foo.jsp"/ [...] In "foo.jsp", I have code which looks like this: [...] logic:notPresent name="bean" scope="request" h3Message not available/h3 /logic:notPresent logic:present name="bean" scope="request" jsp:useBean id="bean" scope="request" class="package.BeanClass"/ h3bean:write name="bean" property="prop" filter="true"//h3 /logic:present [...] When I invoke the first page, I make the transition to the second page, but the bean property is never found. I've debugged the code and it appears that the request object used by the second page does not have the attribute defined by the first page. I guess I thought that objects put into the request scope were maintained across a redirection. Was I wrong or am I just doing something stupid? Request scope objects are retained across a *forward* but not across a *redirect*. The reason is that a redirect is actually a message sent back to the browser, which then submits a second request to the new URL. The request attributes are not shared because it is not the same request any longer. Session scope objects, on the other hand, would be retained across the redirect. Thanks. Craig
RE: logic:greaterEqual tag (also logic:iterate with Arrays thread)
Yep, you're right.. i'm still getting my head around the tools Struts provides. Thanks for your help -Pete -Original Message- From: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 01, 2001 1:32 PM To: [EMAIL PROTECTED] Subject: Re: logic:greaterEqual tag (also logic:iterate with Arrays thread) Pete Black wrote: Does anybody know whether this will be the preferred method of accessing bean methods using logic tags in Struts? It seems a little confusing that you have to know the names of the bean you are using when you use logic:xxx tags, but not with html:xxx tags. If it counts for anything, my vote would be to keep the default case in all the tags consistent - when there is no name parameter defined, the property tag refers to the bean bound to the current action in struts-config.xml. It makes things clean and magical like they should be. Is the current behaviour set in stone for version 1? Consider a case where the Struts example application uses a conditional tag outside the scope of an html:form tag -- the check for which type of transaction is being performed at the top of "registration.jsp" in several places, including when creating the title element: logic:equal name="registrationForm" property="action" scope="request" value="Create" titlebean:message key="registration.title.create"//title /logic:equal If the name attribute were not entered here, I don't see how the tag could know what bean you are referring to. It would be feasible to make an assumption that, if you're inside a form, then you must be talking about the form bean -- although that risks confusion as well because the tag would behave quite differently depending on where it was placed. Thanks -Pete Craig McClanahan
Missing message for key index.title
I grabbed the latest nightly build, recompiled struts, dropped struts-example.war in the webapps dir, but when I try to run it I get the above error. I noticed quite a few threads on this, but most pertaining to the Orion server. I'm using Tomcat. Everything was working with my 0.5 tree, but I decided to upgrade and here I am. The properties file it is looking for in web.xml does exist, and there is indeed an entry for index.title. any suggestions ? Root cause: javax.servlet.jsp.JspException: Missing message for key index.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:261) thanx -Justin
Re: html:errors and property attribute
On Thu, Feb 01, 2001 at 09:30:52AM +1100, [EMAIL PROTECTED] wrote: In the code I have (2000-01-19) neither of the ErrorsTag classes in org.apache.struts.taglib.html or org.apache.struts.taglib.form have methods to support the property attribute. Am I missing somthing on this one? a newer version. incze
RE: Struts on WebSphere
Bill, We have the example app running on NT with WAS 3.5.2. I didn't configure it myself but I don't think there was much special we had to do other than make sure that you have the right jar in the classpath (xml parser etc) since WAS puts xalan.jar and xml4j.jar in the classpath for you. I think if you use the WAR file to XML utility you can create an xml configuration file that you can import into the admin console for the example app or whatever other app you want to use. There are two utilities you can use wartowebapp (http://www-4.ibm.com/software/webservers/appserv/doc/v35/ae/infocenter/was/ 040210.html) and wartoxmlconfig (http://www-4.ibm.com/software/webservers/appserv/doc/v35/ae/infocenter/was/ 060600020104.html). I'm not sure which is the most appropriate to use (I think wartoxmlconfig) but you can find them in the bin directory. Also, remember that if you are also using VAJ the WTE does NOT support servlet api 2.2, use the Tomcat test environment instead. Randy Bielby Consultant Greenbrier Russel: The People You Trust with eBusiness Madison, Wisconsin www.gr.com (608) 827-6760 [EMAIL PROTECTED] -Original Message- From: Hines, Bill [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, January 31, 2001 3:04 PM To: '[EMAIL PROTECTED]' Subject: RE: Struts on WebSphere Someone a while back said they had Struts working or almost working on WAS. It seems that was before the 3.5.2 fixpack that brought WAS up to servlet 2.2 and JSP 1.1, so I don't know how that could be. Probably because it was 'early Struts' that still used JDK 1.1, servlet 2.1, and JSP 1.0. I'm interested as well, if anyone has notes on this. I know that IBM is planning to release WAS 4.0 this quarter, which is supposed to be fully J2EE 1.2 compliant, so we might just hold off until then. But I'd like to actually play with Struts on our WAS 3.5.2 test box if that's possible. Bill Hines Hershey Foods -Original Message- From: Gehmeyr Andreas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 31, 2001 2:58 PM To: '[EMAIL PROTECTED]' Subject: Struts on WebSphere Has anyone installed a current version of struts on WebSphere3.5.2? Any problems/hints? Thanx, Andreas
Re: Testing equality of bean properties
Peter Alfors wrote: You could retrieve the bean2:prop2 value into a JSP scriptlet and then pass it to the logic:equal tag. % theValue = yourBean.property2() % logic:equal name="bean1" property="prop1" value="%=theValue%" Or, in a similar vein: bean:define id="theValue" name="yourBean" property="property2"/ logic:equal name="bean1" property="prop1" value="%= theValue %"/ Craig
html:errors and property attribute
In the code I have (2000-01-19) neither of the ErrorsTag classes in org.apache.struts.taglib.html or org.apache.struts.taglib.form have methods to support the property attribute. Am I missing somthing on this one? -- dIon Gillard, Multitask Consulting Work: http://www.multitask.com.au NetRexx: http://www.multitask.com.au/NetRexx.nsf
Re: configuring database connection pool
Steve A Drake wrote: As a follow-up to the problem I was having with the setReadOnly() method for the Connection object (using Informix), I downloaded the latest/greatest JDBC driver that I could find (SQLJ 2.20.JC1 from www.informix.com/evaluate) and found the same problem. From the release notes (file: jdbcrel.txt) it's clear that Informix (Dynamic Server 7.24.UC7-1) doesn't support read-only mode: -79745 Read only mode not supported Informix does not support read-only mode. That answers that question. Thanks for doing the research, Steve. I just checked in your patch, so it will show up in tonight's nightly build. Craig
Re: logic:greaterEqual tag (also logic:iterate with Arrays thread)
Pete Black wrote: Does anybody know whether this will be the preferred method of accessing bean methods using logic tags in Struts? It seems a little confusing that you have to know the names of the bean you are using when you use logic:xxx tags, but not with html:xxx tags. If it counts for anything, my vote would be to keep the default case in all the tags consistent - when there is no name parameter defined, the property tag refers to the bean bound to the current action in struts-config.xml. It makes things clean and magical like they should be. Is the current behaviour set in stone for version 1? Consider a case where the Struts example application uses a conditional tag outside the scope of an html:form tag -- the check for which type of transaction is being performed at the top of "registration.jsp" in several places, including when creating the title element: logic:equal name="registrationForm" property="action" scope="request" value="Create" titlebean:message key="registration.title.create"//title /logic:equal If the name attribute were not entered here, I don't see how the tag could know what bean you are referring to. It would be feasible to make an assumption that, if you're inside a form, then you must be talking about the form bean -- although that risks confusion as well because the tag would behave quite differently depending on where it was placed. Thanks -Pete Craig McClanahan
RE: Struts and MySQL
Ted MySQL does support transaction (check out this article http://www.mysql.com/news/article-54.html ). You will need to set your table type to "BDB" to enable transaction support. I am using mm.mysql JDBC driver version 2.0.3 which is JDBC 2.0 driver and it is quite stable. I would recommend that you to upgrade to this version of the JDBC driver. Regards, Michael Mok -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Thursday, 1 February 2001 9:10 To: Struts List; Struts List Subject: Re: Struts and MySQL I've been using MySQL locally on Tomcat and Resin for some time without any problem. MySQL doesn't support transactions, so I have to keep autocommit off. (driver "mm.mysql.jdbc-1.2c" = class "org.gjt.mm.mysql.Driver") I'm not sure what you are saying here. I have a recent mm-mysql.jar on my classpath, and then use this datasource config, but that's it. data-sources data-source autoCommit="true" description="wxxi-gavel" driverClass="org.gjt.mm.mysql.Driver" maxCount="4" minCount="2" password="" url="jdbc:mysql://localhost/test" user="admin" / /data-sources *** REPLY SEPARATOR *** On 1/31/2001 at 1:11 PM Matthias Bauer wrote: Hi all, I tried to use struts with MySQL (driver "mm.mysql.jdbc-1.2c" = class "org.gjt.mm.mysql.Driver") and ran into an Exception each time I tried to start Tomcat: Exception in thread "main" java.lang.AbstractMethodError at org.apache.struts.util.GenericConnection.init(GenericConnection.java:1 18) at org.apache.struts.util.GenericDataSource.createConnection(GenericDataSou rce.java:623) at org.apache.struts.util.GenericDataSource.open(GenericDataSource.java:561 ) at org.apache.struts.action.ActionServlet.initDataSources(ActionServlet.jav a:998) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:444) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317) at org.apache.tomcat.core.Handler.init(Handler.java:215) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296) at org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnSta rtupInterceptor.java:130) at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:49 1) at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) Digging into the GenericConnection class code teached me the following: The mysql driver's Connection.getTypeMap() method throws an AbstractMethodError exception when called in: public GenericConnection(GenericDataSource source, Connection conn, boolean autoCommit, boolean readOnly) throws SQLException { at this location: try { this.map = conn.getTypeMap(); } catch (SQLException e) { ; // PostgreSQL throws a "not yet implemented" exception } catch (UnsupportedOperationException e) { ; // JDBC-ODBC bridge throws this } So I changed the catch statements in order to fix it for me. try { this.map = conn.getTypeMap(); } catch (SQLException e) { ; // PostgreSQL throws a "not yet implemented" exception } catch (UnsupportedOperationException e) { ; // JDBC-ODBC bridge throws this } catch (AbstractMethodError e) { ; // mm.mysql driver throws this one } I think it would make sense to include this little change in the official struts code. What do you developers think? If would be happy if someone could make this change. Thanks, --- Matthias Matthias Bauer +++ [EMAIL PROTECTED] +++ LivingLogic AG +++ www.livinglogic.de -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/about/struts/
action.xml
Hi In the deprecated action.xml was there a way to specify scope for the form beans. If yes how. Is the scope attribute in the new struts-config.xml a scope for the form bean??? Thanks Hunt __ Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Re: action.xml
John Hunt wrote: Hi In the deprecated action.xml was there a way to specify scope for the form beans. If yes how. Is the scope attribute in the new struts-config.xml a scope for the form bean??? Thanks Hunt In both versions, the "scope" attribute of the action element determines whether the form bean goes in request scope or session scope. Craig
Re: action.xml
If a formBean is spread acroos multiple but consecutive ( again consecutive ) pages, should I put the bean in session or will the request scope do because they are consecutive pages. I believe, session, since each visit to each page in sequence is a separate request. Regards, James W. -- This e-mail is from Cards Etc Pty Ltd (ACN: 069 533 302). It may contain privileged and confidential information. It is intended for the named recipient(s) only. If you are not an intended recipient, please notify us immediately by reply e-mail or by phone on +61 2 9212 7773 delete this e-mail from your system. --
Re: Dynamic form action?
Peter Alfors wrote: Currently, we do not use the html:form tag. I haven't had a chance to look into them yet. I would think that the action attribute would not be required, but maybe there is a good reason for it to be? Someone with more experience with the html tags will have to help you there. Anyone? The action attribute is used for two things: * Create the destination hyperlink to submit to (which you don't need in this scenario) * To look up the corresponding ActionMapping entry and, from there, determine what form bean to use. This information is used by all the nested field tags. If you don't need either of these features, you probably don't need the html:form tag. Pete Craig
RE: Struts on WebSphere
Someone a while back said they had Struts working or almost working on WAS. It seems that was before the 3.5.2 fixpack that brought WAS up to servlet 2.2 and JSP 1.1, so I don't know how that could be. Probably because it was 'early Struts' that still used JDK 1.1, servlet 2.1, and JSP 1.0. I'm interested as well, if anyone has notes on this. I know that IBM is planning to release WAS 4.0 this quarter, which is supposed to be fully J2EE 1.2 compliant, so we might just hold off until then. But I'd like to actually play with Struts on our WAS 3.5.2 test box if that's possible. Bill Hines Hershey Foods -Original Message- From: Gehmeyr Andreas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 31, 2001 2:58 PM To: '[EMAIL PROTECTED]' Subject: Struts on WebSphere Has anyone installed a current version of struts on WebSphere3.5.2? Any problems/hints? Thanx, Andreas
Latest binaries problem
The latest 20010131 binaries is only 1k byte in size! __ Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Re: action.xml
If a formBean is spread acroos multiple but consecutive ( again consecutive ) pages, should I put the bean in session or will the request scope do because they are consecutive pages. --- "Craig R. McClanahan" [EMAIL PROTECTED] wrote: John Hunt wrote: Hi In the deprecated action.xml was there a way to specify scope for the form beans. If yes how. Is the scope attribute in the new struts-config.xml a scope for the form bean??? Thanks Hunt In both versions, the "scope" attribute of the action element determines whether the form bean goes in request scope or session scope. Craig __ Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
RE: Struts on WebSphere
Hi Andreas, We use Websphere 3.5.2 on NT and it works ok for us. There are no "Struts-specific" issues that I know about except for Websphere being the product it is... If you plan on using Struts with Websphere on Linux the issue is that there is no WAS fixpack 2 for linux, this means there is no Servlet 2.2 / JSP 1.1 support that is required for using Struts 1.0. WAS Fixpack 3 should fix this in mid februari. We have at some point got into problems with reading the struts-config file but in the end it always turn out to be the ing classloader(s) in websphere that caused the problem... Sorry, but I'm not to impressed with Websphere. If you have an option to choose another appserver I would strongly recommend that. // Torben -Original Message- From: Gehmeyr Andreas [mailto:[EMAIL PROTECTED]] Sent: den 31 januari 2001 20:58 To: '[EMAIL PROTECTED]' Subject: Struts on WebSphere Has anyone installed a current version of struts on WebSphere3.5.2? Any problems/hints? Thanx, Andreas
Re: comments in .properties file
Peter Doyle wrote: Thanks Steve for your reply. Peter Just as an FYI, the file format for properties files is actually documented, but the location is a little bit obscure -- check out the Javadocs for the load() method of the java.util.Properties class for JDK 1.2 or later. Craig McClanahan