image from database servlet problem -- pooling issue?
I am seeing strange behaviour with a servlet I wrote to return an image from a database table. I'm not sure if it's struts related or not, but I am relying on a datasource defined in the struts-config.xml. It might be a silly mistake in the servlet code itself even. I've attached the struts-config.xml which shows my datasource definition, the web.xml where I define the servlet and provide an initialization parameter, the servlet code (PhotoServlet.java) and a simple test.jsp page. The code I have seems to work most of the time (about 25/30 requests) before failing a couple of times. The log.txt attachment shows the result of doing: while true do lwp-request \ 'http://localhost:8080/shona/servlets/photo?id=1class=thumbnail' \ | wc -c done (just sequential requests) The error.txt attachment shows the exception information generated when a request fails. Note there seem to be two types of exceptions occuring here: a low level jdbc error, and a no results returned error. I've played with the maxCount and minCount parameters in the struts datasource definition. Same results, except in the case of several simultaneous requests to the servlet -- in which case raising maxCount seems to prolong the interval between exceptions. It's really been baffling me for a while now. What could be going wrong? Am I seeing a limitation of Struts' connection pool perhaps? Even if it's not struts related, suggestions would still be very welcome. Matt /* * PhotoServlet.java * * Created on February 23, 2002, 2:53 AM */ package mbkennedy.pshop.servlets; import javax.servlet.*; import javax.servlet.http.*; import javax.sql.*; import java.io.*; import java.sql.*; /** * * @author mkennedy * @version */ public class PhotoServlet extends org.apache.struts.action.ActionServlet { private static final long DEFAULT_BUFFER_SIZE = 1024; /** * bufferSize to use when transfering blob to servlet response. */ private long bufferSize; private DataSource dataSource = null; /** * Initializes the servlet. */ public void init(ServletConfig config) throws ServletException { super.init(config); String bufferSizeParam = null; if ((bufferSizeParam = config.getInitParameter(bufferSize)) != null) { // Servlet deployer intends to override default bufferSize this.bufferSize = Long.parseLong(config.getInitParameter(bufferSize)); if (this.bufferSize = 0) { throw new ServletException(bufferSize must be 0: bufferSize == + this.bufferSize); } } else { this.bufferSize = this.DEFAULT_BUFFER_SIZE; } dataSource = this.findDataSource(default); } /** * Processes requests for both HTTP codeGET/code and codePOST/code methods. * * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Check request parameters if (request.getParameter(id) == null || request.getParameter(class) == null) { throw new ServletException(invalid request parameters: id = + request.getParameter(id) + , class = + request.getParameter(class)); } // Validate parameters int paramId = 0; try { paramId = Integer.parseInt(request.getParameter(id)); } catch (NumberFormatException e_nf) { throw (ServletException) new ServletException(id must be an integer: id = + request.getParameter(id)).initCause(e_nf); } Connection conn = null; try { String paramClass = null; conn = this.dataSource.getConnection(); PreparedStatement stmt1 = conn.prepareStatement(SELECT class FROM image_class WHERE class = ?); stmt1.setString(1, request.getParameter(class)); if (stmt1.executeQuery().getFetchSize() == 0) { throw new ServletException(class is invalid: class = + request.getParameter(class)); } else { paramClass = request.getParameter(class); } stmt1.close(); // At this point parameters have been validated for correctness (it // should be safe to process the request) PreparedStatement stmt2 = conn.prepareStatement(SELECT image, mime_type + FROM item_photos WHERE (item_id = ?) AND (image_class = ?)); stmt2.setInt(1, paramId); stmt2.setString(2, paramClass); ResultSet results = stmt2.executeQuery(); ServletOutputStream out = response.getOutputStream(); if (results.getFetchSize() == 0) {
Refeshing mechanism in Struts
Can anyone tell me how I can get my EJB business logic to automatically update the JSP pages when changes occur within the business logic. I know how to write a listener interface, but I am not sure what to trigger in the struts framwork when an update is required. TIA Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Using Struts to capture form grid info
I have a form that has an HTML table of text inputs. Each row of inputs has a unique identifier that I can map to it. I can also map the column names to a column name in the db. I was thinking that I could construct the name of each input in such a way as to extract the id and column name from each when posting the form to the server. For example, html:form action=myAction.action table tr tdhtml:text property=week1_monday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week1_tuesday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week1_wednesday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week1_thursday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week1_friday_myDailyValue size=20 maxlength=20//td /tr tr tdhtml:text property=week2_monday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week2_tuesday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week2_wednesday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week2_thursday_myDailyValue size=20 maxlength=20//td tdhtml:text property=week2_friday_myDailyValue size=20 maxlength=20//td /tr /table /html:form My question is... Is there a Struts way of doing this? How would I construct the Form object to create a collection of information? Any help is appreciated. Thanks. Andrew -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [Off-Topic ?] Problem with Struts/Tomcat/Jbuilder/ ?
Hi David, you're probably right, but I tried to look at every reference Jbuilder makes about required libraries. And the only one I found was the one in Project / Project Properties / Path / Required Libraries In that tab, there's a reference to the Servlet library of Tomcat (this is added by default by JBuilder when you create a new JSP). But I didn't find anywhere else a reference to that same library. If it can help, here's the complete messages I have when I start (web run) my project and then stop tomcat: 1/ loading Tomcat D:\JBuilder6\jdk1.3.1\bin\javaw -classpath D:\JBuilder6\jakarta-tomcat-4.0.1\bin\bootstrap.jar;D:\JBuilder6\jdk1.3.1\demo\jfc\Java2D\Java2Demo.jar;D:\JBuilder6\jdk1.3.1\jre\lib\i18n.jar;D:\JBuilder6\jdk1.3.1\jre\lib\jaws.jar;D:\JBuilder6\jdk1.3.1\jre\lib\rt.jar;D:\JBuilder6\jdk1.3.1\jre\lib\sunrsasign.jar;D:\JBuilder6\jdk1.3.1\lib\dt.jar;D:\JBuilder6\jdk1.3.1\lib\htmlconverter.jar;D:\JBuilder6\jdk1.3.1\lib\tools.jar -Dcatalina.home=D:/JBuilder6/jakarta-tomcat-4.0.1 org.apache.catalina.startup.Bootstrap start -config C:\Slimane\TS2\conf\server8080.xml -nonaming HttpConnector Opening server socket on all host IP addresses Starting service Tomcat-Standalone Apache Tomcat/4.0.1 WebappLoader[/TimeSheet]: Deploying class repositories to work directory C:\Slimane\TS2\work\TimeSheet WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/SQL.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\SQL.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/Struts-Layout.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\Struts-Layout.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-beanutils.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-beanutils.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-collections.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-collections.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-dbcp.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-dbcp.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-digester.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-digester.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-logging.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-logging.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-pool.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-pool.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-services.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-services.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/commons-validator.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-validator.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/jdbc2_0-stdext.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\jdbc2_0-stdext.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/struts.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\struts.jar WebappLoader[/TimeSheet]: Deploy JAR /WEB-INF/lib/tiles.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\tiles.jar StandardManager[/TimeSheet]: Seeding random number generator class java.security.SecureRandom StandardManager[/TimeSheet]: Seeding of random number generator has been completed StandardWrapper[/TimeSheet:default]: Loading container servlet default StandardWrapper[/TimeSheet:invoker]: Loading container servlet invoker WebappLoader[]: Deploying class repositories to work directory C:\Slimane\TS2\work WebappLoader[]: Deploy JAR /WEB-INF/lib/SQL.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\SQL.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/Struts-Layout.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\Struts-Layout.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-beanutils.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-beanutils.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-collections.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-collections.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-dbcp.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-dbcp.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-digester.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-digester.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-logging.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-logging.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-pool.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-pool.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-services.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-services.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-validator.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\commons-validator.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/jdbc2_0-stdext.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\jdbc2_0-stdext.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/struts.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\struts.jar WebappLoader[]: Deploy JAR /WEB-INF/lib/tiles.jar to C:\Slimane\TS2\defaultroot\WEB-INF\lib\tiles.jar StandardManager[]: Seeding random number generator
Re: [Newbie] html:link
Hi, Nobody had answered me 'till you did. So, thank you and I will take a look at the java.util.Map :) Friendly Regards, Slimane At 05:05 11/03/2002 +1100, you wrote: Hi Silmane, you may have already received a reply regarding this but none the less this is how I've been doing it. If you place a java.util.Map into the request the html:link tag will then build the parameter list for you where the keys are the parameter names and their values the parameter values (of course). In your case your iterating over a Collection of beans and from that collection you would/could provide a method to return the Map. In my example I have a Vector of 'foo.Bar' objects where Bar objects have a getter method for the map property. My Vector of foo.Bar objects is an attribute of the request stored under the key 'things'. logic:iterate id=bar name=things type=foo.Bar linkname The documentation for the link tag is of course located at: http://jakarta.apache.org/struts/struts-html.html#link There are a couple of restrictions I didn't mention documented there. Someone just helped me out with this a few days ago so to whomever it was thanks. Rob Slimane Zouggari wrote: Hi, I have the following piece of code :type=be.stluc.info.struts.ElementProjetcodpha= cod tac= I was wondering if there's a easier way to do that with the html:link tag ? Thanx in advance, Slimane -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What's the rigth way to do it ?
Hi Bin, I think I wasn't clear enough. Because, that's exactly what I want to do ! :) I just want to have a session scope Object. So, let me reformulate my problem: I have, for example, 3 Strings. The contents of these Strings can dynamically change. These Strings contain different values between each user. So, normally you'll set that values into a cookie placed at the Client's computer. But I don't want to do that, so I was first thinking about a session bean. That bean would contain those Strings and will be instanciated for each user (am I wrong ?). So normally, a session bean will be perfect in that case, won't it ? But, if I understood right, the session bean is placed into the HttpSession object. So, why not place those Strings directly into the HttpSession object ? (using the getAttribute and the setAttribute methods) But, after a second thought, as I don't have only 3 (or 5) Strings to share (between all my Action classes) during a session of a user. I was thinking that maybe, placing those Strings as parameters of my Action classes would be sufficient. So between those 2 solutions, which one is the best ? And is there maybe a better solution ? Voilà, I hope that now I made myself clear (please excuse my poor English :) I also hope, I didn't tell to much stupidities (I'm just a newbie :) Any help would be greatly appreciated ! Friendly Regards, Slimane PS: sorry for the long reply... At 20:31 9/03/2002 -0500, you wrote: Slimane Neither way will work for you as the session object will be for a single user only. Putting things in the URL query string has the same effect. What you should be looking for may be Appliation scope object or some other ways like persist the data to the database or server file etc. Hope this helps. Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: What's the rigth way to do it ? Date: Sat, 09 Mar 2002 23:30:24 +0100 Hi, I have a set of Objects (mainly Strings) that I would like to share inside my web application for each user. So I was thinking about setting all these objects using the HttpSession object. (using the methods getAttribute() and setAttribute()). But in a second thought, as there are only a few String that I need to share. I could easily pass them as parameters to my Action classes. So, I was wondering what's the right way ? If there's only a few Strings, isn't it easier to pass them as parameters instead of using the session object ? Thanx in advance for your replys. Friendly Regards, Slimane -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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]
jsp:includes and STRUT - Response has been committed error
Hi all, Can the following be done using jsp:include and STRUTS? My aim is to have a jsp page that has 3 jsp:includes. And each includes links are (*.do). An example is shown below !-- Section 1 - Load 1st part -- % String path = (String)request.getAttribute(formpath); % % String userid = (String)request.getAttribute(userid); % % if (path != null){ try{% jsp:include page=%=path% flush=true jsp:param name=userid value=%=userid% / /jsp:include %} !-- Section 2 - Load 2nd part -- another jsp:include !-- Section 3 - Load 3rd part -- another jsp:include **Eg: where path = /pages/showsomething.do** I receive an error - Response has already been committed I understand that this is a JSP error and it is due to the fact that response body output has been flushed to the client. Questions --- Is this the right way to go about using includes and STRUT? Is there a work around for this? Thank you in advance Cheers Sam -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: image from database servlet problem -- pooling issue?
try this on your jsp %@ page buffer=2000kb /% From: Matthew Kennedy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: image from database servlet problem -- pooling issue? Date: 10 Mar 2002 02:49:01 -0600 I am seeing strange behaviour with a servlet I wrote to return an image from a database table. I'm not sure if it's struts related or not, but I am relying on a datasource defined in the struts-config.xml. It might be a silly mistake in the servlet code itself even. I've attached the struts-config.xml which shows my datasource definition, the web.xml where I define the servlet and provide an initialization parameter, the servlet code (PhotoServlet.java) and a simple test.jsp page. The code I have seems to work most of the time (about 25/30 requests) before failing a couple of times. The log.txt attachment shows the result of doing: while true do lwp-request \ 'http://localhost:8080/shona/servlets/photo?id=1class=thumbnail' \ | wc -c done (just sequential requests) The error.txt attachment shows the exception information generated when a request fails. Note there seem to be two types of exceptions occuring here: a low level jdbc error, and a no results returned error. I've played with the maxCount and minCount parameters in the struts datasource definition. Same results, except in the case of several simultaneous requests to the servlet -- in which case raising maxCount seems to prolong the interval between exceptions. It's really been baffling me for a while now. What could be going wrong? Am I seeing a limitation of Struts' connection pool perhaps? Even if it's not struts related, suggestions would still be very welcome. Matt PhotoServlet.java error.txt log.txt struts-config.xml web.xml -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What's the rigth way to do it ?
Slimane, I think I now understand what you are asking about. Basically I think your understanding of the session bean is right. In web application, we usually put the session bean as an object in the http session. I think the following are what you may think when deciding which way to use: 1. Do you have an application supporting EJB? Say you do not have it, then you may have to use the http session to achieve this 2. How you want to view those string objects? Are they coupled with any EJB as the bean's internal state? If that is the case, it may be better to go into the bean. This is better from the OOD standpoint 3. Is either of them working? Yes. Technically both should be fine. Thanks, Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What's the rigth way to do it ? Date: Sun, 10 Mar 2002 12:22:10 +0100 Hi Bin, I think I wasn't clear enough. Because, that's exactly what I want to do ! :) I just want to have a session scope Object. So, let me reformulate my problem: I have, for example, 3 Strings. The contents of these Strings can dynamically change. These Strings contain different values between each user. So, normally you'll set that values into a cookie placed at the Client's computer. But I don't want to do that, so I was first thinking about a session bean. That bean would contain those Strings and will be instanciated for each user (am I wrong ?). So normally, a session bean will be perfect in that case, won't it ? But, if I understood right, the session bean is placed into the HttpSession object. So, why not place those Strings directly into the HttpSession object ? (using the getAttribute and the setAttribute methods) But, after a second thought, as I don't have only 3 (or 5) Strings to share (between all my Action classes) during a session of a user. I was thinking that maybe, placing those Strings as parameters of my Action classes would be sufficient. So between those 2 solutions, which one is the best ? And is there maybe a better solution ? Voilà, I hope that now I made myself clear (please excuse my poor English :) I also hope, I didn't tell to much stupidities (I'm just a newbie :) Any help would be greatly appreciated ! Friendly Regards, Slimane PS: sorry for the long reply... At 20:31 9/03/2002 -0500, you wrote: Slimane Neither way will work for you as the session object will be for a single user only. Putting things in the URL query string has the same effect. What you should be looking for may be Appliation scope object or some other ways like persist the data to the database or server file etc. Hope this helps. Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: What's the rigth way to do it ? Date: Sat, 09 Mar 2002 23:30:24 +0100 Hi, I have a set of Objects (mainly Strings) that I would like to share inside my web application for each user. So I was thinking about setting all these objects using the HttpSession object. (using the methods getAttribute() and setAttribute()). But in a second thought, as there are only a few String that I need to share. I could easily pass them as parameters to my Action classes. So, I was wondering what's the right way ? If there's only a few Strings, isn't it easier to pass them as parameters instead of using the session object ? Thanx in advance for your replys. Friendly Regards, Slimane -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CachedRowSet for html:options
http://jakarta.apache.org/struts/doc-1.0.2/struts-html.html#options * If the labelProperty attribute is not specified, the property named by the property attribute will be used to select both the value returned to the server and the label displayed to the user for this option. On Sat, 09 March 2002, Sunder R Somasundaram wrote: Thanks for your reply; it is a select box with single or multiple options. Do I have to put in both the values and the labels even if both are the same? -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 09, 2002 5:03 AM To: [EMAIL PROTECTED] Subject: Re: CachedRowSet for html:options You mean you're displaying a list in a table or you are displaying a select drop-down box? The html:options tag works great with forms, it'll initialize the select box to what's in the form object, and it'll display appropriate labels and set up the appropriate values on each option. You can quite easily use the CachedRowSet.toCollection(column) to return any column of the rowset as a collection. Instead of putting the whole rowset in the session, you'll have to put a collection for the values and a collection for the labels. A few more lines of code, yes, but not exactly difficult. If your lists are just lists and not select boxes (it's not clear from your message), use a logic:iterate tag. On Fri, 08 March 2002, Sunder wrote: Hi, I am currently retrieving a cachedRowSet from a session bean and displaying lists using the rowset. I would like to use the struts html:options tag to do the same, From the documentation, it looks like I have to put this rowset into a collection and use the same. Is there a better way to do this? Thanks, Sunder -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] Find the best deals on the web at AltaVista Shopping! http://www.shopping.altavista.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] Find the best deals on the web at AltaVista Shopping! http://www.shopping.altavista.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What's the rigth way to do it ?
Bin, Thanks for your answer :) The fact is I don't have any EJB. So I think I'll just use the HttpSession object :) And about passing the strings as parameters* of my Action classes ? Was it a bad idea ? If so, why ? * What I mean by parameters is for example doing the following: A HREF=bla.do?param1=dohparam2=goshblabla/A where param1 and param2 are my actual parameters and then in the Action classes, I'll use the getParameter() method Thanks again, Slimane At 10:27 10/03/2002 -0500, Someone poor demented soul by the name of Bin Zhou presented us with the following text which may contain useless information. Slimane, I think I now understand what you are asking about. Basically I think your understanding of the session bean is right. In web application, we usually put the session bean as an object in the http session. I think the following are what you may think when deciding which way to use: 1. Do you have an application supporting EJB? Say you do not have it, then you may have to use the http session to achieve this 2. How you want to view those string objects? Are they coupled with any EJB as the bean's internal state? If that is the case, it may be better to go into the bean. This is better from the OOD standpoint 3. Is either of them working? Yes. Technically both should be fine. Thanks, Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What's the rigth way to do it ? Date: Sun, 10 Mar 2002 12:22:10 +0100 Hi Bin, I think I wasn't clear enough. Because, that's exactly what I want to do ! :) I just want to have a session scope Object. So, let me reformulate my problem: I have, for example, 3 Strings. The contents of these Strings can dynamically change. These Strings contain different values between each user. So, normally you'll set that values into a cookie placed at the Client's computer. But I don't want to do that, so I was first thinking about a session bean. That bean would contain those Strings and will be instanciated for each user (am I wrong ?). So normally, a session bean will be perfect in that case, won't it ? But, if I understood right, the session bean is placed into the HttpSession object. So, why not place those Strings directly into the HttpSession object ? (using the getAttribute and the setAttribute methods) But, after a second thought, as I don't have only 3 (or 5) Strings to share (between all my Action classes) during a session of a user. I was thinking that maybe, placing those Strings as parameters of my Action classes would be sufficient. So between those 2 solutions, which one is the best ? And is there maybe a better solution ? Voilà, I hope that now I made myself clear (please excuse my poor English :) I also hope, I didn't tell to much stupidities (I'm just a newbie :) Any help would be greatly appreciated ! Friendly Regards, Slimane PS: sorry for the long reply... At 20:31 9/03/2002 -0500, you wrote: Slimane Neither way will work for you as the session object will be for a single user only. Putting things in the URL query string has the same effect. What you should be looking for may be Appliation scope object or some other ways like persist the data to the database or server file etc. Hope this helps. Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: What's the rigth way to do it ? Date: Sat, 09 Mar 2002 23:30:24 +0100 Hi, I have a set of Objects (mainly Strings) that I would like to share inside my web application for each user. So I was thinking about setting all these objects using the HttpSession object. (using the methods getAttribute() and setAttribute()). But in a second thought, as there are only a few String that I need to share. I could easily pass them as parameters to my Action classes. So, I was wondering what's the right way ? If there's only a few Strings, isn't it easier to pass them as parameters instead of using the session object ? Thanx in advance for your replys. Friendly Regards, Slimane -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] Bart: Hey, why is it destroying other toys? Lisa: They must have
iterate problem
hi, my problem: i have a bean with two ArrayLists. my action class gets the results from the database and puts them into the appropriate Arraylist. Then the whole bean is appended to the session. so in my view page i would like to iterate thru the ArrayLists of my bean. BUT i need to generate a hyperlink with something like that: a href=link.do?name=*in here the value from arraylist1 from the bean**in here the value from arraylist2 from the bean*/abr .* next hyperlink* . . . how do i have to use the logic:iterate tag? something like that apparently doesn't work logic:iterate name=bean property=arraylist1 id=a1 type=java.lang.String logic:iterate name=bean property=arraylist2 id=a2 type=java.lang.String a href=link.do?name=bean:write name=a1 /bean:write name=a2 //abr /logic:iterate /logic:iterate am i missing something? or do i have to populate my bean differently? Different collection type maybe? thanks, oliver -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: iterate problem
Oliver == Oliver Kiessler [EMAIL PROTECTED] writes: Oliver hi, Oliver my problem: Oliver i have a bean with two ArrayLists. my action class gets the results from Oliver the database and puts them into the appropriate Arraylist. Then the Oliver whole bean is appended to the session. Oliver so in my view page i would like to iterate thru the ArrayLists of my Oliver bean. BUT i need to generate a hyperlink with something like that: Oliver a href=link.do?name=*in here the value from arraylist1 from the Oliver bean**in here the value from arraylist2 from the bean*/abr Oliver .* next hyperlink* Oliver how do i have to use the logic:iterate tag? Oliver something like that apparently doesn't work Oliver logic:iterate name=bean property=arraylist1 id=a1 Oliver type=java.lang.String Oliver logic:iterate name=bean property=arraylist2 id=a2 Oliver type=java.lang.String Oliver a href=link.do?name=bean:write name=a1 /bean:write Oliver name=a2 //abr Oliver /logic:iterate Oliver /logic:iterate Oliver am i missing something? or do i have to populate my bean differently? Oliver Different collection type maybe? So are you saying that your two arraylists have to be iterated in parallel? They have the same number of items and item N from the first arraylist is associated with item N from the second arraylist? If so, I'd recommend you create a new bean class containing the two associated properties, and build a single arraylist of those beans. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm
I'm getting this error message: Cannot retrieve definition for form bean PlayerMessageForm (PlayerMessageForm is a form bean in my project) Here is that path I am following (struts-config entries to follow: 1) (other actions.. omitted for brevity) 2) /messageTypePRE.do, which forwards to... 3) /messaging/start.jsp, which submits to 4) /messageTypePOST.do, which forwards to... 5) /playerListPRE.do, which forwards to... 6) /messaging/playerList.jsp, where I get the error message I know for a fact that the action playerListPRE.do does complete its processing. I verified this with the debugger and also with System.out statements. Its when it tries to load the JSP page, player_list.jsp. that it craps out. Even with the following bare- bones version of player_list.jsp: -- snip -- body html:form action=/editMessage.do /html:form /body -- snip -- I have the following mappings (among others) in my struts-config.xml file: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. action path=/messageTypesPOST type=com.dceg.webapps.messaging.MessageTypeAction name=playerMessageForm scope=request parameter=POST validate=false forward name=allPlayers path=/allPlayers.do / forward name=playerList path=/playerListPRE.do / forward name=gameTypes path=/gameTypesPRE.do / /action action path=/playerListPRE type=com.dceg.webapps.messaging.PlayerListAction name=playerMessageForm scope=request validate=false parameter=PRE forward name=next path=/messaging/player_list.jsp/ /action -- snip -- So what is causing Cannot retrieve definition for form bean PlayerMessageForm error??? Anyone? -- Kevin J. Turner / dot com Entertainment Group 150 Randall Street, Oakville, Ontario L6J 1P4 telephone: 905.337.8524 fax: 905.337.8630 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Problem with Struts, Tiles, getAString, and bean:write
Cedric, Thanks for responding. It's a random problem; hard to reproduce. The app will run fine for a while. However, once a page starts getting the error, it consistently gets it. You can never go back to that page, without rebooting the servlet container. To reproduce it, I'll need to write a test script that looped forever, exercising the app, until the error occured. I'm using JDK 1.3.0, with WebLogic 5.1, SP8. We're upgrading to WebLogic 6.1 sometime this week, so I'll see if that fixes the problem. Upgrading to WebLogic 5.1, SP10 might also fix it. Anyway, it's very perplexing! Steve Molitor [EMAIL PROTECTED] -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 3:22 AM To: Struts Users Mailing List Subject: Re: Problem with Struts, Tiles, getAString, and bean:write It's the first report of such problem. Is it a random problem, or can you reproduce it as you want ? Stack trace indicate a runtime failure. Maybe you can try to recompile Tiles with jars and Java set in your environment. Do you use java1.3 or 1.4 ? Tiles and Struts are compiled with 1.3. Cedric Molitor, Stephen wrote: I'm using Tiles with Struts. In my tiles layout page, I'm setting the title for the page using 'getAsString'. The instantiating page sets the 'title' property using Struts' bean:write tag, to get the internationalized title string. Usually this works. However, sometimes it blows up, with the error message and stack trace below. The same page will work for a while, and then blow up. Once you get the error, that page is hosed up, you have to reboot the servlet server to get back to it. Has anyone seen this error? Any help would be appreciated. Thanks in advance, Steve Molitor [EMAIL PROTECTED] Here's the stack trace: javax.servlet.ServletException: runtime failure in custom tag 'getAsString' at jsp_servlet._jsp._applayout._jspService(_applayout.java:129) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :106) at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp l.java:253) at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp l.java:172) at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:113) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja va:730) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:365) at jsp_servlet._jsp._otherbonusesforrevision._jspService(_otherbonusesforrevisi on.java:232) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :106) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :124) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:154) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1759) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596) at com.erac.fleetsystems.strutsx.FleetSystemsServlet.process(FleetSystemsServle t.java:166) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :106) at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp l.java:907) at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp l.java:851) at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext Manager.java:252) at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:364) at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129) -- 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: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm
Is this a typo or maybe the problem: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. You'll notice that you have ype not type. My names' not Syntax Error for nothing! -Original Message- From: Kevin J. Turner [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 10, 2002 12:57 PM To: Struts Users Mailing List Subject: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm I'm getting this error message: Cannot retrieve definition for form bean PlayerMessageForm (PlayerMessageForm is a form bean in my project) Here is that path I am following (struts-config entries to follow: 1) (other actions.. omitted for brevity) 2) /messageTypePRE.do, which forwards to... 3) /messaging/start.jsp, which submits to 4) /messageTypePOST.do, which forwards to... 5) /playerListPRE.do, which forwards to... 6) /messaging/playerList.jsp, where I get the error message I know for a fact that the action playerListPRE.do does complete its processing. I verified this with the debugger and also with System.out statements. Its when it tries to load the JSP page, player_list.jsp. that it craps out. Even with the following bare- bones version of player_list.jsp: -- snip -- body html:form action=/editMessage.do /html:form /body -- snip -- I have the following mappings (among others) in my struts-config.xml file: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. action path=/messageTypesPOST type=com.dceg.webapps.messaging.MessageTypeAction name=playerMessageForm scope=request parameter=POST validate=false forward name=allPlayers path=/allPlayers.do / forward name=playerList path=/playerListPRE.do / forward name=gameTypes path=/gameTypesPRE.do / /action action path=/playerListPRE type=com.dceg.webapps.messaging.PlayerListAction name=playerMessageForm scope=request validate=false parameter=PRE forward name=next path=/messaging/player_list.jsp/ /action -- snip -- So what is causing Cannot retrieve definition for form bean PlayerMessageForm error??? Anyone? -- Kevin J. Turner / dot com Entertainment Group 150 Randall Street, Oakville, Ontario L6J 1P4 telephone: 905.337.8524 fax: 905.337.8630 -- 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: What's the rigth way to do it ?
Slimane, Passing parameters using query string is ok. There are some benefits you get get like user can book mark it and get back to the page later on easily. The problem with the query string is that there is some size limitation there. I do not remember the exact size of the string you can pass on. It might be something like 8k. A lot of populate site are using this to do it and some application use URL rewriting which basically is passing parameter by query string if the client browser disable the cookies. Hope this help. Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What's the rigth way to do it ? Date: Sun, 10 Mar 2002 17:25:42 +0100 Bin, Thanks for your answer :) The fact is I don't have any EJB. So I think I'll just use the HttpSession object :) And about passing the strings as parameters* of my Action classes ? Was it a bad idea ? If so, why ? * What I mean by parameters is for example doing the following: A HREF=bla.do?param1=dohparam2=goshblabla/A where param1 and param2 are my actual parameters and then in the Action classes, I'll use the getParameter() method Thanks again, Slimane At 10:27 10/03/2002 -0500, Someone poor demented soul by the name of Bin Zhou presented us with the following text which may contain useless information. Slimane, I think I now understand what you are asking about. Basically I think your understanding of the session bean is right. In web application, we usually put the session bean as an object in the http session. I think the following are what you may think when deciding which way to use: 1. Do you have an application supporting EJB? Say you do not have it, then you may have to use the http session to achieve this 2. How you want to view those string objects? Are they coupled with any EJB as the bean's internal state? If that is the case, it may be better to go into the bean. This is better from the OOD standpoint 3. Is either of them working? Yes. Technically both should be fine. Thanks, Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What's the rigth way to do it ? Date: Sun, 10 Mar 2002 12:22:10 +0100 Hi Bin, I think I wasn't clear enough. Because, that's exactly what I want to do ! :) I just want to have a session scope Object. So, let me reformulate my problem: I have, for example, 3 Strings. The contents of these Strings can dynamically change. These Strings contain different values between each user. So, normally you'll set that values into a cookie placed at the Client's computer. But I don't want to do that, so I was first thinking about a session bean. That bean would contain those Strings and will be instanciated for each user (am I wrong ?). So normally, a session bean will be perfect in that case, won't it ? But, if I understood right, the session bean is placed into the HttpSession object. So, why not place those Strings directly into the HttpSession object ? (using the getAttribute and the setAttribute methods) But, after a second thought, as I don't have only 3 (or 5) Strings to share (between all my Action classes) during a session of a user. I was thinking that maybe, placing those Strings as parameters of my Action classes would be sufficient. So between those 2 solutions, which one is the best ? And is there maybe a better solution ? Voilà, I hope that now I made myself clear (please excuse my poor English :) I also hope, I didn't tell to much stupidities (I'm just a newbie :) Any help would be greatly appreciated ! Friendly Regards, Slimane PS: sorry for the long reply... At 20:31 9/03/2002 -0500, you wrote: Slimane Neither way will work for you as the session object will be for a single user only. Putting things in the URL query string has the same effect. What you should be looking for may be Appliation scope object or some other ways like persist the data to the database or server file etc. Hope this helps. Bin From: Slimane [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: What's the rigth way to do it ? Date: Sat, 09 Mar 2002 23:30:24 +0100 Hi, I have a set of Objects (mainly Strings) that I would like to share inside my web application for each user. So I was thinking about setting all these objects using the HttpSession object. (using the methods getAttribute() and setAttribute()). But in a second thought, as there are only a few String that I need to share. I could easily pass them as parameters to my Action classes. So, I was wondering what's the right way ? If there's only a few Strings, isn't it easier to pass them as parameters instead of using the session object ? Thanx in advance for your replys. Friendly Regards, Slimane -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For
RE: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm
On Sun, 10 Mar 2002 13:29:01 -0600, Chris Means wrote: Is this a typo or maybe the problem: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. You'll notice that you have ype not type. My names' not Syntax Error for nothing! No that was just from evidently bad cutting-n-pasting. It *does* have type :P -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: iterate problem
ok. you are right. i created a class class1 with two properties. in the action class i create a bean with an arraylist of all class1 objects. in my view i then iterate thru the arraylist of the bean and display the two properties of type class1. works! thanks, oliver Am Son, 2002-03-10 um 19.00 schrieb David M. Karr: Oliver == Oliver Kiessler [EMAIL PROTECTED] writes: Oliver hi, Oliver my problem: Oliver i have a bean with two ArrayLists. my action class gets the results from Oliver the database and puts them into the appropriate Arraylist. Then the Oliver whole bean is appended to the session. Oliver so in my view page i would like to iterate thru the ArrayLists of my Oliver bean. BUT i need to generate a hyperlink with something like that: Oliver a href=link.do?name=*in here the value from arraylist1 from the Oliver bean**in here the value from arraylist2 from the bean*/abr Oliver .* next hyperlink* Oliver how do i have to use the logic:iterate tag? Oliver something like that apparently doesn't work Oliver logic:iterate name=bean property=arraylist1 id=a1 Oliver type=java.lang.String Oliver logic:iterate name=bean property=arraylist2 id=a2 Oliver type=java.lang.String Oliver a href=link.do?name=bean:write name=a1 /bean:write Oliver name=a2 //abr Oliver /logic:iterate Oliver /logic:iterate Oliver am i missing something? or do i have to populate my bean differently? Oliver Different collection type maybe? So are you saying that your two arraylists have to be iterated in parallel? They have the same number of items and item N from the first arraylist is associated with item N from the second arraylist? If so, I'd recommend you create a new bean class containing the two associated properties, and build a single arraylist of those beans. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- mailto: [EMAIL PROTECTED] web: http://www.linustar.de gnupg key: http://www.linustar.de/pgp/kiessler.gpg --- Ubi non accusator, ibi non judex. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm
The exception gets thrown from the FormTag in the following code: // Look up the form bean definition FormBeanConfig formBeanConfig = appConfig.findFormBeanConfig(mapping.getName()); if (formBeanConfig == null) { JspException e = new JspException (messages.getMessage(formTag.formBean, mapping.getName())); pageContext.setAttribute(Action.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE); throw e; } If you look at the code, it seems like the only reason this exception is thrown is if it can't find a FormBeanConfig with the name returned by mapping.getName(). I would suggest that you turn your debugging levels up high and look at the log output. It could be something as simple as a ClassPath issue or for some reason, the framework is not able to find or load the .class file. I'm sure that you have ruled out a typo between the form-bean definition and the value used in the action? You could also put a few print lines in the FormTag class and recompile. That would for sure tell you what's going on. Just a few thoughts, Chuck -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: design flaw if using a template...
Hi Matt I have done more research over the weekend and this is what I have found: The multiple *.do only works in Resin, not Tomcat. In Tomcat, this is the exception: javax.servlet.jsp.JspException: Cannot forward after response has been committed Further investigation shows that Tomcat is calling flushBuffer() after the first forward. Resin handles this differently, as shown in this post I found: -Original Message- From: Andreas Junghans [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 22, 2002 1:09 AM To: Tomcat Developers List Cc: [EMAIL PROTECTED] Subject: Re: HttpServletResponseWrapper error. Hi Jay, This works with Resin. However, in Tomcat, when I wrap the response, I commit the original response object and can not forward to a thank you page. I catch a java.lang.IllegalStateException: Cannot forward after response has been committed. In my debug tests, the response is committed during the RequestDispatchers forward method. I've had a similar case. The problem is that Tomcat calls flushBuffer() on the response, which seems to be completely legal regarding the Servlet spec. Calling flushBuffer() commits the response, and after that, no forward is possible. If Resin behaves differently, this is probably due to a different buffer size or different buffer handling. Perhaps Resin doesn't call flushBuffer() at all, which (in my understanding) is just as spec compliant as Tomcat's behaviour. What you have to do is override flushBuffer() in your response wrapper to prevent HttpServletResponseWrapper from passing the flush to the original response. In my case, I simply added an empty flushBuffer() method to the wrapper, and it worked. However, you should note that some containers _might_ rely on the side effects of the original flushBuffer() (e.g. that exceptions are raised when calling methods like sendRedirect() afterwards). Although this is highly unlikely, you have to simulate these effects in your wrapper if you want to be _absolutely_ sure your application runs in every container. Regards Andreas Junghans I have tried the latest version of Tomcat 4.0.3, but no joy. Keith -Original Message- From: Matt Read [mailto:[EMAIL PROTECTED]] Sent: Friday, 8 March 2002 11:04 a.m. To: Struts Users Mailing List Subject: RE: design flaw if using a template... I'm glad you've found a solution. I'd still say you're misusing template:insert though, because it's not really a template that you're inserting but if it works, it works. -Original Message- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 21:15 To: Struts Users Mailing List Subject: RE: design flaw if using a template... Hi Matt I am such an idiot. In my template.jsp, I have: template:insert template=/news.do/ This is equivalent to a jsp include. My mistake was news.do forwards to new.jsp after getting the data from the database. However, news.jsp uses template.jsp too!! So it's trying to go into an infinite loop! I have changed new.jsp to just return the news. It's going well. Thank you very much for all you help. Keith -Original Message- From: Matt Read [mailto:[EMAIL PROTECTED]] Sent: Thursday, 7 March 2002 3:31 p.m. To: Struts Users Mailing List Subject: RE: design flaw if using a template... Keith, they're not the same thing, by any means. As you said, if you use your method: template:insert template=/news.do / you get a too many servlet includes `/template.jsp' error. This is doesn't really suprise me at all - you're basically trying to use something which blatantly isn't a template, as a template. However if you use the method I outlined in my examples, i.e. you put content into a template, whether this content is a .jsp or an action mapping url - it works. Honestly, just use template:put as it is documented and your problems will be solved. Matt. -Original Message- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 02:18 To: Struts Users Mailing List Subject: RE: design flaw if using a template... Hi Matt I will try this again tonight. But I am doing the same as you (well, just another way): In template.jsp, you can either go: template:get name=somecontent/ if you have passed in somecontent to the template, eg in thepage.jsp: template:insert template=/template.jsp template:put name=somecontent content=/news.do / /template:insert This is what you have done. Alternatively, in template.jsp, you can go: template:insert template=/news.do/ if you don't pass somecontent to template.jsp. The line above is just like a jsp:include tag. Anyway, I will test this again tonight. I hope it's something stupid I have done. I will also report the exact exception after the test. Thanks again Matt. Keith -Original Message-
RE: live progress...
Thank you all for your suggestions. I think I'll go for the refresh page approach. Keith -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Saturday, 9 March 2002 10:07 a.m. To: [EMAIL PROTECTED] Subject: Re: live progress... You could search the archives for dynamic web pages - several helpful suggestions given when I posed similar question - pushlets seem pretty funky! Or you can just create the ouput in your action, and stream the info to the page until it's done. Dave Keith Chew [EMAIL PROTECTED] on 03/07/2002 09:01:35 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To:Struts Users Mailing List [EMAIL PROTECTED] cc: (bcc: David Hay/Lex/Lexmark) Subject:live progress... Hi I would like to implement a live progress on a JSP, something like: time = 0s * Synchronizing database... time = 5s * Synchronizing database... DONE! Sending mail to keith... time =10s * Synchronizing database... DONE! Sending mail to keith... DONE! Essentially, I need to flush the ouput to the page correct? Can I do this from the Action class? I doubt this can be achieved because the MVC architecture forces you to prepare the entire data for view. So, you cannot flush part of the view from the Action. Anyone done this kind of thing? Keith -- 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]
Server-side Charting libs?
I was wondering if anyone has any positive experience with open-source charting libraries, with Struts? I need to generate a chart on the server (from a Struts action) and send it back to the client as a Jpeg, PNG, etc. I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at first glance) to have issues with headless environments, which my server definitely is (no X server installed). I'm using JDK 1.3. At one point I read that JDK 1.4 has better support for graphics primitives on headless environments, but I don't know if the above two libraries can take advantage of that. A penny for anyone's thoughts? Bryan
Re: image from database servlet problem -- pooling issue?
From what everyone says, the Struts connection pool is not robust enough to handle much of a load. I would seriously consider snagging Poolman off of sourceforge.net and plugging that into your application to see if you still have the same behavior. HTH - GL Eddie - Original Message - From: Matthew Kennedy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 10, 2002 2:49 AM Subject: image from database servlet problem -- pooling issue? I am seeing strange behaviour with a servlet I wrote to return an image from a database table. I'm not sure if it's struts related or not, but I am relying on a datasource defined in the struts-config.xml. It might be a silly mistake in the servlet code itself even. I've attached the struts-config.xml which shows my datasource definition, the web.xml where I define the servlet and provide an initialization parameter, the servlet code (PhotoServlet.java) and a simple test.jsp page. The code I have seems to work most of the time (about 25/30 requests) before failing a couple of times. The log.txt attachment shows the result of doing: while true do lwp-request \ 'http://localhost:8080/shona/servlets/photo?id=1class=thumbnail' \ | wc -c done (just sequential requests) The error.txt attachment shows the exception information generated when a request fails. Note there seem to be two types of exceptions occuring here: a low level jdbc error, and a no results returned error. I've played with the maxCount and minCount parameters in the struts datasource definition. Same results, except in the case of several simultaneous requests to the servlet -- in which case raising maxCount seems to prolong the interval between exceptions. It's really been baffling me for a while now. What could be going wrong? Am I seeing a limitation of Struts' connection pool perhaps? Even if it's not struts related, suggestions would still be very welcome. Matt -- 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: design flaw if using a template...
Hmm, that's fairly annoying isn't it. I only use Resin myself which is lucky, thanks for pointing this out though, good to know that I can just release my WAR onto tomcat and expect it to work. -Original Message- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: 10 March 2002 20:26 To: Struts Users Mailing List Subject: RE: design flaw if using a template... Hi Matt I have done more research over the weekend and this is what I have found: The multiple *.do only works in Resin, not Tomcat. In Tomcat, this is the exception: javax.servlet.jsp.JspException: Cannot forward after response has been committed Further investigation shows that Tomcat is calling flushBuffer() after the first forward. Resin handles this differently, as shown in this post I found: -Original Message- From: Andreas Junghans [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 22, 2002 1:09 AM To: Tomcat Developers List Cc: [EMAIL PROTECTED] Subject: Re: HttpServletResponseWrapper error. Hi Jay, This works with Resin. However, in Tomcat, when I wrap the response, I commit the original response object and can not forward to a thank you page. I catch a java.lang.IllegalStateException: Cannot forward after response has been committed. In my debug tests, the response is committed during the RequestDispatchers forward method. I've had a similar case. The problem is that Tomcat calls flushBuffer() on the response, which seems to be completely legal regarding the Servlet spec. Calling flushBuffer() commits the response, and after that, no forward is possible. If Resin behaves differently, this is probably due to a different buffer size or different buffer handling. Perhaps Resin doesn't call flushBuffer() at all, which (in my understanding) is just as spec compliant as Tomcat's behaviour. What you have to do is override flushBuffer() in your response wrapper to prevent HttpServletResponseWrapper from passing the flush to the original response. In my case, I simply added an empty flushBuffer() method to the wrapper, and it worked. However, you should note that some containers _might_ rely on the side effects of the original flushBuffer() (e.g. that exceptions are raised when calling methods like sendRedirect() afterwards). Although this is highly unlikely, you have to simulate these effects in your wrapper if you want to be _absolutely_ sure your application runs in every container. Regards Andreas Junghans I have tried the latest version of Tomcat 4.0.3, but no joy. Keith -Original Message- From: Matt Read [mailto:[EMAIL PROTECTED]] Sent: Friday, 8 March 2002 11:04 a.m. To: Struts Users Mailing List Subject: RE: design flaw if using a template... I'm glad you've found a solution. I'd still say you're misusing template:insert though, because it's not really a template that you're inserting but if it works, it works. -Original Message- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 21:15 To: Struts Users Mailing List Subject: RE: design flaw if using a template... Hi Matt I am such an idiot. In my template.jsp, I have: template:insert template=/news.do/ This is equivalent to a jsp include. My mistake was news.do forwards to new.jsp after getting the data from the database. However, news.jsp uses template.jsp too!! So it's trying to go into an infinite loop! I have changed new.jsp to just return the news. It's going well. Thank you very much for all you help. Keith -Original Message- From: Matt Read [mailto:[EMAIL PROTECTED]] Sent: Thursday, 7 March 2002 3:31 p.m. To: Struts Users Mailing List Subject: RE: design flaw if using a template... Keith, they're not the same thing, by any means. As you said, if you use your method: template:insert template=/news.do / you get a too many servlet includes `/template.jsp' error. This is doesn't really suprise me at all - you're basically trying to use something which blatantly isn't a template, as a template. However if you use the method I outlined in my examples, i.e. you put content into a template, whether this content is a .jsp or an action mapping url - it works. Honestly, just use template:put as it is documented and your problems will be solved. Matt. -Original Message- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 02:18 To: Struts Users Mailing List Subject: RE: design flaw if using a template... Hi Matt I will try this again tonight. But I am doing the same as you (well, just another way): In template.jsp, you can either go: template:get name=somecontent/ if you have passed in somecontent to the template, eg in thepage.jsp: template:insert template=/template.jsp template:put name=somecontent content=/news.do / /template:insert This is what you have
Re: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm
Hi The problem should be in your mapping for the editMessage action, since that is what the form refers to. Since the error message has PlayerMessageForm with a capital 'P' and the name in the struts-config for the bean is playerMessageForm with a 'p', you might have that misspelling in the editMessage mapping. Regards. At 13:57 2002-03-10 -0500, you wrote: I'm getting this error message: Cannot retrieve definition for form bean PlayerMessageForm (PlayerMessageForm is a form bean in my project) Here is that path I am following (struts-config entries to follow: 1) (other actions.. omitted for brevity) 2) /messageTypePRE.do, which forwards to... 3) /messaging/start.jsp, which submits to 4) /messageTypePOST.do, which forwards to... 5) /playerListPRE.do, which forwards to... 6) /messaging/playerList.jsp, where I get the error message I know for a fact that the action playerListPRE.do does complete its processing. I verified this with the debugger and also with System.out statements. Its when it tries to load the JSP page, player_list.jsp. that it craps out. Even with the following bare- bones version of player_list.jsp: -- snip -- body html:form action=/editMessage.do /html:form /body -- snip -- I have the following mappings (among others) in my struts-config.xml file: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. action path=/messageTypesPOST type=com.dceg.webapps.messaging.MessageTypeAction name=playerMessageForm scope=request parameter=POST validate=false forward name=allPlayers path=/allPlayers.do / forward name=playerList path=/playerListPRE.do / forward name=gameTypes path=/gameTypesPRE.do / /action action path=/playerListPRE type=com.dceg.webapps.messaging.PlayerListAction name=playerMessageForm scope=request validate=false parameter=PRE forward name=next path=/messaging/player_list.jsp/ /action -- snip -- So what is causing Cannot retrieve definition for form bean PlayerMessageForm error??? Anyone? -- Kevin J. Turner / dot com Entertainment Group 150 Randall Street, Oakville, Ontario L6J 1P4 telephone: 905.337.8524 fax: 905.337.8630 -- 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: Server-side Charting libs?
I use jCharts (jcharts.sourceforge.net) which is the best I've found for the actual chart creation but you still have the same problem with the Java 1.3 AWT libraries needing an X server. I just use Xvfb which seems to work fine, let me know if you need any help configuring it. Other than that I've also looked at the Java 1.4, attempted to follow the instructions at http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb with no luck and went back to Xvfb. Let me know if you get it working. Matt. -Original Message- From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]] Sent: 10 March 2002 22:04 To: [EMAIL PROTECTED] Subject: Server-side Charting libs? I was wondering if anyone has any positive experience with open-source charting libraries, with Struts? I need to generate a chart on the server (from a Struts action) and send it back to the client as a Jpeg, PNG, etc. I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at first glance) to have issues with headless environments, which my server definitely is (no X server installed). I'm using JDK 1.3. At one point I read that JDK 1.4 has better support for graphics primitives on headless environments, but I don't know if the above two libraries can take advantage of that. A penny for anyone's thoughts? Bryan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Server-side Charting libs?
Thanks, I don't know what Xvfb is, can you give me a pointer to an explanation? Is it something that's part of AWT, or part of jCharts, or something else? Thanks, Bryan On Sun, 2002-03-10 at 15:12, Matt Read wrote: I use jCharts (jcharts.sourceforge.net) which is the best I've found for the actual chart creation but you still have the same problem with the Java 1.3 AWT libraries needing an X server. I just use Xvfb which seems to work fine, let me know if you need any help configuring it. Other than that I've also looked at the Java 1.4, attempted to follow the instructions at http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb with no luck and went back to Xvfb. Let me know if you get it working. Matt. -Original Message- From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]] Sent: 10 March 2002 22:04 To: [EMAIL PROTECTED] Subject: Server-side Charting libs? I was wondering if anyone has any positive experience with open-source charting libraries, with Struts? I need to generate a chart on the server (from a Struts action) and send it back to the client as a Jpeg, PNG, etc. I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at first glance) to have issues with headless environments, which my server definitely is (no X server installed). I'm using JDK 1.3. At one point I read that JDK 1.4 has better support for graphics primitives on headless environments, but I don't know if the above two libraries can take advantage of that. A penny for anyone's thoughts? Bryan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Server-side Charting libs?
X Virtual Frame Buffer - it's part of xfree86 and stands in for a full X-server when you don't actually need one, i.e. on a web-server. Have a look at http://www.davisor.com/chart/doc/headless.html and search for How can I setup a virtual framebuffer for Linux?. Matt. -Original Message- From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]] Sent: 10 March 2002 22:21 To: Struts Users Mailing List Subject: RE: Server-side Charting libs? Thanks, I don't know what Xvfb is, can you give me a pointer to an explanation? Is it something that's part of AWT, or part of jCharts, or something else? Thanks, Bryan On Sun, 2002-03-10 at 15:12, Matt Read wrote: I use jCharts (jcharts.sourceforge.net) which is the best I've found for the actual chart creation but you still have the same problem with the Java 1.3 AWT libraries needing an X server. I just use Xvfb which seems to work fine, let me know if you need any help configuring it. Other than that I've also looked at the Java 1.4, attempted to follow the instructions at http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb with no luck and went back to Xvfb. Let me know if you get it working. Matt. -Original Message- From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]] Sent: 10 March 2002 22:04 To: [EMAIL PROTECTED] Subject: Server-side Charting libs? I was wondering if anyone has any positive experience with open-source charting libraries, with Struts? I need to generate a chart on the server (from a Struts action) and send it back to the client as a Jpeg, PNG, etc. I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at first glance) to have issues with headless environments, which my server definitely is (no X server installed). I'm using JDK 1.3. At one point I read that JDK 1.4 has better support for graphics primitives on headless environments, but I don't know if the above two libraries can take advantage of that. A penny for anyone's thoughts? Bryan -- 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: Server-side Charting libs?
Bryan, I don't know what Xvfb is, can you give me a pointer to an explanation? Is it something that's part of AWT, or part of jCharts, or something else? An alternative to Xvfb is the PJA Toolkit: http://www.eteks.com/pja/en/ Cheers, --Bill -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
setting server side parm in Javascript?
Hi Folks: I'm doing a mimic-JTabbedPane approach. I have a screen with 5 tabs.I am using 1 form object and 5 action mappings... On tab 4, I'd like to detect changes made to a field on tab 1. I notice I can change the field on tab 1 but tab 4 does not know about until the form is submitted.I can't submit the form... I'd like to have a Javascript handler that implements the onchange() and somehow sets a session attribute or some kind of trigger that tells tab 4 to reload itself when this field on tab 1 has changed.I notice if I change these values, the form object will not get the new values until you hit submit.Having the javascript function call submit is not an option either... Any ideas on how best to do this?? If I could access my form-bean directly within the Javascript method, that would be an option to (as I could call the set method on the form object) but I am not sure if the javascript can access the form object directly and call a set method? thanks, Theron -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: image from database servlet problem -- pooling issue?
It looks that the problem is in the way you check whether query returned results: --cut--- if (stmt1.executeQuery().getFetchSize() == 0) { throw new ServletException(class is invalid: class = + request.getParameter(class)); --cut--- fetchSize is only a hint for the JDBC driver as to how many records should it fetch from a database. It does not tell you actual number of records returned from your query. You servlet fails when there is no records for a given combination of id and class parameters To check if query returned any records simply use: if (results.next()){ write image to output }else{ //no records found } If there is no image for a given combination id and class you should probably returne 404 status code to the client instead of throwing an exception. Check you access logs to see which requests are causing those errors. Regards, Adam - Original Message - From: Matthew Kennedy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 10, 2002 3:49 AM Subject: image from database servlet problem -- pooling issue? I am seeing strange behaviour with a servlet I wrote to return an image from a database table. I'm not sure if it's struts related or not, but I am relying on a datasource defined in the struts-config.xml. It might be a silly mistake in the servlet code itself even. I've attached the struts-config.xml which shows my datasource definition, the web.xml where I define the servlet and provide an initialization parameter, the servlet code (PhotoServlet.java) and a simple test.jsp page. The code I have seems to work most of the time (about 25/30 requests) before failing a couple of times. The log.txt attachment shows the result of doing: while true do lwp-request \ 'http://localhost:8080/shona/servlets/photo?id=1class=thumbnail' \ | wc -c done (just sequential requests) The error.txt attachment shows the exception information generated when a request fails. Note there seem to be two types of exceptions occuring here: a low level jdbc error, and a no results returned error. I've played with the maxCount and minCount parameters in the struts datasource definition. Same results, except in the case of several simultaneous requests to the servlet -- in which case raising maxCount seems to prolong the interval between exceptions. It's really been baffling me for a while now. What could be going wrong? Am I seeing a limitation of Struts' connection pool perhaps? Even if it's not struts related, suggestions would still be very welcome. Matt -- 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]
nested:iterate - set method not called
Hi, I am able to list the elements on my Vector just fine, but I noticed that when I do a submit the set method is not being called, hence the field is empty when it gets to the action class. Can someone suggest to me what the problem might be? my code is below. thanks, - ej *** code public Vector extrainfo; // call successfully public Object[] getExtrainfo() {...} //Not being called on submit public void setExtrainfo(Object[] infoList) {...} *** code -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: nested:iterate - set method not called
Could it be that the html field in your jsp is named 'extraInfo' (uppercase 'i'), and the setter is using a lowercase 'i' in the word info? Scott -Original Message- From: Elijah Jacobs [SMTP:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 10:27 AM To: Struts Users Mailing List Subject: nested:iterate - set method not called Hi, I am able to list the elements on my Vector just fine, but I noticed that when I do a submit the set method is not being called, hence the field is empty when it gets to the action class. Can someone suggest to me what the problem might be? my code is below. thanks, - ej *** code public Vector extrainfo; // call successfully public Object[] getExtrainfo() {...} //Not being called on submit public void setExtrainfo(Object[] infoList) {...} *** code -- 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: nested:iterate - set method not called
thanks for the reply, Scott My syntax looks okay on the jsp side and since the getExtrainfo method is being called it puzzles me that the set method is not being called on submit. nested:iterate property=extrainfo nested:text property=name/ /nested:iterate - ej - Original Message - From: Barr, Scott [IBM GSA] [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Sunday, March 10, 2002 7:03 PM Subject: RE: nested:iterate - set method not called Could it be that the html field in your jsp is named 'extraInfo' (uppercase 'i'), and the setter is using a lowercase 'i' in the word info? Scott -Original Message- From: Elijah Jacobs [SMTP:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 10:27 AM To: Struts Users Mailing List Subject: nested:iterate - set method not called Hi, I am able to list the elements on my Vector just fine, but I noticed that when I do a submit the set method is not being called, hence the field is empty when it gets to the action class. Can someone suggest to me what the problem might be? my code is below. thanks, - ej *** code public Vector extrainfo; // call successfully public Object[] getExtrainfo() {...} //Not being called on submit public void setExtrainfo(Object[] infoList) {...} *** code -- 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]
Found Solution to setting server side parm in Javascript BUT....
After spending 2 hours trying to find a solution to this, I found one by trial and error... BUT THERE HAS GOT TO BE A BETTER WAY :-) Here's what I did but I can't believe it's this difficult to do... Here's my checkfield property that needs to force a form value to be updated: html:select property=psdProductType size=1 onchange=setCurrProductType(this.value) html:options collection=psbusinesstype property=value labelProperty=label/ /html:select Here's the javascript function: function setCurrProductType(inProductType) { alert(Setting curr product type to: + inProductType); window.location=SetProperty.jsp?enteredPt=+inProductType; } and here's the SetProperty.jsp - %@ taglib uri=/struts-bean prefix=bean % bean:define id=psInfo name=psSession type=express.EBPsSession scope =session / bean:define id=psForm name=psForm type=express.psForm scope =session / % // // If they changed the product type on the first page, set it // here in the form object... // String sCurrProductType=request.getParameter(enteredPt); psInfo.setCurrProductType(sCurrProductType); System.out.println(Current Product Type = + psInfo.getCurrProductType() + current page = + psInfo.getCurrpage()); psForm.setPsdProductType(psInfo.getCurrProductType()); % jsp:forward page=PsPage.jsp/ So in essence, the forward tag simply causes control to come back to the page I was on... But in-between, I was able to set a form bean propertyAgain my problem is the form bean property is not updated until you hit the submit button... In this case, I don't want a submit to occur when you change the contents of the dropdown. Only the property for that drop down should change... After adding this, when I click to go to the 4th tab, the action now sees the newly changed value It works BUT I have to believe there's a better way!!!I open to any suggestions... theron.kousek @webmd.net To: Struts Users Mailing List [EMAIL PROTECTED] 03/10/02 cc: 02:32 PM Subject: setting server side parm in Javascript? Please respond to Struts Users Mailing List Hi Folks: I'm doing a mimic-JTabbedPane approach. I have a screen with 5 tabs.I am using 1 form object and 5 action mappings... On tab 4, I'd like to detect changes made to a field on tab 1. I notice I can change the field on tab 1 but tab 4 does not know about until the form is submitted.I can't submit the form... I'd like to have a Javascript handler that implements the onchange() and somehow sets a session attribute or some kind of trigger that tells tab 4 to reload itself when this field on tab 1 has changed.I notice if I change these values, the form object will not get the new values until you hit submit.Having the javascript function call submit is not an option either... Any ideas on how best to do this?? If I could access my form-bean directly within the Javascript method, that would be an option to (as I could call the set method on the form object) but I am not sure if the javascript can access the form object directly and call a set method? thanks, Theron -- 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: nested:iterate - set method not called
Ahhh, sorry! You are passing in an array of objects. I should read before replying huh? Check previous posts for this. I seem to remember something about providing setItemId methods being used for indexed page elements? Scott -Original Message- From: Elijah Jacobs [SMTP:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 10:43 AM To: Struts Users Mailing List Subject: Re: nested:iterate - set method not called thanks for the reply, Scott My syntax looks okay on the jsp side and since the getExtrainfo method is being called it puzzles me that the set method is not being called on submit. nested:iterate property=extrainfo nested:text property=name/ /nested:iterate - ej - Original Message - From: Barr, Scott [IBM GSA] [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Sunday, March 10, 2002 7:03 PM Subject: RE: nested:iterate - set method not called Could it be that the html field in your jsp is named 'extraInfo' (uppercase 'i'), and the setter is using a lowercase 'i' in the word info? Scott -Original Message- From: Elijah Jacobs [SMTP:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 10:27 AM To: Struts Users Mailing List Subject: nested:iterate - set method not called Hi, I am able to list the elements on my Vector just fine, but I noticed that when I do a submit the set method is not being called, hence the field is empty when it gets to the action class. Can someone suggest to me what the problem might be? my code is below. thanks, - ej *** code public Vector extrainfo; // call successfully public Object[] getExtrainfo() {...} //Not being called on submit public void setExtrainfo(Object[] infoList) {...} *** code -- 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]
modal window to close based on validation
hi all, I tried to create a modal dialog, and I am faced with some problems. The modal window submits a form and normally closes. I would like the behavior of the modal window to be like this. When the user submit a form, and if there are any validation errors, then they should be displayed in the same modal window, other wise it should close. I have a java script function to close the window. I need to call this function when there are no errors. Should I use onload event or is there any better solution for it. another hurdle.. I would like to keep the size of the modal window's constant, but the contents of the window is displayed in an inconsistent size across browsers. Should I use browser font detection and stuff like that to fix the size of window. Any suggestions are welcome. thanks in advance, regards, srinivas. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: nested:iterate - set method not called
The getter will only ever be called, as it's the middle-man. The system only wants to set the name property on the nested bean. It will call the getter of the extrainfo object to get at the nested bean, and then set its property. Never actually calling the setter of the parent bean property. Arron. Elijah Jacobs wrote: thanks for the reply, Scott My syntax looks okay on the jsp side and since the getExtrainfo method is being called it puzzles me that the set method is not being called on submit. nested:iterate property=extrainfo nested:text property=name/ /nested:iterate - ej - Original Message - From: Barr, Scott [IBM GSA] [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Sunday, March 10, 2002 7:03 PM Subject: RE: nested:iterate - set method not called Could it be that the html field in your jsp is named 'extraInfo' (uppercase 'i'), and the setter is using a lowercase 'i' in the word info? Scott -Original Message- From: Elijah Jacobs [SMTP:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 10:27 AM To: Struts Users Mailing List Subject: nested:iterate - set method not called Hi, I am able to list the elements on my Vector just fine, but I noticed that when I do a submit the set method is not being called, hence the field is empty when it gets to the action class. Can someone suggest to me what the problem might be? my code is below. thanks, - ej *** code public Vector extrainfo; // call successfully public Object[] getExtrainfo() {...} //Not being called on submit public void setExtrainfo(Object[] infoList) {...} *** code -- 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: Need help - bean:define - Desparate
I'd try this: bean:define id=res name=nameofthisbeaninrequestscope class=SearchBrowseResults scope=request/ bean:define id=brNode name=res property=browseNode class=java.util.ArrayList/ then to get each brNode properties (if I understood correctly is an ArrayList), you do a logic:iterate id=brNodeObject name=brNode class=whatevercontainsinArrayList bean:write name=brNodeObject property=name/ //assuming there is a getName in the bean in Arraylist etc... /logic:iterate Best wishes, Thinh -Original Message- From: Nishant Asthana [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 09, 2002 3:50 PM To: [EMAIL PROTECTED] Subject: Need help - bean:define - Desparate Hi , I have tried to search this archive for problems that I am having with my JSP, but was not able to get much help. I am a newbie to JSP customs tags. Please if anyone could help.Situations kinda grave. Heres a snapshot of my JSP jsp:useBean id=res class=SearchBrowseResults scope=request/ bean:define id=brNode name=res property=browseNode/ bean:define id=brNodeName name=brNode property=name/ bean:define id=brNodeId name=brNode property=nodeId/ bean:define id=brNodeProdCount name=brNode property=prodCount/ bean:define id=prods name=res property=products/ bean:define id=parNodes name=brNode property=breadCrumbTrail/ Where : browseNode is a container object or SearchBrowseResults products is ArrayList in SearchBrowseResults breadCrumbTrail is a Vector in browseNode container. When I run try to run this JSP, I get the following error. Can someone help ? - Nishant internal error: servlet service function had thrown ServletException (uri=/browse/aol/BrowseMain.jsp): javax.servlet.ServletException: No getter method for property breadCrumbTrail of bean brNode, stack: javax.servlet.ServletException: No getter method for property breadCrumbTrail of bean brNode at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:455) at aol._0002faol_0002fBrowseMain_0002ejspBrowseMain_jsp_37._jspService(_0002fao l_0002fBrowseMain_0002ejspBrowseMain_jsp_37.java:360) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:176) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:307) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.netscape.server.http.servlet.NSServletRunner.invokeServletService(NSServ letRunner.java:897) at com.netscape.server.http.servlet.WebApplication.service(WebApplication.java: 1065) at com.netscape.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunn er.java:959) at com.netscape.server.http.servlet.NSServletSession.internalRedirect(Native Method) at com.netscape.server.http.servlet.NSRequestDispatcher.forward(NSRequestDispat cher.java:48) at BrowseServlet.doWork(BrowseServlet.java:219) at BrowseServlet.doGet(BrowseServlet.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.netscape.server.http.servlet.NSServletRunner.invokeServletService(NSServ letRunner.java:897) at com.netscape.server.http.servlet.WebApplication.service(WebApplication.java: 1065) at com.netscape.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunn er.java:959) , root cause: javax.servlet.jsp.JspException: No getter method for property breadCrumbTrail of bean brNode at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:200) at aol._0002faol_0002fBrowseMain_0002ejspBrowseMain_jsp_37._jspService(_0002fao l_0002fBrowseMain_0002ejspBrowseMain_jsp_37.java:260) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:176) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:307) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.netscape.server.http.servlet.NSServletRunner.invokeServletService(NSServ letRunner.java:897) at com.netscape.server.http.servlet.WebApplication.service(WebApplication.java: 1065) at com.netscape.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunn er.java:959) at com.netscape.server.http.servlet.NSServletSession.internalRedirect(Native Method) at
Re: What's the rigth way to do it ?
Subject: Re: What's the rigth way to do it 1 2 3 4 5 6 7 8 9 From: Tea Yu [EMAIL PROTECTED] === Hi Slimane, It seems that you're using the same parameters or combinations from a parameter set across various pages. And links like what you've mentioned are gonna be referred from a couple of pages? Can these links be factorized into more general actions like bla.do?category=bulldoHarm=nobe mapped tobla/whiteLie.doso that your users can still bookmark your pages for further reference (if allowed) and any change in parameter-value mappings could be done in the controller config in future?(General practice using Struts, please see Ted's resources for elaborations) If no, are the parameter values supposed to change after some period of time? If so I guess session object may do the job right. Well... I'm new to struts too, just tell me if my concepts are wrong. Tea Yu Bin, Thanks for your answer :) The fact is I don't have any EJB. So I think I'll just use the HttpSession object :) And about passing the strings as parameters* of my Action classes ? Was it a bad idea ? If so, why ? * What I mean by parameters is for example doing the following: A HREF=bla.do?param1=dohparam2=goshblabla/A where param1 and param2 are my actual parameters and then in the Action classes, I'll use the getParameter() method Thanks again, Slimane -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Struts and encryption
Hi Tim, We were faced with a similar dilemma in our app. This is finally what we did : 1. We used MD5 hash to encrypt the password and insert it into the DB. 2. On login user entered password is hashed and matched with the password in the DB. 3. If user forgets his/her password and performs a Change Password then his/her password is reset. This is what we do to reset password : 1. On performing Change Password a 32 byte hash key is generated using the user's UserID and the current timestamp. The first 8 characters is sent to the user in a mail as his new password and those 8 characters are re-hashed into a 32 byte hash key and the user's password in the DB is updated with that value. Hope this helps. Regards, Hitesh Tim Strong wrote: I did some quick research on this recently. I struggled between choosing any of the following: 1. encode/decode password using Java 2. encode/decode password using database specific methods 3. hashing the password After doing quite a bit of research on the 'net (java.sun.com mostly), I decided to use #3, using a message digest and MD5 hashing. This is a one-way hash, almost impossible to decode. To authenticate the user, I hash the password entered from the login form using this same method and compare that with the password hash stored in the database. Regarding decrypting the password, based on what I have read, I decided that no one, not even the database administrator, should be able to decrypt the user's password. The following is the method that I use to hash the password. public static byte[] encodePassword(byte[] unencodedPassword) { log.trace(encodePassword() - Entering); MessageDigest md = null; try { // first create an instance, given the provider md = MessageDigest.getInstance(MD5); } catch (Exception e) { log.error(Exception: , e); } md.reset(); // call the update method one or more times // (useful when you don't know the size of your data, eg. stream) md.update(unencodedPassword); // now calculate the hash byte[] encodedPassword = md.digest(); StringBuffer buf = new StringBuffer(); for (int i=0; i encodedPassword.length; i++) { if (((int) encodedPassword[i] 0xff) 0x10) { buf.append(0); } buf.append(Long.toString((int) encodedPassword[i] 0xff, 16)); } log.debug(encodePassword() - Encoded Password:\t + buf); log.trace(encodePassword() - Exiting); return(encodedPassword); } If the user forgets the password, I am still struggling with what to do, probably one of the following or both: 1. reset the password and mail the new password to the user 2. reset the password and present it to them within the browser Both methods I will force the user to change their password the next time they login I'm not an expert in Java security, so I would be interested in any comments. -Tim -Original Message- From: Andrew H. Peterson [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 9:36 PM To: Struts User Forum (E-mail) Subject: Struts and encryption Is there a struts preferred method of handling encryption/decryption? I am authenticating users via a database lookup. I want to store the encrypted password in the database. If struts doesn't have a preferred method of encryption/decryption, can someone point me to a good Java API for encryption/decryption? Thanks. ahp -- 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]
Using struts with UIX and or BC4J
Has anyone used UIX and or BC4J (Oracle 9iAS) with struts? Brad Gibson
Struts with JBuilder5
Does anyone know how to get JBuilder5 to include the .tld files in the WAR file? I am trying to configure a project based on the struts-blank template. TIA Steve -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Cannot find ActionMappings or ActionFormBeans collection
Hi all, Now,I am developing a web application based struts1.20 + Tomcat3.24. while I run the application.one excexption occured. error message is listed below: javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection what reason causes the problem? Thanks in advance. regards, Laker
Re: Server-side Charting libs?
Java 1.2 should be all you'd need for a good charting package. Not that I have a particular library in mind. I have seen one on sourceforge someplace. They are out there. When ever I've needed a chart I've luckily had to the time to piss around and make it myself. Java2D in 1.2 should be all anyone needs to get the job done. Has the ability for some very sexy imagery. You can use any charting package, as long as it will render to an Image object or some sort (Buffered or otherwise) which you can just pump from a Struts action using Sun's own JPEG output stream, which you can get a hold of in thier Advanced Imaging Toolkit or something (www.javasoft.com :) . With that you set the quality etc. As far as I know all the JPEG stuff etc is now in 1.4 Arron. Bryan Field-Elliot wrote: I was wondering if anyone has any positive experience with open-source charting libraries, with Struts? I need to generate a chart on the server (from a Struts action) and send it back to the client as a Jpeg, PNG, etc. I have messed with (a tiny bit) JFreeChart and Chart2d. Both appear (at first glance) to have issues with headless environments, which my server definitely is (no X server installed). I'm using JDK 1.3. At one point I read that JDK 1.4 has better support for graphics primitives on headless environments, but I don't know if the above two libraries can take advantage of that. A penny for anyone's thoughts? Bryan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]