RE: Form - Bean conversion
I have instances of beans within the ActionForm and then access them with the name of the bean and the name of the property in the bean when using them in the JSP. The only problem is having non-Strings in the bean. You need to do some sort of conversion within the ActionForm to get around this. Kimberly MacKellar -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 2:53 PM To: [EMAIL PROTECTED] Subject: Form - Bean conversion We have a bunch of existing beans that we'd like to use w/ ActionForms. For each bean we'll need to obviously expose the getters/setters in the corresponding ActionForm. The ideal scenario we'd like to see happen is prevent the ActionForms from having all the corresponding getters/setters hardcoded into it. We're ok w/ coding the validate() method for each class by hand, but we'd like to avoid having to code each ActionForm w/ a getter/setter (even if it is templated out for us by a Struts plug in or even a custom written batch file). Has anyone implemented something like this? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Form - Bean conversion
You will have a getter and setter for the bean. Then in the jsp you will access the bean something like html:text property=nameOfBean.propertyOfBean size=10/ Kim -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 3:18 PM To: Struts Users Mailing List Subject: Re: Form - Bean conversion Unless I'm misunderstanding, I'm not sure if that will do what we're hoping for When you use the html:form tag (and corresponding input tags from the html tag lib) on a JSP page there's error checking to make sure you have a corresponding get/set method in the ActionForm. If we have the original bean as an instance variable in the ActionForm and have no other getters/setters hardcoded into the ActionForm, won't that cause a compile-time error on the JSP? - Original Message - From: MacKellar, Kimberly [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 15, 2002 2:54 PM Subject: RE: Form - Bean conversion I have instances of beans within the ActionForm and then access them with the name of the bean and the name of the property in the bean when using them in the JSP. The only problem is having non-Strings in the bean. You need to do some sort of conversion within the ActionForm to get around this. Kimberly MacKellar -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 2:53 PM To: [EMAIL PROTECTED] Subject: Form - Bean conversion We have a bunch of existing beans that we'd like to use w/ ActionForms. For each bean we'll need to obviously expose the getters/setters in the corresponding ActionForm. The ideal scenario we'd like to see happen is prevent the ActionForms from having all the corresponding getters/setters hardcoded into it. We're ok w/ coding the validate() method for each class by hand, but we'd like to avoid having to code each ActionForm w/ a getter/setter (even if it is templated out for us by a Struts plug in or even a custom written batch file). Has anyone implemented something like this? -- 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: Form - Bean conversion
propertyOfBean is a protected member of the bean and is exposed with a public get method. The struts tag calls the get method of the property. Kim -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 3:37 PM To: Struts Users Mailing List Subject: Re: Form - Bean conversion Very interesting So in your example is 'propertyOfBean' exposed in 'nameOfBean' via a public get method or simply as a public data member? In other words, if I were just accessing the value via a scriptlet would I say nameOfBean.getPropertyOfBean() or nameOfBean.propertyOfBean - Original Message - From: MacKellar, Kimberly [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 15, 2002 3:22 PM Subject: RE: Form - Bean conversion You will have a getter and setter for the bean. Then in the jsp you will access the bean something like html:text property=nameOfBean.propertyOfBean size=10/ Kim -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 3:18 PM To: Struts Users Mailing List Subject: Re: Form - Bean conversion Unless I'm misunderstanding, I'm not sure if that will do what we're hoping for When you use the html:form tag (and corresponding input tags from the html tag lib) on a JSP page there's error checking to make sure you have a corresponding get/set method in the ActionForm. If we have the original bean as an instance variable in the ActionForm and have no other getters/setters hardcoded into the ActionForm, won't that cause a compile-time error on the JSP? - Original Message - From: MacKellar, Kimberly [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 15, 2002 2:54 PM Subject: RE: Form - Bean conversion I have instances of beans within the ActionForm and then access them with the name of the bean and the name of the property in the bean when using them in the JSP. The only problem is having non-Strings in the bean. You need to do some sort of conversion within the ActionForm to get around this. Kimberly MacKellar -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 2:53 PM To: [EMAIL PROTECTED] Subject: Form - Bean conversion We have a bunch of existing beans that we'd like to use w/ ActionForms. For each bean we'll need to obviously expose the getters/setters in the corresponding ActionForm. The ideal scenario we'd like to see happen is prevent the ActionForms from having all the corresponding getters/setters hardcoded into it. We're ok w/ coding the validate() method for each class by hand, but we'd like to avoid having to code each ActionForm w/ a getter/setter (even if it is templated out for us by a Struts plug in or even a custom written batch file). Has anyone implemented something like this? -- 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: Form - Bean conversion
I wrote conversion methods for nonString properties of the bean within the ActionForm to do the conversion. There is probably an easier way but that was the simplest I came up with. Kim -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 3:39 PM To: Struts Users Mailing List Subject: Re: Form - Bean conversion Also, forgot to askif propertyOfBean were of type 'java.util.Date' (or any other non-string data type) have you found situations where you ran into any conversion problems? - Original Message - From: MacKellar, Kimberly [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 15, 2002 3:22 PM Subject: RE: Form - Bean conversion You will have a getter and setter for the bean. Then in the jsp you will access the bean something like html:text property=nameOfBean.propertyOfBean size=10/ Kim -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 3:18 PM To: Struts Users Mailing List Subject: Re: Form - Bean conversion Unless I'm misunderstanding, I'm not sure if that will do what we're hoping for When you use the html:form tag (and corresponding input tags from the html tag lib) on a JSP page there's error checking to make sure you have a corresponding get/set method in the ActionForm. If we have the original bean as an instance variable in the ActionForm and have no other getters/setters hardcoded into the ActionForm, won't that cause a compile-time error on the JSP? - Original Message - From: MacKellar, Kimberly [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 15, 2002 2:54 PM Subject: RE: Form - Bean conversion I have instances of beans within the ActionForm and then access them with the name of the bean and the name of the property in the bean when using them in the JSP. The only problem is having non-Strings in the bean. You need to do some sort of conversion within the ActionForm to get around this. Kimberly MacKellar -Original Message- From: John M. Corro [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 2:53 PM To: [EMAIL PROTECTED] Subject: Form - Bean conversion We have a bunch of existing beans that we'd like to use w/ ActionForms. For each bean we'll need to obviously expose the getters/setters in the corresponding ActionForm. The ideal scenario we'd like to see happen is prevent the ActionForms from having all the corresponding getters/setters hardcoded into it. We're ok w/ coding the validate() method for each class by hand, but we'd like to avoid having to code each ActionForm w/ a getter/setter (even if it is templated out for us by a Struts plug in or even a custom written batch file). Has anyone implemented something like this? -- 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: iterate tag with nested collections?
If I understand your structure correctly, something like the following should work strutslogic:iterate id=a name=newBusinessActivityForm property=report.Level1 brstrutsbean:write name=a property=agentName//a strutslogic:iterate id=b name=a property=Level2 brInsured Name: strutsbean:write name=b property=insuredName//a /strutslogic:iterate /strutslogic:iterate Kim MacKellar -Original Message- From: Michelle Popovits [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 3:31 PM To: Struts-User@Jakarta. Apache. Org (E-mail) Subject: iterate tag with nested collections? Hi, I am trying to add a multi-level report to a struts application. So the report structure will be like this: Top Level Details Level 1 Details . Level 2 Details.. Level 2 Details.. Level 2 Details.. Level 2 Details.. Level 1 Details . Level 2 Details.. Level 2 Details.. Level 1 Details . Level 2 Details.. Level 2 Details.. Level 2 Details.. Level 2 Details.. Level 1 Details . Level 2 Details.. Level 2 Details.. I have set up my Value objects like so: ReportVo (top level) inside the ReportVo I have a collection of Level1Vo value objects inside each instance of Level1Vo I have a collection of Level2Vo value objects. This info is passed into my struts jsp page. I am able to show attributes in the top level (ReportVo) and the 1st level (Level1Vo) value objects just fine. My problem now is to get the Level2Vo value object attributes to show up. Here's a hacked sample of the jsp. What I am trying to figure out is how to get the nested iterate tag to work. Each Level1 value object contains a collection of Level 2 objects. strutshtml:form action=newBusinessActivity.do name=newBusinessActivityForm type=com.worldinsure.admintool.report.struts.NewBusinessActivityForm p Top Level: brTotal Number of Submitted Applications: strutsbean:write name=newBusinessActivityForm property=report.submittedCount / brTotal Face Amount: strutsbean:write name=newBusinessActivityForm property=report.faceAmtTotal / p 1st Level p strutslogic:iterate id=a name=newBusinessActivityForm property=report.Level1 brstrutsbean:write name=a property=agentName//a strutslogic:iterate id=b name=newBusinessActivityForm property=report.Level1.Level2 brInsured Name: strutsbean:write name=b property=insuredName//a /strutslogic:iterate /strutslogic:iterate /strutshtml:form Any thoughts on if this could work using struts tags or do I need to resort to java code? Thanks, Michelle -- 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: How to achieve html:cancel but with an image?
html:image src=images/cancel.gif border=0 property=org.apache.struts.taglib.html.CANCEL/ -Original Message- From: Cutrell, George [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 4:45 PM To: 'Struts Users Mailing List' Subject: How to achieve html:cancel but with an image? Is there a way to achieve html:cancel characteristics with an input image? I'd like to call isCancelled() in my perform() method when a cancel image is pressed. Does the HTML tag library support that? Thanks, George Cutrell Technical Manager, Wireless Applications Development Nextel Communications, Inc. Desk: 703.433.8868 Mobile: 703.926.7851 -- 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: How to Forward from one action to another action
You need to add your object to the request or the session. Try adding if (request.equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), oForm); else session.setAttribute(mapping.getAttribute(), oForm); Where your struts-config.xml contains something like action path=/getCustomerInfo type=com.yourpackage.GetCustomerInfoAction name=oForm scope=request validate=false forward name=browse path=/browse.jsp/ /action -Original Message- From: Leena [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 12:14 AM To: [EMAIL PROTECTED] Subject: How to Forward from one action to another action Hi All, Here is the code which i've written in my action class. ABCustomerInfo[] oCustInfo = remote.searchAddressBookByCriteria (iPartnerId,iBusinessId,data,true); System.out.println(Number of Customers +oCustInfo.length); oForm.setCustomers(oCustInfo); ActionForward forward = mapping.findForward(browse); return (forward); Here it gets the data from the remote object. But when i go to the forwarded browse file, i am getting customerinfo object as null. It says it is not set. Can anyone help me to fix this? Thanks and Regards Leena -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Problem with bean:define?
This is happening because when you click submit and go to validate(...) in your form class a new form is created and populated with the request parameters from the JSP page. So if you don't have postDate as a hidden field or put the form in session the value will be lost. Ted posted a message on this topic not too long ago about how to handle this situation. Kimberly MacKellar -Original Message- From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 9:16 AM To: 'Struts Users Mailing List' Subject: RE: Problem with bean:define? Well, I did a test and bean:write displays the date the first time thru, but then displays nothing when I return to the page to display validation errors? Why would this value be getting cleared in my form? I null out all my fields in the reset method including this 'postDate' property. Any ideas? -Original Message- From: Keith Bacon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 7:15 AM To: Struts Users Mailing List Subject: RE: Problem with bean:define? are you saying your jsp is getting null pointer excp in setAttribute() in the bean:define tag? does this work? bean:write name=editRegForm property=postDate / Keith. (not much use I suspect - try my best!). --- Siggelkow, Bill [EMAIL PROTECTED] wrote: Specifically, I am trying to use the define tag to define a variable based on a property of the FormBean as follows: (the getLocalDate is my own tag for rendering dates. bean:define id=postDate name=editRegForm property=postDate type=java.util.Date/ mir:getLocalDate date=%=postDate% style=long/ -Original Message- From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 11:33 AM To: '[EMAIL PROTECTED]' Subject: Problem with bean:define? I am using the bean:define tag to make a variable available ... he's the wierd part ... it works the first time I enter the form ... but if I return to the form because of a validation error ... it fails with a NullPointerException in the pageContext.setAttribute method ... it seems to me the second time around it is not finding the value for some reason ... any ideas? Bill Siggelkow eBusiness Lead Developer 678.579.6458 Mirant http://www.mirant.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] __ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.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: embed html tags in the javabeans.
Set the filter attribute of bean:write to false. Kimberly MacKellar -Original Message- From: John Ng [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 1:25 PM To: Struts Users Mailing List Subject: embed html tags in the javabeans. Hi, I have a javabean with one method returning a string containing HTML tags. However, it seems that the when I use bean:write to write out the string, those html tags got printed on the screen instead of got interpreted by the brower. What should I do if I want a get method in a bean to return a string containg HTML tags which later gets interpreted by the browser? Thanks John __ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.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]
Poolman question
I know this is off subject but I can't find a poolman mailing list and I know there are people on this list using Poolman... I'm running struts-1.0 on a windowNT machine with tomcat-3.2.3. I have multiple webapps running under the same server. I just set up a new webapp that uses poolman. The problem is that when I try to access the datasource I've configured in the new webapp, poolman appears to be looking in other webapps' WEB-INF/classes directory for the poolman.xml file and isn't finding the data source for the new webapp. Has anyone else seen this or know how to fix it? Also when I try to call conn.close() (conn is of type Connection) I get the following exception: java.lang.NullPointerException at java.util.Hashtable.containsKey(Hashtable.java:299) at com.codestudio.util.JDBCPool.returnPooledStatement(Unknown Source) at com.codestudio.sql.PoolManPreparedStatement.close(Unknown Source) at com.codestudio.util.JDBCPool.closeStatement(Unknown Source) at com.codestudio.sql.PoolManConnection.clean(Unknown Source) at com.codestudio.util.JDBCPool.returnConnection(Unknown Source) at com.codestudio.util.JDBCPool.connectionClosed(Unknown Source) at com.codestudio.sql.PoolManConnection.sendCloseEvent(Unknown Source) at com.codestudio.sql.PoolManConnectionHandle.close(Unknown Source) at com.tfp.admintool.database.FileTypeDatabase.getFieldList(FileTypeDatabase.ja va:256) at com.tfp.admintool.fileType.EditTagListAction.performAction(EditTagListAction .java:56) at com.tfp.admintool.ValidatedAction.perform(ValidatedAction.java:40) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1786) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81 2) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] (847) 933-8005 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Poolman question
I'm not sure how my connection could be null at the point I try to close it. Following is one of the methods where I'm having this problem. If I uncomment the conn.close() in the try block, I get the exception I sent earlier. public static Vector getFileTypeIdList() { Vector results = new Vector(); Connection conn = null; try { conn = Database.getConnection(); CallableStatement stmt = conn.prepareCall(GET_FILE_TYPE_ID_LIST); stmt.registerOutParameter(1, OracleTypes.CURSOR); stmt.execute(); ResultSet rs = (ResultSet)stmt.getObject(1); while(rs.next()) { results.add(rs.getString(FieldMappingsFileType.FILE_TYPE_ID)); } //conn.close(); //conn = null; } catch (SQLException sqle) { cat.error(getFileTypeIdList: + sqle.getMessage()); try { if(!conn.isClosed()) { //conn.close(); //conn = null; } } catch(SQLException sqle1) { cat.fatal(getFileTypeIdList: + sqle1.getMessage()); } } if(results.size() 0) { return results; } else { return null; } } -Original Message- From: Nathan Anderson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 4:35 PM To: Struts Users Mailing List Subject: RE: Poolman question When you call conn.close() it can throw an SQLException so you should put it in a try catch block with an empty catch. But this is not the problem you have. In your case conn is already null. So you should have something like this: try { if (resultSet!=null) resultSet.close(); if (statement!=null) statement.close(); if (connection!=null) connection.close(); } catch (SQLException sqle) { } Hope that helps :) Nathan Anderson -Original Message- From: MacKellar, Kimberly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 2:16 PM To: Struts-User (E-mail) Subject: Poolman question I know this is off subject but I can't find a poolman mailing list and I know there are people on this list using Poolman... I'm running struts-1.0 on a windowNT machine with tomcat-3.2.3. I have multiple webapps running under the same server. I just set up a new webapp that uses poolman. The problem is that when I try to access the datasource I've configured in the new webapp, poolman appears to be looking in other webapps' WEB-INF/classes directory for the poolman.xml file and isn't finding the data source for the new webapp. Has anyone else seen this or know how to fix it? Also when I try to call conn.close() (conn is of type Connection) I get the following exception: java.lang.NullPointerException at java.util.Hashtable.containsKey(Hashtable.java:299) at com.codestudio.util.JDBCPool.returnPooledStatement(Unknown Source) at com.codestudio.sql.PoolManPreparedStatement.close(Unknown Source) at com.codestudio.util.JDBCPool.closeStatement(Unknown Source) at com.codestudio.sql.PoolManConnection.clean(Unknown Source) at com.codestudio.util.JDBCPool.returnConnection(Unknown Source) at com.codestudio.util.JDBCPool.connectionClosed(Unknown Source) at com.codestudio.sql.PoolManConnection.sendCloseEvent(Unknown Source) at com.codestudio.sql.PoolManConnectionHandle.close(Unknown Source) at com.tfp.admintool.database.FileTypeDatabase.getFieldList(FileTypeDatabase.ja va:256) at com.tfp.admintool.fileType.EditTagListAction.performAction(EditTagListAction .java:56) at com.tfp.admintool.ValidatedAction.perform(ValidatedAction.java:40) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1786) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81 2) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run
RE: Poolman question
This design looks good. I'm going to add the finally. I don't mean to harp on the point but how is it that the connection would be null if I'm never setting it to null. I see some problems which appear to be related to connections not getting closed and I'm worried that the problem I'm having with closing the connection is causing this. Kim -Original Message- From: Robert Parker [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 5:23 PM To: Struts Users Mailing List Subject: Re: Poolman question Whilst we're on the exception handling design, you could consider the following design... The point is that under all circumstances, you want to close your resources, so consider putting them in a finally block. That way you don't have to duplicate your close statements... try { ... } catch(SQLException e) { ... } finally { try { if (null != conn) { conn.close(); } ... } catch(Exception) { } } - Original Message - From: MacKellar, Kimberly [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 19, 2001 9:57 AM Subject: RE: Poolman question I'm not sure how my connection could be null at the point I try to close it. Following is one of the methods where I'm having this problem. If I uncomment the conn.close() in the try block, I get the exception I sent earlier. public static Vector getFileTypeIdList() { Vector results = new Vector(); Connection conn = null; try { conn = Database.getConnection(); CallableStatement stmt = conn.prepareCall(GET_FILE_TYPE_ID_LIST); stmt.registerOutParameter(1, OracleTypes.CURSOR); stmt.execute(); ResultSet rs = (ResultSet)stmt.getObject(1); while(rs.next()) { results.add(rs.getString(FieldMappingsFileType.FILE_TYPE_ID)); } //conn.close(); //conn = null; } catch (SQLException sqle) { cat.error(getFileTypeIdList: + sqle.getMessage()); try { if(!conn.isClosed()) { //conn.close(); //conn = null; } } catch(SQLException sqle1) { cat.fatal(getFileTypeIdList: + sqle1.getMessage()); } } if(results.size() 0) { return results; } else { return null; } } -Original Message- From: Nathan Anderson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 4:35 PM To: Struts Users Mailing List Subject: RE: Poolman question When you call conn.close() it can throw an SQLException so you should put it in a try catch block with an empty catch. But this is not the problem you have. In your case conn is already null. So you should have something like this: try { if (resultSet!=null) resultSet.close(); if (statement!=null) statement.close(); if (connection!=null) connection.close(); } catch (SQLException sqle) { } Hope that helps :) Nathan Anderson -Original Message- From: MacKellar, Kimberly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 2:16 PM To: Struts-User (E-mail) Subject: Poolman question I know this is off subject but I can't find a poolman mailing list and I know there are people on this list using Poolman... I'm running struts-1.0 on a windowNT machine with tomcat-3.2.3. I have multiple webapps running under the same server. I just set up a new webapp that uses poolman. The problem is that when I try to access the datasource I've configured in the new webapp, poolman appears to be looking in other webapps' WEB-INF/classes directory for the poolman.xml file and isn't finding the data source for the new webapp. Has anyone else seen this or know how to fix it? Also when I try to call conn.close() (conn is of type Connection) I get the following exception: java.lang.NullPointerException at java.util.Hashtable.containsKey(Hashtable.java:299) at com.codestudio.util.JDBCPool.returnPooledStatement(Unknown Source) at com.codestudio.sql.PoolManPreparedStatement.close(Unknown Source) at com.codestudio.util.JDBCPool.closeStatement(Unknown Source) at com.codestudio.sql.PoolManConnection.clean(Unknown Source) at com.codestudio.util.JDBCPool.returnConnection(Unknown Source) at com.codestudio.util.JDBCPool.connectionClosed(Unknown Source) at com.codestudio.sql.PoolManConnection.sendCloseEvent(Unknown Source) at com.codestudio.sql.PoolManConnectionHandle.close(Unknown Source) at com.tfp.admintool.database.FileTypeDatabase.getFieldList(FileTypeDatabase.ja va:256) at com.tfp.admintool.fileType.EditTagListAction.performAction(EditTagListAction .java:56) at com.tfp.admintool.ValidatedAction.perform(ValidatedAction.java:40
Mutliple lines of Form Fields from Iteration
I have a class called Tags which contains 5 fields each of which is a String. In an action form, I have a Vector of Tags. I need to be able to iterate over the vector to print out the values contained in tags as form fields that will then be submitted and hopefully put back into the Vector of Tags. I know how to print out the vector of tags but I'm wondering if I specify that the form field is indexed, how does that information look to the form? Does it get put into the vector as tag values or something else? Is indexing only in the nightly builds? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Question Regarding Cookies
Could you do the following? bean:cookie id=cookies name=.. multiple=true/ logic:iterate id=fav name=cookies scope=page bean:write name=fav property=value /br /logic:iterate Kimberly MacKellar -Original Message- From: Juan Alvarado [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 3:35 PM To: Struts Subject: Question Regarding Cookies Hello: I am using the following code to handle some cookies in a page: % Cookie[] cookies = request.getCookies(); pageContext.setAttribute(cookies, cookies); % logic:iterate id=fav name=cookies scope=page bean:write name=fav property=value /br /logic:iterate What I'd like to know is if it is possible to lose the scriptlet above and replace it with some struts specific tag and still keep the basic functionality of the code. Thanks in advance from a struts beginner. ** Juan Alvarado Internet Developer -- Manduca Management (786)552-0504 [EMAIL PROTECTED] AOL Instant Messenger: [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: Use Request Attribute in message tag
Is it because of the typo? bean:message key=%=request.getAttribute(errorMessage)%/ Kimberly MacKellar -Original Message- From: Rooms, Christoph [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 9:03 AM To: 'Struts Users Mailing List' Subject: Use Request Attribute in message tag Hi, I'm using Struts 1.0. I want to put a localized message on the error.jsp. Therefor when I have an error in my action, I will fill up an attribute in the request with the locale key. And then use this tag in my error.jsp ... bean:message key=%=request.getAttribute(errorMessage%)/ But ... It doesn't work ... Anyone knows how do this ? Thanks! Christoph Rooms -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Help-URGENT!!
You can do a bean:size id=vectorSize... to the size of the vector. Then do a logic:equal value=0 name=vectorSize I think this should work but haven't tried it. -Original Message- From: Francois Duchaussoy [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 4:13 PM To: 'Struts Users Mailing List' Subject: RE: Help-URGENT!! Have a look to Struts Logic Tag logic:equal -Original Message- From: Ashoka Murthy [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 11:17 AM To: [EMAIL PROTECTED] Subject: Help-URGENT!! I have a vector object available in request. Now I want to check in the JSP whether its size is 0 or more, if it is 0 I want to print a message No Data available in the jsp. I want to know how to do this in Struts framework? Thanks Ashoka Murthy _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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]
multiple select
Hi All, I have a JSP that contains bean:define id=notAssociated name=editAssociationsForm property=notAssociatedInsts/ td html:select size=10 property=newAssociations multiple=true style=width=206; html:options collection=notAssociated property=value labelProperty=label/ /html:select /td notAssociated is an ArrayList of LabelValueBeans when i submit the form containing this snippet it gets sent to an action that contains the following code ... EditAssociationsForm assocForm = (EditAssociationsForm)form; String[] blah = assocForm.getNewAssociations(); if(blah == null) { cat.debug(blah is null); } else { cat.debug(blah length= + blah.length); for(int x=0; xblah.length; x++) { cat.debug(blah[x]); } } this is always printing blah length=0 the EditAssociationsForm contains the following ... private String[] newAssociations; public void reset(ActionMapping mapping, HttpServletRequest request) { selectedAccount = null; associatedInsts = null; notAssociatedInsts = null; if(newAssociations != null) { System.out.println(newAssoc length= + newAssociations.length); for(int i=0; inewAssociations.length; i++) { System.out.println(assoc= + newAssociations[i]); } } else { System.out.println(newAssociations is null); } newAssociations = new String[0]; } public void setNewAssociations(String[] newAssociations) { System.out.println(newAssociations= + newAssociations.length); newAssociations = newAssociations; } public String[] getNewAssociations() { return newAssociations; } ... This prints newAssociations is null and newAssociations=num selected in jsp which means reset is being called then the value is being set. I don't see any other print outs from this code to indicate reset is being called again. and my struts config contains ... action path=/saveAssociations type=com.tfp.admintool.account.SaveAssociationsAction name=editAssociationsForm scope=request validate=false forward name=success path=/main.jsp/ /action ... Does anyone see why the reset appears to be getting called or why the length of the array is always being set to 0? My head is starting to hurt from banging it against the wall... Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Sorting at client side
How are you storing the information in the columns? Kim -Original Message- From: Rajeshwar Rao V [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 31, 2001 2:05 PM To: Struts Users Mailing List Subject: Sorting at client side Hi , We are displaying data in tabular form in a JSP. I want to sort it on column name. How can i do it at JSP level? we are using Struts in our application.Please help if anybody worked on same kinda stuff. Thnaks in advance raj -- 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]
multiple params on link
I have an iterate tag and the body of this tag prints out a link to forward. I need to pass multiple parameters to the link one of which is a property of the current bean in the iteration. I tried doing the following : % java.util.HashMap args = new java.util.HashMap(2); args.put(adjType, send); % logic:iterate id=result name=searchadjustments property=results scope=session offset=%=fromRecord% length=20 % args.put(adjId, ((com.tfp.adjustments.search.AdjustmentSummaryBean)result).getAdjid()); % tr%=(oddRow=!oddRow)?odd:% tdnbsp;nbsp;html:link forward=getAdjustment name=args scope=pagebean:write name=result property=senderRef filter=true//html:linknbsp;/td /tr /logic:iterate I get the error: javax.servlet.ServletException: Cannot find bean args in scope page How can I make the HashMap accessible to the link tag or is there a better way to do this? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED]
RE: porb:
bean:write property=variable1/ -Original Message- From: Dua, Amit [mailto:[EMAIL PROTECTED]] Sent: Friday, October 19, 2001 12:24 PM To: '[EMAIL PROTECTED]' Subject: porb: how to write equivalent of %=variable1% in stuts
RE: REPOST: A hint how to do the following with a bean.
To get the first element of the Vector set the length=1 in the iterate tag for example: logic:iterate id=currRecord name=beanName property=vectorName length=1 bean:write name=currRecord property=name/ bean:write name=currRecord property=desc/ bean:write name=currRecord property=price/ bean:write name=currRecord property=storeroom/ bean:write name=currRecord property=buyer/ /logic:iterate Then to read the rest of the entries in the vector set the offset of the iterate to such as: logic:iterate id=currRecord name=beanName property=vectorName offset=1 bean:write name=currRecord property=name/ bean:write name=currRecord property=desc/ bean:write name=currRecord property=price/ bean:write name=currRecord property=storeroom/ bean:write name=currRecord property=buyer/ /logic:iterate Kimberly MacKellar -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 04, 2001 7:17 AM To: Struts Subject: REPOST: A hint how to do the following with a bean. Hi, Need a hint on how to do the following: I have a bean which is a vector of items. Each item object has a name, description price etc. When the user selects an item I create this vector and pass it to a page which iterates through the vector and creates a table. Something like: name desc price storeroombuyer The table I get has the same data for the first two rows. I want to take out those first two rows and place them into the table caption. Without iterating through the vector how can I get the name and desc property of the first item. That data is going to be the same for all the other items in the vector. Thanks for any help. Alex
RE: How to mapping to a action class instead of a JSP file ?
In your struts-config.xml put action... forward name=success path=/nextAction.do / /action Kim -Original Message- From: Julia Yang [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 13, 2001 4:20 PM To: [EMAIL PROTECTED] Subject: How to mapping to a action class instead of a JSP file ? Hi, Does any one know how mapping to a action class instead of a JSP file in your Action class. In other word, when you return return (mapping.findForward(success)); how do you set success is another xxxAction class instead of a xxx.jsp file Thanks Julia
RE: Application scope objects
I created a servlet that is loaded at server initialization by including the following in web.xml servlet servlet-nameInitialization/servlet-name servlet-classcom.tfp.fraudban.InitializationServlet/servlet-class load-on-startup1/load-on-startup /servlet and in the init method of InitializationServlet I make a call like getServletContext().setAttribute(returnTypes, list); which saves an ArrayList list into the attribute returnTypes in the servlet's context. list is being populated by some calls to the database. Kim -Original Message- From: Debasish Ghosh [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 13, 2001 4:24 PM To: [EMAIL PROTECTED] Subject: Application scope objects Hi All - In my application, I would like to cache some of the objects at the application scope in order to reduce database access. What is the most recommended way of achieving this in Struts ? Should I make them members of OurActionServlet, which is derived from ActionServlet ? Please suggest. Regards. - Debasish __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
RE: Does html:errors not work proper?
Are all of your errors defined in the ApplicationResources.properties? Kim MacKellar -Original Message- From: Marcel Andres [mailto:[EMAIL PROTECTED]] Sent: Monday, September 10, 2001 10:06 AM To: struts-user Subject: Does html:errors not work proper? Hi there Like most of you, I am using the html:errors-tag to show errors on the JSP page. My problem is, that I don't get any message on the JSP page. I do the following check before I return to the form: if (!errors.empty()) { saveErrors(request, errors); return (new ActionForward(mapping.getInput())); } When I check the values, errors.empty() it is set to false, and the value for errors.size() is 1. On the JSP, I am using a template with header, main, and footer. In the header I declared this: %@ page language=java % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % !- Handling the Errors - table border=0 cellspacing=0 cellpadding=0 width=100% height=18 tr font class=error html:errors/ /font /tr /table Any comments would be appreciated. Marcel
Link Tag Parameters
I have a bean that is being stored in the Session which contains a caseId and a HashMap of related items. In my JSP page I print the caseId and then iterate over the HashMap and print out its key and value Object. During this iteration I need to be able to print out a link tag that will go to an action with the caseId and the key of the HashMap. I know I can't use the paramId/paramName/paramValue because I need more than one argument added to the query string. But I also can't create a Map for the query parameters because the Map is changing with each iteration and the HashMap doesn't have a reference to the caseId. How can I create a Map that will change with the iterations? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED]
Multipart Request
I have a form that submits a file to an action (UploadImageAction). After the action has finished processing the file it forwards to another Action that retrieves data to display a page. When the forward is invoked in UploadImageAction I get the following error javax.servlet.ServletException: MultipartIterator: no multipart request data sent at org.apache.struts.upload.MultipartIterator.parseRequest(MultipartIterator.ja va:341) at org.apache.struts.upload.MultipartIterator.(MultipartIterator.java:152) Is there a way to reset something in the request to prevent this from happening? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] (847) 933-8005
FormFile
I am trying to upload an image to my local tomcat server. I have created a bean called ImageUploadForm that contains FormFile imageFile; public void setImageFile(FormFile imageFile) { this.imageFile = imageFile; } public FormFile getImageFile() { return imageFile; } and a JSP file that contains html:file property=imageFile / When I submit the JSP page the appropriate form is attempting to be populated but I get the error java.lang.IllegalArgumentException: argument type mismatch in the browser I changed the imageFile to be of type Object and printed out imageFile.getClass().getName() to see what was acutally getting passed to the form and it turns out to be a String! Does anyone know what might be causing this? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] (847) 933-8005
RE: New Release
Well if I move the jar file to the correct directory, it all seems to work... Amazing : -Original Message- From: MacKellar, Kimberly Sent: Thursday, August 09, 2001 10:39 AM To: '[EMAIL PROTECTED]' Subject: RE: New Release Chris, This isn't exactly struts related... How did you add back-port the tags? I ran jar uf struts.jar org\apache\struts\taglib\logic\EmptyTag.class and the same for NotEmpty.class. I also copied over the struts-logic.tld to my WEB-INF directory. When I restart Tomcat and try to access a page that uses the notEmpty tag I get Unable to load class org.apache.struts.taglib.logic.NotEmptyTag. Do I need to add the class files to the manifest of my struts.jar or is it something else? Kim -Original Message- From: Assenza, Chris [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 09, 2001 7:55 AM To: '[EMAIL PROTECTED]' Subject: RE: New Release Just to confirm what Craig said, back-porting them to 1.0 appears to be 100% problem-free. Once I saw those tags and was informed they were in the nightly build, I grabbed them (along with TLD stuff, etc.) and dropped them in our existing struts.jar (1.0); the tags work flawlessly and are quite useful. :-) Chris -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 9:09 PM To: Struts-User (E-mail) Subject: Re: New Release On Wed, 8 Aug 2001, MacKellar, Kimberly wrote: When is the new release of struts coming out (I really would like to use the logic:notEmpty tag)? If you're planning on waiting for a 1.1 release, we haven't really talked about it yet. I know there's quite a bit of stuff yet to integrate - in the mean time, you could either use a 1.1 nightly build, or back-port logic:empty and logic:notEmpty) into 1.0 (there should not be a problem doing this). What happened to PropertyUtils in the nightly builds? This class (and the digester stuff) now uses the packages from jakarta-commons for this. They have the same functionality but different package names. (The classes are in the commons-*.jar files). Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED] Craig
Iterate with offset=parameter
I am trying to iterate over a Vector using the logic:iterate tag. Everything works fine until I try to set an offset. The offset for where I need to start iterating from is passed in as a parameter to the page and I retrieve it using bean:parameter id=fromRecord name=FROMRECORD value=0/ when I try to use fromRecord in the iterate tag logic:iterate id=result name=search scope=session indexId=resultsPrinted offset=fromRecord length=20 I get the following on the page javax.servlet.ServletException: java.lang.String This makes sense since fromRecord is of type String and offset is expecting an int or Integer. So I then tried to make the offset a variable using % int fromRec = Integer.parseInt(fromRecord); % and logic:iterate id=result name=search scope=session indexId=resultsPrinted offset=fromRec length=20 This doesn't throw an error but doesn't set the correct offset and is always starting from 0. How can I retrieve the parameter and use it in the iterator? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED]
New Release
When is the new release of struts coming out (I really would like to use the logic:notEmpty tag)? What happened to PropertyUtils in the nightly builds? Kimberly MacKellar Thomson Financial Publishing [EMAIL PROTECTED]