RE: How Do I Create This Drop-Down List in Struts?
You should have a property in your form bean where the user selection will go. In this case the property is name html:select size=1 property=Property in the form bean to hold the selection multiple=false html:options collection=EDITORS property=name labelProperty=name/ /html:select Mohan -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 11:18 AM To: [EMAIL PROTECTED] Subject: How Do I Create This Drop-Down List in Struts? My ArrayList is a collection of bean object. The ArrayList is created this way: public Collection findEditors( String userrole, String category ) { .. EditorBean editorBean = null; ArrayList editors = new ArrayList(); // database access code while( rs.next() ) { editorBean = new EditorBean( rs.getString(user_name) ); editors.add( editorBean ); } return editors; ... } and my EditorBean is like: public class EditorBean { private String name; public EditorBean() {} public EditorBean( String name ) { this.name = name; } public String getName() { return Name; } public void setName( String name ) { this.name = name; } } After editors is returned, I create a session object: session.setAttribute( EDITORS, editors ); How do I create a drop-down list for this collection of editors? html:select size=1 property=?? multiple=false html:options collection=?? property=name labelProperty=name/ /html:select __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts indexed properties and displaytag
Hi Can I use logic:iterate and indexed properties with display tag sorting ? Thanks, Mohan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTML tags/filter/UTF-8
On 11/21/2003 09:25 PM Dave Hodson wrote: A question for the list: I have an input form, which is handled via Struts and the input is validated, URLEncoded with UTF-8 and stored in a DB At a later date, the user can modify their input. The input is displayed with an html:text tag, but unfortunately, it does not display properly. Specifically, the issue is that a URLEncoded character like "#22530;" (堂, a building in Traditional Chinese) is modified before being written out It goes from "#22530;" to ""amp;#22530;", which then displays incorrectly in the browser. Dave, why are you URLEncoding your data before storing it in the database? If it's to filter out SQL-breaking characters, perhaps you should be using PreparedStatements instead of manually constructing a string for the SQL. Adam -- struts 1.1 + tomcat 5.0.14 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How Do I Create This Drop-Down List in Struts?
The collection that you want to iterate through and the form property aren't linked as such only when you nest the html:options tag in the html:select tag So your html:select form property is like any other form property, and when submitted will only the form property will be set to only one value from the list. html:select property=editor //now the list in the options tags is only really associated //with the form property as its nested in the html:select html:options collection=mycollection the property attribute in the html:options tag is to drill to the property of the bean thats exposed during the iteration and hasn't much to do with the form itself. .. Cheers Mark On 30 Nov 2003, at 05:48, Caroline Jen wrote: My ArrayList is a collection of bean object. The ArrayList is created this way: public Collection findEditors( String userrole, String category ) { .. EditorBean editorBean = null; ArrayList editors = new ArrayList(); // database access code while( rs.next() ) { editorBean = new EditorBean( rs.getString(user_name) ); editors.add( editorBean ); } return editors; ... } and my EditorBean is like: public class EditorBean { private String name; public EditorBean() {} public EditorBean( String name ) { this.name = name; } public String getName() { return Name; } public void setName( String name ) { this.name = name; } } After editors is returned, I create a session object: session.setAttribute( EDITORS, editors ); How do I create a drop-down list for this collection of editors? html:select size=1 property=?? multiple=false html:options collection=?? property=name labelProperty=name/ /html:select __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error while accessing the application
Hi, My application is not able to find the tag libraries. The tag libraries lie in the WEB-INF directory of the application and refer to a directory on another server. These two servers are able to connect with one another. I am getting exceptions like info ( 5840): JSP: JSP1x compiler threw exception org.apache.jasper.compiler.CompileException: /Mydocs/sun/web/docs/jvNET/Login.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Could not locate TLD /WEB-INF/struts-bean.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspPars eEventListener.java:707) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Delegating Listener.java:110) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.jav a:252) at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.j ava:173) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner. java:416) [16/Nov/2003:14:54:22] warning ( 5840): Internal error: Failed to get GenericServlet. (uri=/jvNET/Login.jsp,SCRIPT_NAME=/jvNET/Login.jsp) [16/Nov/2003:14:56:02] info ( 5840): Internal Info: loading servlet /jvNET/Login.jsp [16/Nov/2003:14:56:02] info ( 5840): JSP: JSP1x compiler threw exception org.apache.jasper.compiler.CompileException: /Mydocs/sun/web/docs/jvNET/Login.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Could not locate TLD /WEB-INF/struts-bean.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspPars eEventListener.java:707) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Delegating Listener.java:110) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.jav a:252) at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.j ava:173) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner. java:416) [16/Nov/2003:14:56:02] warning ( 5840): Internal error: Failed to get GenericServlet. (uri=/jvNET/Login.jsp,SCRIPT_NAME=/jvNET/Login.jsp) Download Yahoo! Messenger now for a chance to win Live At Knebworth DVDs http://www.yahoo.co.uk/robbiewilliams - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL
You mean there are no equivalents for the Struts HTML tags in the JSTL? -Original Message- From: Manish Singla [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 8:08 PM To: Struts Users Mailing List Subject: Re: JSTL You may replace most of Logic tags/Bean tags with JSTL. You may still want to use HTML tags of struts Your decision may get affected in few cases if you are thinking of migrating to JSF in future Tarek M. Nabil wrote: Hi everyone, I'm getting ready to move from Struts 1.0.2 to Struts 1.1. Since, also, I now guarantee a J2EE 1.3 container, I'm considering replacing Struts tag libraries with the JSTL. Before I make this move, I wanted to know whether, from your experiences, the JSTL gives the same capabilities as the tag libraries provided with Struts, especially that I know that the tag libs shipped with Struts 1.1 fix a lot of the shortcomings of the tag libs shipped with 1.0.2. So, is going with the standards worth the move? Please advise. Regards, Tarek M. Nabil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thanks Manish Singla x73166 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error while accessing the application
Hi Melanie, don't really see anything wrong right off the bat, but let's walk through what has to be configured: Place all your tlds in the WEB-INF directory (looks good here) Place all required struts library JARs in the lib directory of your web appl Configure your web.xml to include the TLDs, here's an example of one of my projects: welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list taglib taglib-uri/WEB-INF/c-rt.tld/taglib-uri taglib-location/WEB-INF/c-rt.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/fmt-rt.tld/taglib-uri taglib-location/WEB-INF/fmt-rt.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/fmt.tld/taglib-uri taglib-location/WEB-INF/fmt.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib Finally configure the JSP to include (or point) to the proper tag definition, here's an example: %@ page import=java.util.*% [EMAIL PROTECTED] uri=/WEB-INF/c.tld prefix=c % [EMAIL PROTECTED] uri=/WEB-INF/fmt.tld prefix=fmt % [EMAIL PROTECTED] uri=/WEB-INF/struts-bean.tld prefix=bean % [EMAIL PROTECTED] uri=/WEB-INF/pager-taglib.tld prefix=pg % %@ taglib uri=/WEB-INF/security.tld prefix=security % %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % I always reference tlds from the /WEB-INF directory, not from within the library JAR. Jim Kennedy IT Consultant Mobile Phone: 813-503-1484 - - Original Message - From: Melanie Pfefer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 30, 2003 7:30 AM Subject: Error while accessing the application Hi, My application is not able to find the tag libraries. The tag libraries lie in the WEB-INF directory of the application and refer to a directory on another server. These two servers are able to connect with one another. I am getting exceptions like info ( 5840): JSP: JSP1x compiler threw exception org.apache.jasper.compiler.CompileException: /Mydocs/sun/web/docs/jvNET/Login.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Could not locate TLD /WEB-INF/struts-bean.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspPars eEventListener.java:707) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Delegating Listener.java:110) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.jav a:252) at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.j ava:173) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner. java:416) [16/Nov/2003:14:54:22] warning ( 5840): Internal error: Failed to get GenericServlet. (uri=/jvNET/Login.jsp,SCRIPT_NAME=/jvNET/Login.jsp) [16/Nov/2003:14:56:02] info ( 5840): Internal Info: loading servlet /jvNET/Login.jsp [16/Nov/2003:14:56:02] info ( 5840): JSP: JSP1x compiler threw exception org.apache.jasper.compiler.CompileException: /Mydocs/sun/web/docs/jvNET/Login.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Could not locate TLD /WEB-INF/struts-bean.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspPars eEventListener.java:707) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Delegating Listener.java:110) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.jav a:252) at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.j ava:173) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner. java:416) [16/Nov/2003:14:56:02] warning ( 5840): Internal error: Failed to get GenericServlet. (uri=/jvNET/Login.jsp,SCRIPT_NAME=/jvNET/Login.jsp) Download Yahoo! Messenger now for a chance to win Live At Knebworth DVDs http://www.yahoo.co.uk/robbiewilliams -
RE: JSTL
That's right. It's important to realize that most non-trivial applications will often use more than one tag library. There is no good reason to try to restrict yourself to a single tag library. In the case of Struts, it's very beneficial to use the Struts tag library along with the JSTL. In addition, the Struts-EL contrib package (in the contrib directory) is a port of the Struts tags (the ones that aren't directly served by the JSTL), using the expression evaluation engine of the Jakarta Taglibs JSTL implementation. -Original Message- From: Tarek M. Nabil [mailto:[EMAIL PROTECTED] You mean there are no equivalents for the Struts HTML tags in the JSTL? -Original Message- From: Manish Singla [mailto:[EMAIL PROTECTED] You may replace most of Logic tags/Bean tags with JSTL. You may still want to use HTML tags of struts Your decision may get affected in few cases if you are thinking of migrating to JSF in future Tarek M. Nabil wrote: Hi everyone, I'm getting ready to move from Struts 1.0.2 to Struts 1.1. Since, also, I now guarantee a J2EE 1.3 container, I'm considering replacing Struts tag libraries with the JSTL. Before I make this move, I wanted to know whether, from your experiences, the JSTL gives the same capabilities as the tag libraries provided with Struts, especially that I know that the tag libs shipped with Struts 1.1 fix a lot of the shortcomings of the tag libs shipped with 1.0.2. So, is going with the standards worth the move? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
can I avoid *.do in my URLs?
Hi, I would like to avoid having to formulate my URLs as *.do, or even /do/*. I want to have simple names like /foo and /bar, names that no single pattern could match. The reason is that I don't want to expose implementation details in my URLs, because an implementation could change and then my URLs would be no good. I care about this because I want bookmarked URLs within my application to continue to work. (See http://www.w3.org/Provider/Style/URI.html, especially the section called We used to use a cgi script for this and now we use a binary program.) I had planned to accomplish this by making multiple servlet-mapping entries in the web.xml file, one for each page, each one pointing to the controller servlet. (My application has only a small number of pages, so this seemed feasible.) But I just noticed the following warning in the User's Guide (section 5.4.2 Configure the Action Servlet Mapping): WARNING - Struts will not operate correctly if you define more than one servlet-mapping element for the controller servlet. Eeek! Is there some other way I can do this? Or am I stuck? (Is there maybe some way a servlet Filter could do this for me?) Thanks for listening. Cheers, - arb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error while accessing the application
Just for clarification to others, your last line abbreviates the fact that in a Servlet 2.3 container, it's not necessary to include the TLDs, either in the /WEB-INF directory, or referenced in the web.xml, if you reference the canonical URI in the taglib directives in the JSP pages. The canonical URI for the tag library is listed in the TLD for the tag library. There are differences of opinion on which of these strategies is preferable. There are tradeoffs both ways. -Original Message- From: Jim Kennedy [mailto:[EMAIL PROTECTED] Hi Melanie, don't really see anything wrong right off the bat, but let's walk through what has to be configured: Place all your tlds in the WEB-INF directory (looks good here) Place all required struts library JARs in the lib directory of your web appl Configure your web.xml to include the TLDs, here's an example of one of my projects: welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list taglib taglib-uri/WEB-INF/c-rt.tld/taglib-uri taglib-location/WEB-INF/c-rt.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/fmt-rt.tld/taglib-uri taglib-location/WEB-INF/fmt-rt.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/fmt.tld/taglib-uri taglib-location/WEB-INF/fmt.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib Finally configure the JSP to include (or point) to the proper tag definition, here's an example: %@ page import=java.util.*% [EMAIL PROTECTED] uri=/WEB-INF/c.tld prefix=c % [EMAIL PROTECTED] uri=/WEB-INF/fmt.tld prefix=fmt % [EMAIL PROTECTED] uri=/WEB-INF/struts-bean.tld prefix=bean % [EMAIL PROTECTED] uri=/WEB-INF/pager-taglib.tld prefix=pg % %@ taglib uri=/WEB-INF/security.tld prefix=security % %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % I always reference tlds from the /WEB-INF directory, not from within the library JAR. Jim Kennedy IT Consultant Mobile Phone: 813-503-1484 - - Original Message - From: Melanie Pfefer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 30, 2003 7:30 AM Subject: Error while accessing the application Hi, My application is not able to find the tag libraries. The tag libraries lie in the WEB-INF directory of the application and refer to a directory on another server. These two servers are able to connect with one another. I am getting exceptions like info ( 5840): JSP: JSP1x compiler threw exception org.apache.jasper.compiler.CompileException: /Mydocs/sun/web/docs/jvNET/Login.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Could not locate TLD /WEB-INF/struts-bean.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspPars eEventListener.java:707) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Delegating Listener.java:110) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.jav a:252) at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.j ava:173) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner. java:416) [16/Nov/2003:14:54:22] warning ( 5840): Internal error: Failed to get GenericServlet. (uri=/jvNET/Login.jsp,SCRIPT_NAME=/jvNET/Login.jsp) [16/Nov/2003:14:56:02] info ( 5840): Internal Info: loading servlet /jvNET/Login.jsp [16/Nov/2003:14:56:02] info ( 5840): JSP: JSP1x compiler threw exception org.apache.jasper.compiler.CompileException: /Mydocs/sun/web/docs/jvNET/Login.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Could not locate TLD /WEB-INF/struts-bean.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspPars eEventListener.java:707) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Delegating Listener.java:110) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.jav a:252) at
RE: JSTL
Thanks David. I get a bit worried when the idea of mixing tag libraries pops up. I've had some bad experiences with such practice. I'm not sure whether this was partly due to my lack of understanding of the libraries I used, but for example, I frequently found that beans created with the Struts bean:define tags with a page scope aren't visible to the Supported Tag Libraries Page 1.1 page tag, although as far as I understand, they should both look in the same scope. Has anyone ever had similar experiences? -Original Message- From: Karr, David [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 6:55 PM To: Struts Users Mailing List Subject: RE: JSTL That's right. It's important to realize that most non-trivial applications will often use more than one tag library. There is no good reason to try to restrict yourself to a single tag library. In the case of Struts, it's very beneficial to use the Struts tag library along with the JSTL. In addition, the Struts-EL contrib package (in the contrib directory) is a port of the Struts tags (the ones that aren't directly served by the JSTL), using the expression evaluation engine of the Jakarta Taglibs JSTL implementation. -Original Message- From: Tarek M. Nabil [mailto:[EMAIL PROTECTED] You mean there are no equivalents for the Struts HTML tags in the JSTL? -Original Message- From: Manish Singla [mailto:[EMAIL PROTECTED] You may replace most of Logic tags/Bean tags with JSTL. You may still want to use HTML tags of struts Your decision may get affected in few cases if you are thinking of migrating to JSF in future Tarek M. Nabil wrote: Hi everyone, I'm getting ready to move from Struts 1.0.2 to Struts 1.1. Since, also, I now guarantee a J2EE 1.3 container, I'm considering replacing Struts tag libraries with the JSTL. Before I make this move, I wanted to know whether, from your experiences, the JSTL gives the same capabilities as the tag libraries provided with Struts, especially that I know that the tag libs shipped with Struts 1.1 fix a lot of the shortcomings of the tag libs shipped with 1.0.2. So, is going with the standards worth the move? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can I avoid *.do in my URLs?
Have a look at this filter that Matt Raible came up with: http://marc.theaimsgroup.com/?l=struts-userm=106399831922108w=2 Alan Bram wrote: Hi, I would like to avoid having to formulate my URLs as *.do, or even /do/*. I want to have simple names like /foo and /bar, names that no single pattern could match. The reason is that I don't want to expose implementation details in my URLs, because an implementation could change and then my URLs would be no good. I care about this because I want bookmarked URLs within my application to continue to work. (See http://www.w3.org/Provider/Style/URI.html, especially the section called We used to use a cgi script for this and now we use a binary program.) I had planned to accomplish this by making multiple servlet-mapping entries in the web.xml file, one for each page, each one pointing to the controller servlet. (My application has only a small number of pages, so this seemed feasible.) But I just noticed the following warning in the User's Guide (section 5.4.2 Configure the Action Servlet Mapping): WARNING - Struts will not operate correctly if you define more than one servlet-mapping element for the controller servlet. Eeek! Is there some other way I can do this? Or am I stuck? (Is there maybe some way a servlet Filter could do this for me?) Thanks for listening. Cheers, - arb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: org.apache.struts.legacy.GenericDataSource
Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html You should be able to set any of them in your struts-config.xml data-source entry with this syntax: set-property property=minIdle value=XXX / I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page): validationQuery set to select 1+1 works in MySQL and returns 1 row testWhileIdle set to true timeBetweenEvictionRunsMillis set to 180 (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to true minIdle set to 2 (or higher) Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 2:14 PM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hello david, thanks for the quick reply, could u pls mail me the extract of the data-source which worked fr u. along all with the settings. (u can ofcourse remove the l/p :P ) this would be a great help! and have u have the kind of sucess with DBCP in dealing with connection pool and idle connections? thanks! David Friedman wrote: Rajat, I've had that type of disconnect problem using Hibernate (a product roughly like Ibatis). My problem was one of the DBCP settings: minIdle. MySQL wasn't seeing any activity on some pool connections overnight, so it was disconnecting them. Lowering the minIdle setting seemed to cause DBCP to test each pool connection by performing a simple select automatically. The query seems to be a non-table select, along the lines of a 'select 1+1;'. That allowed MySQL to keep each connection active and not disconnect any overnight after being idle for hours. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:44 PM To: Struts Users Mailing List Subject: org.apache.struts.legacy.GenericDataSource hello gurus, i have an terrible terrible problem with my application, after hosting this application it stops to work after 8-10hrs of idle state. then the server has to restart and then its fine again. i learnt that the mysql driver disconects after 8hrs of an idle connection so i addred autoreconnect=true to the connection url. however the problem doesnt seem to get sovled. just extended fro another another and then the same problem again. i need to know how to remove org.apache.struts.legacy.GenericDataSource and use the connection from DBCP (commons lib ie.) and will i need to change the settings in the code (struts-config.xml) i also am thinking of refactoring the entire codebase usng iBatis. will it solve this issue? pls help! i need this project to be up and running in the next week. thanks once again the logs follows. NFO:Return allocated connection, activeCount=2, useCount=1 Nov 28, 2003 8:00:15 PM com.hedging.HedgeUser validUser INFO: -- Error: Communication link failure: java.io.IOException-- Nov 28, 2003 8:00:15 PM org.apache.struts.legacy.GenericDataSource returnConnection INFO: releaseConnection(), activeCount=2, useCount=0 Nov 28, 2003 8:00:30 PM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 28, 2003 8:00:33 PM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 28, 2003 8:00:35 PM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 28, 2003 8:00:36 PM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 29, 2003 12:33:42 AM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 29, 2003 12:33:47 AM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource getConnection INFO: getConnection() Nov 29, 2003 12:33:58 AM
Representing Existing Objects In Forms
hello all, I am wanting to represent an existing object using a form and was wondering how to do this. My situation is displaying a customer's details in a form for the purpose of allowing them to update them. I cant think how I can populate the form tho. Im new to struts and this list so i apolagise if this has already been answered. Thanks, toby -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 8:35 AM To: Struts Users Mailing List Subject: RE: org.apache.struts.legacy.GenericDataSource Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html You should be able to set any of them in your struts-config.xml data-source entry with this syntax: set-property property=minIdle value=XXX / I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page): validationQuery set to select 1+1 works in MySQL and returns 1 row testWhileIdle set to true timeBetweenEvictionRunsMillis set to 180 (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to true minIdle set to 2 (or higher) Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 2:14 PM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hello david, thanks for the quick reply, could u pls mail me the extract of the data-source which worked fr u. along all with the settings. (u can ofcourse remove the l/p :P ) this would be a great help! and have u have the kind of sucess with DBCP in dealing with connection pool and idle connections? thanks! David Friedman wrote: Rajat, I've had that type of disconnect problem using Hibernate (a product roughly like Ibatis). My problem was one of the DBCP settings: minIdle. MySQL wasn't seeing any activity on some pool connections overnight, so it was disconnecting them. Lowering the minIdle setting seemed to cause DBCP to test each pool connection by performing a simple select automatically. The query seems to be a non-table select, along the lines of a 'select 1+1;'. That allowed MySQL to keep each connection active and not disconnect any overnight after being idle for hours. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:44 PM To: Struts Users Mailing List Subject: org.apache.struts.legacy.GenericDataSource hello gurus, i have an terrible terrible problem with my application, after hosting this application it stops to work after 8-10hrs of idle state. then the server has to restart and then its fine again. i learnt that the mysql driver disconects after 8hrs of an idle connection so i addred autoreconnect=true to the connection url. however the problem doesnt seem to get sovled. just extended fro another another and then the same problem again. i need to know how to remove org.apache.struts.legacy.GenericDataSource and use the connection from DBCP (commons lib ie.) and will i need to change the settings in the code (struts-config.xml) i also am thinking of refactoring the entire codebase usng iBatis. will it solve this issue? pls help! i need this project to be up and running in the next week. thanks once again the logs follows. NFO:Return allocated connection, activeCount=2, useCount=1 Nov 28, 2003 8:00:15 PM com.hedging.HedgeUser validUser INFO: -- Error: Communication link failure: java.io.IOException-- Nov 28, 2003 8:00:15 PM org.apache.struts.legacy.GenericDataSource returnConnection INFO: releaseConnection(), activeCount=2, useCount=0 Nov 28, 2003 8:00:30 PM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 28, 2003 8:00:33 PM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 28, 2003 8:00:35 PM
RE: Representing Existing Objects In Forms
Toby, Where is your trouble? Do you not understand ActionForms? Are you worried about how to transfer the data submitted and auto-populated into the ActionForm into your business logic? Or is something else confusing you? Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 6:30 PM To: Struts Users Mailing List Subject: Representing Existing Objects In Forms hello all, I am wanting to represent an existing object using a form and was wondering how to do this. My situation is displaying a customer's details in a form for the purpose of allowing them to update them. I cant think how I can populate the form tho. Im new to struts and this list so i apolagise if this has already been answered. Thanks, toby -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 8:35 AM To: Struts Users Mailing List Subject: RE: org.apache.struts.legacy.GenericDataSource Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html You should be able to set any of them in your struts-config.xml data-source entry with this syntax: set-property property=minIdle value=XXX / I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page): validationQuery set to select 1+1 works in MySQL and returns 1 row testWhileIdle set to true timeBetweenEvictionRunsMillis set to 180 (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to true minIdle set to 2 (or higher) Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 2:14 PM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hello david, thanks for the quick reply, could u pls mail me the extract of the data-source which worked fr u. along all with the settings. (u can ofcourse remove the l/p :P ) this would be a great help! and have u have the kind of sucess with DBCP in dealing with connection pool and idle connections? thanks! David Friedman wrote: Rajat, I've had that type of disconnect problem using Hibernate (a product roughly like Ibatis). My problem was one of the DBCP settings: minIdle. MySQL wasn't seeing any activity on some pool connections overnight, so it was disconnecting them. Lowering the minIdle setting seemed to cause DBCP to test each pool connection by performing a simple select automatically. The query seems to be a non-table select, along the lines of a 'select 1+1;'. That allowed MySQL to keep each connection active and not disconnect any overnight after being idle for hours. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:44 PM To: Struts Users Mailing List Subject: org.apache.struts.legacy.GenericDataSource hello gurus, i have an terrible terrible problem with my application, after hosting this application it stops to work after 8-10hrs of idle state. then the server has to restart and then its fine again. i learnt that the mysql driver disconects after 8hrs of an idle connection so i addred autoreconnect=true to the connection url. however the problem doesnt seem to get sovled. just extended fro another another and then the same problem again. i need to know how to remove org.apache.struts.legacy.GenericDataSource and use the connection from DBCP (commons lib ie.) and will i need to change the settings in the code (struts-config.xml) i also am thinking of refactoring the entire codebase usng iBatis. will it solve this issue? pls help! i need this project to be up and running in the next week. thanks once again the logs follows. NFO:Return allocated connection, activeCount=2, useCount=1 Nov 28, 2003 8:00:15 PM com.hedging.HedgeUser validUser INFO: -- Error: Communication link failure:
RE: Representing Existing Objects In Forms
David, Perhaps I dont understand the full capabilities of ActionForms. I am fine with creating a new customer from the contents of a form. But after this is done (and, for eg, the user has used parts of the site) and they decide to change their email address, how can i display (in the form) the password they entered when they registered in order to let them modify it? thanks, toby. -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 11:25 AM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms Toby, Where is your trouble? Do you not understand ActionForms? Are you worried about how to transfer the data submitted and auto-populated into the ActionForm into your business logic? Or is something else confusing you? Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 6:30 PM To: Struts Users Mailing List Subject: Representing Existing Objects In Forms hello all, I am wanting to represent an existing object using a form and was wondering how to do this. My situation is displaying a customer's details in a form for the purpose of allowing them to update them. I cant think how I can populate the form tho. Im new to struts and this list so i apolagise if this has already been answered. Thanks, toby -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 8:35 AM To: Struts Users Mailing List Subject: RE: org.apache.struts.legacy.GenericDataSource Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html You should be able to set any of them in your struts-config.xml data-source entry with this syntax: set-property property=minIdle value=XXX / I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page): validationQuery set to select 1+1 works in MySQL and returns 1 row testWhileIdle set to true timeBetweenEvictionRunsMillis set to 180 (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to true minIdle set to 2 (or higher) Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 2:14 PM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hello david, thanks for the quick reply, could u pls mail me the extract of the data-source which worked fr u. along all with the settings. (u can ofcourse remove the l/p :P ) this would be a great help! and have u have the kind of sucess with DBCP in dealing with connection pool and idle connections? thanks! David Friedman wrote: Rajat, I've had that type of disconnect problem using Hibernate (a product roughly like Ibatis). My problem was one of the DBCP settings: minIdle. MySQL wasn't seeing any activity on some pool connections overnight, so it was disconnecting them. Lowering the minIdle setting seemed to cause DBCP to test each pool connection by performing a simple select automatically. The query seems to be a non-table select, along the lines of a 'select 1+1;'. That allowed MySQL to keep each connection active and not disconnect any overnight after being idle for hours. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:44 PM To: Struts Users Mailing List Subject: org.apache.struts.legacy.GenericDataSource hello gurus, i have an terrible terrible problem with my application, after hosting this application it stops to work after 8-10hrs of idle state. then the server has to restart and then its fine again. i learnt that the mysql driver disconects after 8hrs of an idle connection so i addred autoreconnect=true to the connection url. however the problem doesnt seem to get sovled. just extended fro another another and
RE: Representing Existing Objects In Forms
Toby, You could: a) Have a Password field in your ActionForm. Then, you could lookup the password, copy it into the ActionForm, and have the ActionForm display it in your JSP when you show a html:text property=password/ field. b) Save the password in a bean and print it out with a bean:write ... / statement so it is only viewable (read-only) c) use an html:text name=someRequestOrSessionBean property=password / so you could save your own bean into the request or session scope then display it as a text box. If you want it to be submitted to a form, you probably want to make sure that whatever action it submits to has a field with the same property name (in this case password). I think there are other methods but these are the ones I know and use. Probably because the Struts examples showed me how (hint, hint!). :) Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 7:35 PM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms David, Perhaps I dont understand the full capabilities of ActionForms. I am fine with creating a new customer from the contents of a form. But after this is done (and, for eg, the user has used parts of the site) and they decide to change their email address, how can i display (in the form) the password they entered when they registered in order to let them modify it? thanks, toby. -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 11:25 AM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms Toby, Where is your trouble? Do you not understand ActionForms? Are you worried about how to transfer the data submitted and auto-populated into the ActionForm into your business logic? Or is something else confusing you? Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 6:30 PM To: Struts Users Mailing List Subject: Representing Existing Objects In Forms hello all, I am wanting to represent an existing object using a form and was wondering how to do this. My situation is displaying a customer's details in a form for the purpose of allowing them to update them. I cant think how I can populate the form tho. Im new to struts and this list so i apolagise if this has already been answered. Thanks, toby -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 8:35 AM To: Struts Users Mailing List Subject: RE: org.apache.struts.legacy.GenericDataSource Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html You should be able to set any of them in your struts-config.xml data-source entry with this syntax: set-property property=minIdle value=XXX / I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page): validationQuery set to select 1+1 works in MySQL and returns 1 row testWhileIdle set to true timeBetweenEvictionRunsMillis set to 180 (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to true minIdle set to 2 (or higher) Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 2:14 PM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hello david, thanks for the quick reply, could u pls mail me the extract of the data-source which worked fr u. along all with the settings. (u can ofcourse remove the l/p :P ) this would be a great help! and have u have the kind of sucess with DBCP in dealing with connection pool and idle connections? thanks! David Friedman wrote: Rajat, I've had that type of disconnect problem using Hibernate (a product roughly like Ibatis). My problem was one of the DBCP settings: minIdle. MySQL wasn't
RE: Representing Existing Objects In Forms
David, Thanks for your assistance. I suppose im wondering if there is a way to set the values of my ActionForm implementation variables(CustomerForm in my case) before the form is displayed, thus automatically populating the form when it is displayed. I am able to set the values of my form bean (CustomerForm) in its constructor. But to do what i want, i need to have access to the request object in order to get a cookie value. Perhaps I should just use your first suggestiong in order to achieve this. -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 12:03 PM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms Toby, You could: a) Have a Password field in your ActionForm. Then, you could lookup the password, copy it into the ActionForm, and have the ActionForm display it in your JSP when you show a html:text property=password/ field. b) Save the password in a bean and print it out with a bean:write ... / statement so it is only viewable (read-only) c) use an html:text name=someRequestOrSessionBean property=password / so you could save your own bean into the request or session scope then display it as a text box. If you want it to be submitted to a form, you probably want to make sure that whatever action it submits to has a field with the same property name (in this case password). I think there are other methods but these are the ones I know and use. Probably because the Struts examples showed me how (hint, hint!). :) Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 7:35 PM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms David, Perhaps I dont understand the full capabilities of ActionForms. I am fine with creating a new customer from the contents of a form. But after this is done (and, for eg, the user has used parts of the site) and they decide to change their email address, how can i display (in the form) the password they entered when they registered in order to let them modify it? thanks, toby. -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 11:25 AM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms Toby, Where is your trouble? Do you not understand ActionForms? Are you worried about how to transfer the data submitted and auto-populated into the ActionForm into your business logic? Or is something else confusing you? Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 6:30 PM To: Struts Users Mailing List Subject: Representing Existing Objects In Forms hello all, I am wanting to represent an existing object using a form and was wondering how to do this. My situation is displaying a customer's details in a form for the purpose of allowing them to update them. I cant think how I can populate the form tho. Im new to struts and this list so i apolagise if this has already been answered. Thanks, toby -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 8:35 AM To: Struts Users Mailing List Subject: RE: org.apache.struts.legacy.GenericDataSource Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html You should be able to set any of them in your struts-config.xml data-source entry with this syntax: set-property property=minIdle value=XXX / I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page): validationQuery set to select 1+1 works in MySQL and returns 1 row testWhileIdle set to true timeBetweenEvictionRunsMillis set to 180 (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to true minIdle set to 2 (or higher) Regards, David
RE: Representing Existing Objects In Forms
Toby, In your action, you can cast the ActionForm to the right type of form, then use the set/get methods. If your ActionForm is of type eg.FirstForm, in your Action's execute (or perform if you're using an older verions of Struts) you can: eg.FirstForm myForm = (eg.FirstForm) form; myForm.setPassword( someFunctionThatReturnsTheUsersPassword() ); That stores the password for display using the html:form ... / tag html:text property=password/, ASSUMING your eg.FirstForm ActionForm has a getPassword property. There should be good examples in the struts example .wars. Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 8:20 PM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms David, Thanks for your assistance. I suppose im wondering if there is a way to set the values of my ActionForm implementation variables(CustomerForm in my case) before the form is displayed, thus automatically populating the form when it is displayed. I am able to set the values of my form bean (CustomerForm) in its constructor. But to do what i want, i need to have access to the request object in order to get a cookie value. Perhaps I should just use your first suggestiong in order to achieve this. -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 12:03 PM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms Toby, You could: a) Have a Password field in your ActionForm. Then, you could lookup the password, copy it into the ActionForm, and have the ActionForm display it in your JSP when you show a html:text property=password/ field. b) Save the password in a bean and print it out with a bean:write ... / statement so it is only viewable (read-only) c) use an html:text name=someRequestOrSessionBean property=password / so you could save your own bean into the request or session scope then display it as a text box. If you want it to be submitted to a form, you probably want to make sure that whatever action it submits to has a field with the same property name (in this case password). I think there are other methods but these are the ones I know and use. Probably because the Struts examples showed me how (hint, hint!). :) Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 7:35 PM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms David, Perhaps I dont understand the full capabilities of ActionForms. I am fine with creating a new customer from the contents of a form. But after this is done (and, for eg, the user has used parts of the site) and they decide to change their email address, how can i display (in the form) the password they entered when they registered in order to let them modify it? thanks, toby. -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 11:25 AM To: Struts Users Mailing List Subject: RE: Representing Existing Objects In Forms Toby, Where is your trouble? Do you not understand ActionForms? Are you worried about how to transfer the data submitted and auto-populated into the ActionForm into your business logic? Or is something else confusing you? Regards, David -Original Message- From: Toby Saville [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 6:30 PM To: Struts Users Mailing List Subject: Representing Existing Objects In Forms hello all, I am wanting to represent an existing object using a form and was wondering how to do this. My situation is displaying a customer's details in a form for the purpose of allowing them to update them. I cant think how I can populate the form tho. Im new to struts and this list so i apolagise if this has already been answered. Thanks, toby -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: Monday, 1 December 2003 8:35 AM To: Struts Users Mailing List Subject: RE: org.apache.struts.legacy.GenericDataSource Rajat, I haven't had any problems with DBCP. It's just that a different pool came with Hibernate that I used in production by default. I'm using DBCP in testing but I always close my development computer (my desktop) down at night so I have no comments on how DBCP works in reality. I'm sure it's fine in production. Regards, David -Original Message- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Sunday, November 30, 2003 1:13 AM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource hey david, thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner. thanks once again! David Friedman wrote: Rajit, I don't use the Struts DataSource because I had to much
Nested tags always break
I have a situation where I can use nested:root name=ac, nested:iterate id=foo, and then *must* use nested:write name=foo property=bar, rather than omitting the name attribute. If I do, I get an exception No getter method for property foo[0].bar of bean ac. Now, this code was working fine, but I made some changes to the bean (I'm using torque). I know it's not (or at least, it shouldn't be) a problem in the beans, becuase of the fact that it works fine if I include the name attribute pointing to the id of the enclosing iterate tag. Also, why is it that I can get the struts-digest posting but can't post to the struts list? -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Is there a way to not append jessionid with html:rewrite
Hi all, Is there a way to use html:rewrite and not have it embed the jsessionid on certain links (as with JavaScripts, images, or css style sheets which don't really work well with resources that have arbitrary strings attached to them -- that is, here's the issue: script language=JavaScript src=html:rewrite forward=image_dir /Pagination.js /script This yields, as the page is loaded, /site/assets/js/?jsessionid32543543Pagination.js or some such string -- I could create forwards for every image, js and css in the site and then have the forward just write html:rewrite forward=pagination_js / but that seems awfully hackish and clunky and just moves the bad design to the struts-cohnfig.xml, which I imagine is where it should be ifg anywhere but still, theres got to be a better way? A tag attribute, a page scope attribute, something. Any help is again appreciated, thanks, Josh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
recursive tiles
Hi, I have the following definition in my tiles-defs.xml: definition name=mainTemplate path=/mainTemplate.jsp put name=title value=${title} / put name=header value=/components/header.jsp / put name=menu value=/componentes/menu.jsp / put name=body value= / put name=footer value=/componentes/footer.jsp / /definition definition name=tile.foo extends=mainTemplate put name=body value=/foo.jsp / /definition In mainTemplate.jsp I have: tiles:get name=body/ What I want is to put more variable content in my foo.jsp, the same way I put in mainTemplate.jsp something like foo.jsp: tiles:get name=subBody1/ tiles:get name=subBody2/ I tried some things here, but I always get a white screen in the body region. (and I am not forgetting taglib in the beginning of jsp file). Tks Felipe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic iterate
hi, how do i break the row according the number of data displayed, i.e i have 3 values in a row after 3 rows i have to go next row for display how can i do using only struts without scriptlets. any example or link would be great help for me thanks naveen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error while accessing the application
Hi, I went through your recommendations. I am suspicious that iWS 6.0 web server has problem with STRUTS (Kind of bugs or unsupported versions). Do you have any information about this? Thank you! Download Yahoo! Messenger now for a chance to win Live At Knebworth DVDs http://www.yahoo.co.uk/robbiewilliams - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic iterate
Are you talking about pagination? Show 3 on a page and then skip to the next page? Sounds like you want the displaytag taglib. This examples does 10 items per page: http://www.displaytag.org/example-paging.jsp Regards, David -Original Message- From: Naveen S. Kumar [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2003 1:43 AM To: Struts Users Mailing List Subject: logic iterate hi, how do i break the row according the number of data displayed, i.e i have 3 values in a row after 3 rows i have to go next row for display how can i do using only struts without scriptlets. any example or link would be great help for me thanks naveen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]