Re: FileUpload: Stream ended unexpectedly
Last time I check, isapi_redirect2.dll can not handle file upload bigger then 100K. You may try to check this bug with tomcat list. -Dan - Original Message - From: JoAnn Lemm [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 8:08 AM Subject: FileUpload: Stream ended unexpectedly Hi All, One of our customers has a problem when trying to upload a 800KB file. I'm using struts1.1 with JBoss/Tomcat4.1 and an IIS (using the isapi_redirector2.dll) in front of it. I'm using the standard struts tag: html:file property=theFile size=40 / When I watch the processing of her file, it seems to go very slowly, whereas others are much, much quicker. Any suggestions, hints and solutions would be much appreciated. JoAnn Stack Trace follows: 2004-03-17 08:08:37,084 ERROR [org.apache.struts.upload.CommonsMultipartRequestHandler] Failed to parse multipart request org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.jav a:429) at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common sMultipartRequestHandler.java:233) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR ealm.java:220) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat sValve.java:76) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci ationValve.java:65) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at
Re: preview form
select does support readonly , unfortunaely it does not understand readonly attribute, but only disabled -Dan - Original Message - From: Janice [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 16, 2004 1:03 PM Subject: preview form Hi Gang, I have a form that the client would like to be 'previewed' before users can submit. The plan is to have a form with a button that takes the user to the exact same form, but with all the form elements set to readonly. From there the user can go back to the editable form or can submit. At least that's the plan. I'm open to other suggestions, especially of the 'best practices' variety. I would have liked to display the form information on a non-form looking page, but the problem I have is the drop-downs which have a very different value from label. I don't want the preview to display something like: person: 12353 instead of person: Jane Doe So I guess I need the drop-downs, unless you all have a workaround? My immediate problem is that html:select / doesn't support readonly... what else can I do? TIA, JJ - 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]
Re: how to configure the filter
You can configure your filter to accept a set of URI pattern. Please refer to servlet 2.3 fitlter specification on how to set them up in web.xml -D - Original Message - From: Siva [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 11:20 PM Subject: how to configure the filter Dear Friends, I need to configure a filter for all the requests except a particular request. For example, for the Login request, I will go through the filter and annd the request to my web application will go through the filter which checks the authentication of the user. Could you please suggest a way to do this. Thanks, Sivakumar - 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]
Re: [OT] Scheduling
check out this link http://demo.jgsullivan.com/struts/index.html -Dan - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 31, 2003 10:36 PM Subject: [OT] Scheduling Hi All, What would be the best implementation for scheduling a job in Weblogic/J2EE environment ? thanks -raj - 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]
Re: Muliple Tomcats
Yes as long as they listen on different ports -Dan - Original Message - From: Kannan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, August 31, 2003 10:34 PM Subject: Muliple Tomcats Hi ,Is it possible to have two tomcats, one is tomcat4.1.24 and another 4.1.27 ,on the same machine ? Kannan. - 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]
Re: Java Question
Try to import only what you need, not the whole package. It can help you to trouble shoot this problem -D - Original Message - From: Kapadia Mitesh-C23457 [EMAIL PROTECTED] Newsgroups: Struts Sent: Sunday, August 24, 2003 11:32 AM Subject: Java Question I've been trying to compile my BLB (Business Logic Bean) and have been getting errors during compilation. I haven't a clue as to how I could debug this. Any assistance would be appreciated. Thanks in advance. - Mitesh Error Messages during compilation: [javac] Compiling 2 source files to C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\classes [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdSe rvice.java:56: stmt is already defined in execute(net.reumann.DataHash) [javac] Statement stmt = conn.createStatement(); [javac] ^ [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdSe rvice.java:57: rs is already defined in execute(net.reumann.DataHash) [javac] ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); [javac] ^ [javac] 2 errors Here is the code from my BLB: package net.reumann; import java.io.*; import java.util.ArrayList; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import net.reumann.*; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.log4j.*; import org.apache.commons.beanutils.BeanUtils; public class OrgIdService implements Serializable { //Declare and initialize variables Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList facilList = new ArrayList(); //The execute() method of OrgIdService is called by OrgIdAction to execute a query against the SS Test DB public ArrayList execute(DataHash beanHash) { //Get mode from DataHash int mode = beanHash.getMode(); try{ switch (mode) { case 0: Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test123 4,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT DISTINCT FACIL_ID FROM FACILITY); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close(); case 1: //Extract the facilId from the DataHash to query the FACILITY table String facilId = (String) beanHash.get(FacilId); Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test123 4,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facil.setFacilName(rs.getString(FACIL_NAME)); facil.setFacilName(rs.getString(FACIL_NAME_SHORT)); facil.setOrgId(rs.getString(ORG_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close(); default: return null; }//end Switch }//end try catch (Exception e) { return null; e.printStackTrace(); }//end catch //Return facilList Array Object to OrgIdAction return facilList; }//end Execute () method }//end class - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts test info
http://strutstestcase.sourceforge.net/ -Dan - Original Message - From: ronanoc [EMAIL PROTECTED] To: Struts List [EMAIL PROTECTED] Sent: Friday, August 22, 2003 6:13 AM Subject: struts test info Can anyone point me in the direction of good examples and info about using/writing Struts tests other than the documentation that comes with Struts test it self...? Thanks in advance. Ron. Always ready to Discotogogo - 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]
Re: Security and Roles related
logic:present role=your-role your display code here /logic:present Hi Dan, Thanks for your response, I was wondering if there is any wayout to know the role of the logged in user at the JSP level so that I can include or NOT include a particular section of the page. Regards Sreekant G @ 98404-65630 Dan Tran [EMAIL PROTECTED]To: Struts Users Mailing List .com [EMAIL PROTECTED] cc: 08/19/2003 06:02 Subject: Re: Security and Roles related PM Please respond to Struts Users Mailing List You can assign a role attribute with multiple role names in the action configuration. Underneath, struts uses isUserInRole to check against the list you provided. However, checking security is better off to let container do it for you. -D - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 4:07 AM Subject: Security and Roles related Does STRUTS provide integration with any security framework independent of the underlying application server. Basically I am looking at services like isUserInRole(), getRole() and the sort. Regards Sreekant G @ 98404-65630 -- -- - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: force servlet read re-read init parameters
Helo Harm, 1. Most containers support hot deployment where your app automatically reload when one of its properties or classes is altered, ie web.xml other a propreties file in class path 2. You can add a method in servlet and callit from browser to call init -D - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 4:43 AM Subject: force servlet read re-read init parameters Hi all, Is there some way 'in code' to force a servlet to re-read it's init parameters. Right now I have to restart my HTTP-container each time these init parameters change Thanks a lot, Harm de Laat Informatiefabriek The Netherlands. - 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]
Re: Security and Roles related
You can assign a role attribute with multiple role names in the action configuration. Underneath, struts uses isUserInRole to check against the list you provided. However, checking security is better off to let container do it for you. -D - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 4:07 AM Subject: Security and Roles related Does STRUTS provide integration with any security framework independent of the underlying application server. Basically I am looking at services like isUserInRole(), getRole() and the sort. Regards Sreekant G @ 98404-65630 - 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]
Re: JRUN 3.1/Struts 1.1 : struts-example.war - ClassNotFoundException
Jason, take a look at the below discussion link. It may help http://article.gmane.org/gmane.comp.jakarta.struts.user/24178 -Dan - Original Message - From: Mark Galbreath [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, August 18, 2003 5:11 AM Subject: RE: JRUN 3.1/Struts 1.1 : struts-example.war - ClassNotFoundException First, JDK 1.4..1_01 is unstable; Second, JRun 3.1 does not support 1.4. You need to upgrade to JRun 4.0 SP2 and JDK 1.4.1_02 or higher. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 7:00 AM To: [EMAIL PROTECTED] Subject: JRUN 3.1/Struts 1.1 : struts-example.war - ClassNotFoundException Hi, The following error appears many times in the mailing list archive for various containers , and I am also getting it in the following environment when attempting a clean deployment of Struts 1.1. struts-example.war to JRUN 3.1 I would be very grateful if someone could summarise what the specific problem is ( i.e BUG in container version etc ) and provide any configuration steps that I can perform to rectify this problem. I have noted that it is perhaps possible to work around this issue by copying JARS to the /lib/ext dir of the container. In our case, we require to deploy a warfile only. Any workaounds must affect only our server instance ( which is referred to as myApp below ). struts.jar is only located in the WEB-INF/lib dir of my application and is not on the classpath elsewhere. Regards Jason JRun 3.1 3.1.26414. Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) SunOS 5.6 Generic_105181-33 Aug 18, 2003 10:12:06 AM org.apache.struts.util.MessageResourcesFactory createFactory SEVERE: MessageResourcesFactory.createFactory java.lang.ClassNotFoundException: org.apache.struts.util.PropertyMessageResourcesFactory ... Aug 18, 2003 10:12:06 AM org.apache.struts.util.MessageResourcesFactory createFactory SEVERE: MessageResourcesFactory.createFactory java.lang.ExceptionInInitializerError at org.apache.struts.util.MessageResourcesFactory.createFactory(MessageResource sFactory.java:192) at org.apache.struts.util.MessageResources.getMessageResources(MessageResources .java:576) at org.apache.struts.action.ActionServlet.initInternal(ActionServlet.java:1329) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:464) ... Caused by: java.lang.NullPointerException at org.apache.struts.util.MessageResources.getMessageResources(MessageResources .java:577) at org.apache.struts.util.RequestUtils.clinit(RequestUtils.java:134) ... 22 more Container classpath: jrun.rootdir is /export/opt/jrun31/bin/.. $APPDIR is /export/opt/jrun31/servers/myApp Starting myApp Getting CLASSPATH with: /export/opt/jrun31/bin/../bin/getprop java.classpath -v jrun.rootdir=/export/opt/jrun31/bin/.. -v jrun.server.name=myApp -v jrun.server.rootdir=/export/opt/jrun31/servers/myApp /export/opt/jrun31/servers/myApp/local.properties /export/opt/jrun31/bin/../lib/global.properties CLASSPATH=/export/opt/jrun31/bin/../lib/ext:/export/opt/jrun31/bin/../lib/ex t/US_export_policy.jar:/export/opt/jrun31/bin/../lib/ext/activation.jar:/exp ort/opt/jrun31/bin/../lib/ext/ejb.jar:/export/opt/jrun31/bin/../lib/ext/iiop rt.jar:/export/opt/jrun31/bin/../lib/ext/jaxp.jar:/export/opt/jrun31/bin/../ lib/ext/jce1_2_1.jar:/export/opt/jrun31/bin/../lib/ext/jcert.jar:/export/opt /jrun31/bin/../lib/ext/jdbc.jar:/export/opt/jrun31/bin/../lib/ext/jms.jar:/e xport/opt/jrun31/bin/../lib/ext/jndi.jar:/export/opt/jrun31/bin/../lib/ext/j net.jar:/export/opt/jrun31/bin/../lib/ext/jsse.jar:/export/opt/jrun31/bin/.. /lib/ext/jta.jar:/export/opt/jrun31/bin/../lib/ext/local_policy.jar:/export/ opt/jrun31/bin/../lib/ext/mail.jar:/export/opt/jrun31/bin/../lib/ext/parser. jar:/export/opt/jrun31/bin/../lib/ext/pop3.jar:/export/opt/jrun31/bin/../lib /ext/servlet.jar:/export/opt/jrun31/bin/../lib/ext/sunjce_provider.jar:/expo rt/opt/jrun31/bin/../lib/jrun.jar:/export/opt/jrun31/bin/../lib/install.jar: /ex! port/opt/jrun31/bin/../lib/ejipt.jar:/export/opt/jrun31/bin/../lib/ejipt_cli ent.jar:/export/opt/jrun31/bin/../lib/ejipt_tools.jar:/opt/jdk/1.3.0.2/solar is/lib/tools.jar:/export/opt/jrun31/bin/../lib/jsp.jar:/export/opt/jrun31/bi n/../lib/ssi.jar:/export/opt/jrun31/bin/../lib/wddx.jar:/export/opt/jrun31/b in/../lib/xt.jar:/export/opt/jrun31/bin/../lib/rhino.jar:/export/opt/jrun31/ bin/../servers/lib:/export/opt/jrun31/bin/../servers/lib/jrun_drivers.jar:/e xport/opt/jrun31/bin/../servers/lib/jruntags.jar:/export/opt/jrun31/bin/../s ervers/lib/pbembedded35RE.jar:/export/opt/jrun31/servers/myApp/lib debug /opt/jdk/1.4.1_01/solaris/bin/java -Djrun.rootdir=/export/opt/jrun31/bin/.. -Xms256M -Xmx256M -Djava.awt.headless=true -Duser.language=en -Duser.timezone=Europe/London JRun -start . ( /export/opt/jrun31/servers/myApp/lib is empty ). This communication is for informational purposes
Re: Bean:message to fmt:message
Yes it does. - Original Message - From: Erez Efrati [EMAIL PROTECTED] Newsgroups: Struts Sent: Sunday, August 17, 2003 9:57 AM Subject: Bean:message to fmt:message I have a very small question: I have message keys that uses '.' like for instance 'myform.hello'. I read something but I am not sure, does fmt:message support this kind of keys or do I have to remove those '.' from my keys? Thanks, Erez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: uploadfile path
Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: image as link in diaplay taglib?
Here is an example display:column title=Edit value=img src=../images/edit.gif border=0 href=./load.do paramId=id paramProperty=student.id / -D - Original Message - From: Rick Col [EMAIL PROTECTED] Newsgroups: Struts Sent: Tuesday, August 05, 2003 9:25 AM Subject: image as link in diaplay taglib? Hi, I need expert advices from this forum about display taglib. I am trying to make an image as link on one of he columns, how could I achieve that? If you have used dipslay taglib, please advise. I appreciate your help. regards, rick __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Has anyone used Hibernate with Struts?
Victor, The beauty of Struts (MVC2) is that it does not care on how you persist you model objects. Struts' action object is the place you glue your view and model together. With that, all you need is to learn how to work with Hibernate. The following link will give you a good introduction to Hibernate thru a simple example. After that you can look further into what David has recommmended (see below) http://glen.blog-city.com/files/1018/b/HibernateKickstart.html -Dan - Original Message - From: David Friedman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, August 09, 2003 12:35 PM Subject: RE: Has anyone used Hibernate with Struts? Dear Victor, I'm in the same boat with Struts and Hibernate. I found the Hibernate 2.0 reference PDF http://hibernate.bluemars.net/hib_docs/reference/pdf/hibernate_reference.pdf and the struts-hibernate example PlugIn (by Tedd Husted, at http://sourceforge.net/projects/struts under the name hibernate) to be very helpful. Let's just say that before finding that, my attempt at a PlugIn was VERY crude (though it DID work). I'll be trying to get it to work for my site's member login feature this weekend so I should be more help next week. :) Regards, David -Original Message- From: victor gusz [mailto:[EMAIL PROTECTED] Sent: Saturday, August 09, 2003 11:52 AM To: [EMAIL PROTECTED] Subject: Has anyone used Hibernate with Struts? Hi, Guys: I want to learn Hibernate, Hibernate site does not seem to provide good examples. Has anyone have this kind simple running example for starters to follow? regards, __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: uploadfile path
as I have said, you need to do extra work to save your upload data to your designated server file. Here is an example ImportForm theForm = (ImportForm) form; FormFile file = theForm.getTheFile(); String fileName= file.getFileName(); String encoding = theForm.getEncoding(); String separator = theForm.getSeparator(); String memberType = theForm.getMemberType(); InputStream inputStream = file.getInputStream(); Charset charset = Charset.forName(encoding); BufferedReader reader = new BufferedReader( new InputStreamReader(inputStream, charset) ); // do your save here -D - Original Message - From: Daniel Massie [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:57 AM Subject: RE: uploadfile path thats exactly what has happened to me, and if i cant cast to DiskFile there isn't much information i can retrieve -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: 06 August 2003 16:41 To: 'Struts Users Mailing List' Subject: RE: uploadfile path I had a problem using DiskFile when upgrading to 1.1 though. Somehow you cannot convert/cast a FormFile to DiskFile anymore... I think there was a post to dev list about this too. It brings down your production code!!! -Original Message- From: Alok Tijoriwala [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 9:33 AM To: Struts Users Mailing List Subject: Re: uploadfile path Hi Danielle, You will have to use the DiskFile class which implements the FormFile interface. In the struts-config.xml , your controller configuration should be as under: controller processorClass=com.abnamro.waf.struts.WAFRequestProcessor tempDir=/upload maxFileSize=10K multipartClass=org.apache.struts.upload.DiskMultipartRequestHandler set-property property=inputForward value=true/ /controller Regards Alok --- Dan Tran [EMAIL PROTECTED] wrote: Folow the Struts upload example, you can trace thru how Struts gets the client file and upload to server where you have to do extra work to copy data from FormFile (its stream buffer) to the your choice of server location. -Dan - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 8:18 AM Subject: RE: uploadfile path html:form method=POST enctype=multipart/form-data html:file property=theFile / /html:form theFile is type of FormFile. You can go from there. -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 2:35 AM To: Struts Users Mailing List Subject: uploadfile path I am trying to upload a file using html:file which is received as a FormFile, the problem is I need to find out this files absolute path. Hwo can I retrieve this information? Thanks Daniel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.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] - 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]
Re: Transaction Token
Do a search on archive and look for transaction token. The struts-example in the distribution also uses transaction token as well -D - Original Message - From: Joshua White [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 5:12 PM Subject: Transaction Token I have heard the session token mentioned a few times. Does anyone have any examples on when/how to use it? Regards, Joshua - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with dbcp and database restart
Meissa, When your database restarts, all your dbcp connections (in the pool) become staled connection. In order to resolve this problem, dbcp needs to do a ping to database server to make the connection is still up before giving to your app. Looking into dbcp configuration doc, it should have a param you can setup (something like QueryString) where it should be a select statement to a database table. You many need to setup a dummy table just for this purpose. Hope this helps. -Dan - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 7:36 AM Subject: problem with dbcp and database restart hi all, I have a problem with my configured datasource using dbcp. I have posted this question to tomcat user list in vain... Maybe some struts user could help. I've configured my dbcp connection pool in Tomcat 4.1.18 server.xml file. here is an extract of it ResourceParams name=jdbc/intranetMail parameternameusername/namevalueXXX/value/parameter parameternamepassword/namevalueXXX/value/parameter parameternamedriverClassName/name valuecom.sybase.jdbc2.jdbc.SybDriver/value/parameter parameternameurl/name valuejdbc:sybase:Tds:s198000SGD1:5000/intranet_mail/value/parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter Everything works fine. But when our database server is restarted, I have to restart Tomcat in order to aquire connection to my defined pool. I wonder if there is a manner to avoid restarting Tomcat when the database server is restarted. I have added the parameters below to my pool config. parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter I recognize ,I've added that quite blindly. Can someone confirm me if this is a cure to my problem ? any suggestion is greatly appreciated. Meissa L'integrite de ce message n'etant pas assuree sur internet, Natexis Banques Populaires ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. The integrity of this message cannot be guaranteed on the Internet. Natexis Banques Populaires can not therefore be considered responsible for the contents.Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action forward to another action without form
Yes;) - Original Message - From: Benjamin Stewart [EMAIL PROTECTED] Newsgroups: Struts Sent: Sunday, July 06, 2003 6:59 PM Subject: Action forward to another action without form Greetings, I have a form that submits values. From the Action class I would (in some circumstances) like to go directly to another action class and then forward to a view. Is this possible ? Thanks Ben - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: readonly - select box
Use disabled=true -D - Original Message - From: sriram [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 04, 2003 9:04 PM Subject: readonly - select box How to make a html:select readonly (not disabled). For html:text, I can use 'readonly' but this does not exist for html:select Any suggestions? Please inform. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: readonly - select box
forget to mention, You need to add a hidden field which has the same value as the disabled select field. -Dan - Original Message - From: sriram [EMAIL PROTECTED] Newsgroups: Struts Sent: Friday, July 04, 2003 9:40 PM Subject: RE: readonly - select box If I use disable=true, then on submission of the form, this field does not have any value and so I am getting a validation error (this is a mandatory field). My requirement is to make it read-only instead of making it disabled. Any clue? -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 10:12 AM To: Struts Users Mailing List Subject: Re: readonly - select box Use disabled=true -D - Original Message - From: sriram [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 04, 2003 9:04 PM Subject: readonly - select box How to make a html:select readonly (not disabled). For html:text, I can use 'readonly' but this does not exist for html:select Any suggestions? Please inform. - 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]
Re: Initialize Struts form with request parameters
Adam's answer is absolutely correct, however let me add more details to make your job a little bit easier. 1. Create and action called loadTrainee.do and associate this action with your form. with a forward to chooseTraineePage.jsp 2. Invoke chooseTranies.do?traineeId=, struts, will call the action in 1 and automatically populate your form's traineeId for you 3. In action1, write some code to use traineeId to fill name, struts will then forward your form to chooseTraineePage.jsp to display In summary, you need 2 actions, one to to load the form and the other one is to manipulate the form Hope this helps -D - Original Message - From: Adam Hardy [EMAIL PROTECTED] Newsgroups: Struts Sent: Tuesday, July 01, 2003 7:26 AM Subject: Re: Initialize Struts form with request parameters This would happen automatically if you access the JSP via an action mapping in your struts-config. You specify the action class, the action form and the forward/jsp. struts will automatically instantiate the form when the request comes in and populate the form properties with any equivalent request parameters. hth Adam Tien Nguyen wrote: Hi all, I have a problem with struts form. The form is: html:form action=chooseTrainee html:hidden property=traineeId/ html:text property=name/ html:submit value=Submit/ /html:form and the ActionForm has the following properties (fields and getters/setters): traineeId name What I want is: the traineeId must be initialized by a value passed via URL: e.g: http://localhost/test/chooseTraineePage.jsp?traineeId=12345 How can I do that? Your reply is highly appreciated! Thanks Tien -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 3:08 PM To: [EMAIL PROTECTED] Subject: struts-user Digest 1 Jul 2003 13:07:49 - Issue 3513 struts-user Digest 1 Jul 2003 13:07:49 - Issue 3513 Topics (messages 84024 through 84051): show selected value in html:options field 84024 by: Stefan Schaebel Re: logic:equal with sessionAttributes 84025 by: Nicolas De Loof 84026 by: Filip Polsakiewicz Re: [ANNOUNCEMENT] Struts 1.1 Final released 84027 by: Arnaud HERITIER Re: Can I have a nbsp; _not_ URL encoded? 84028 by: Marco Maier 84029 by: Samuel.Opoku-Boadu.t-systems.com Re: setting input for action 84030 by: thart.part.net Validations in Struts 1.0 84031 by: sriram Populating select boxes dynamically 84032 by: sriram 84043 by: Alex Shneyderman disabling form element 84033 by: Frances Aleah Z. de Guzman 84034 by: Mark Lowe REPOST: Help! - java.security.AccessControlException 84035 by: White, Joshua A (HTSC, CASD) Problem With Struts1.1 Example 84036 by: Saroj Kumar Choudhury knowing which DispatchAction called an Action 84037 by: Ionel Gardais where does a form element get and put it's data 84038 by: Heather Buch 84040 by: Adam Hardy Newbie question: DispatchAction subclassing 84039 by: Paula Coll Upgrading to Struts 1.1 84041 by: Natalie D Rassmann 84051 by: Hajratwala, Nayan (N.) Display table contents 84042 by: Arnost Foo Tag to remove jsp from cache??? 84044 by: Prashanth.S 84046 by: Alex Shneyderman 84048 by: Nicolas De Loof External style sheets and tiles. 84045 by: James Watkins 84047 by: Nicolas De Loof Could not parse deployment descriptor: java.io.IOException: cannot resolve '/WEB-INF/struts-bean.tld' into a valid tag library 84049 by: PREETAM Balijepalli 84050 by: Adam Hardy Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- - 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]
Re: Tag to remove jsp from cache???
question: can I just configure the controller .. and dothing on the page? -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] Newsgroups: Struts Sent: Tuesday, July 01, 2003 5:41 AM Subject: Re: Tag to remove jsp from cache??? You can configure Struts to ad HTTP no-cache headers to every response : in struts-config.xml : controller nocache=true/ You can add some HTTP directives to your JSP (or tiles layouts) like this : head meta http-equiv=expires content=now meta http-equiv=pragma content=no-cache meta http-equiv=Cache-Control content=no-cache /head Nico. Before you send any data in the response you can Send the following thru your response object: % response.setDateHeader (Expires, 0); response.setHeader (Pragma, no-cache); if (request.getProtocol().equals (HTTP/1.1)) { response.setHeader (Cache-Control, no-cache); } % Note, however that users can still go back in history And resubmit their data. Browsers maintain history list And unfortunately they do remember form data too. So if Your user submitted a request and then clicks back button, The browser will ask him/her if he/she wants to resubmit the data? I saw a note somewhere in Ted's (I think) book about how you can prevent this kind of submission on the server side but have not explored that further. Now I can't even remember where I saw it. The gist of it is that before you send the form to be submitted by the user you stamp it, and remember what is it you still expecting from the user inside the Session context. If user submits the form with the right stamp the request is processed, otherwise you can tell the user to stop resubmitting the same request. Alex. -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 8:08 AM To: [EMAIL PROTECTED] Subject: Tag to remove jsp from cache??? Hi all, Is there any tag in struts to remove cache?? Whenever i hit Browser 'Back' button it should not take from the cache.. Any help is appreciated.. or is there any option to do that Thanks Prashanth - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! - 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]
Re: Tag to remove jsp from cache???
Just to confirm, I dont need to place the following META HTTP-EQUIV=Expires CONTENT=-1 META HTTP-EQUIV=Pragma CONTENT=no-cache META HTTP-EQUIV=Cache-Control CONTENT=no-cache In my pages? It is cool not to see these repeated lines in all my pages -Dan - Original Message - From: James Childers [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 9:29 AM Subject: RE: Tag to remove jsp from cache??? -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 11:20 AM To: Struts Users Mailing List Subject: Re: Tag to remove jsp from cache??? question: can I just configure the controller .. and dothing on the page? That's correct. See: http://jakarta.apache.org/struts/api/org/apache/struts/config/ControllerConfig.html#nocache - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] Newsgroups: Struts Sent: Tuesday, July 01, 2003 5:41 AM Subject: Re: Tag to remove jsp from cache??? You can configure Struts to ad HTTP no-cache headers to every response : in struts-config.xml : controller nocache=true/ You can add some HTTP directives to your JSP (or tiles layouts) like this : head meta http-equiv=expires content=now meta http-equiv=pragma content=no-cache meta http-equiv=Cache-Control content=no-cache /head Nico. Before you send any data in the response you can Send the following thru your response object: % response.setDateHeader (Expires, 0); response.setHeader (Pragma, no-cache); if (request.getProtocol().equals (HTTP/1.1)) { response.setHeader (Cache-Control, no-cache); } % Note, however that users can still go back in history And resubmit their data. Browsers maintain history list And unfortunately they do remember form data too. So if Your user submitted a request and then clicks back button, The browser will ask him/her if he/she wants to resubmit the data? I saw a note somewhere in Ted's (I think) book about how you can prevent this kind of submission on the server side but have not explored that further. Now I can't even remember where I saw it. The gist of it is that before you send the form to be submitted by the user you stamp it, and remember what is it you still expecting from the user inside the Session context. If user submits the form with the right stamp the request is processed, otherwise you can tell the user to stop resubmitting the same request. Alex. -Original Message- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 8:08 AM To: [EMAIL PROTECTED] Subject: Tag to remove jsp from cache??? Hi all, Is there any tag in struts to remove cache?? Whenever i hit Browser 'Back' button it should not take from the cache.. Any help is appreciated.. or is there any option to do that Thanks Prashanth - 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]
Re: Release of HTMLTable 0.4-rc1
Cool product and similar to Display tag with added feature like editing table. Can it work with html-el and jstl? -Dan - Original Message - From: Yuriy Zubarev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 29, 2003 12:24 AM Subject: Release of HTMLTable 0.4-rc1 Hello everyone, I'm pleased to inform you that the first release of HTMLTable 0.4 is available for your download/evaluation. HTMLTable is a table centric framework designed to be used with Struts. It facilitates operations for table paging / navigation, sorting and filtering; incorporates look and feel of tables in one centric XML file with abilities of properties inheritance and changing them in run-time. The framework also provides convenient mechanisms to work with editable (indexed) items in tables and more. Version 0.4 is a major update of the product. It contains numerous bug-fixes and new and improved functionality. Development/download site is http://sourceforge.net/projects/htmltable Live examples and configuration notes are available at http://htmltable.yuriy-zubarev.com (you will find paging, sorting, filtering examples/tutorial on Struts and HTMLTable, plus more) Thank you for your time, Yuriy ZUbarev - 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]
Re: Release of HTMLTable 0.4-rc1
Also, can it export the table to excel fomat like display tag? -Dan - Original Message - From: Yuriy Zubarev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 29, 2003 12:24 AM Subject: Release of HTMLTable 0.4-rc1 Hello everyone, I'm pleased to inform you that the first release of HTMLTable 0.4 is available for your download/evaluation. HTMLTable is a table centric framework designed to be used with Struts. It facilitates operations for table paging / navigation, sorting and filtering; incorporates look and feel of tables in one centric XML file with abilities of properties inheritance and changing them in run-time. The framework also provides convenient mechanisms to work with editable (indexed) items in tables and more. Version 0.4 is a major update of the product. It contains numerous bug-fixes and new and improved functionality. Development/download site is http://sourceforge.net/projects/htmltable Live examples and configuration notes are available at http://htmltable.yuriy-zubarev.com (you will find paging, sorting, filtering examples/tutorial on Struts and HTMLTable, plus more) Thank you for your time, Yuriy ZUbarev - 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]
Re: JSTL- el - nested beans from a map used in a form?
see this link http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt -Dan - Original Message - From: Rick Reumann [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 28, 2003 9:35 AM Subject: JSTL- el - nested beans from a map used in a form? Ok this has me stumped... the down and dirty: formBean has HashMap called fooMap fooMap has keys that bring back beans of type BarBean BarBean has properties someCode , someDescrip Now I want to iterate over this map and create the properties based on the properties in BarBean and be able to update this form which will then update the underlying BarBeans in the map. (Ignore the part that I know that's a hassle about the reset method and making sure Map exist there). c:forEach var=beanInMap items=${formBean.fooMap} someCode: html-el:text property=/br someDescrip: html-el:text property=/br br /c:forEach the text will display fine in the form with: someCode: html-el:text name=beanInMap property=beanInMap.deptCode / but when the form submits all the bean property values are null ( in the reset if it matters for testing i'm just creating a few maps with empty BarBeans in the map). I'm stumped.. any help much appreciated. -- Rick - 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]
Re: common-logging, Struts, Log4j
Rabih, You place the properties files at the wrong place. Move them to WEB-INF/classes -D - Original Message - From: rablists [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 26, 2003 5:50 AM Subject: common-logging, Struts, Log4j Hi. I have problem in using the common-logging with struts and Log4j. I am basically lost. I have short questions, I appreciate if anyone can help me little bit. these are the questions with examples: The file outputfile.log that I specify in log4j.appender.LOGFILE.File=outputfile.log where it is located? where I find it? is it physical file? I dont know why my configuration is not working, although I put the following files in the classpath WEB-INF/classes/org/myclasses/: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=outputfile.log log4j.appender.rolling.MaxFileSize=100KB log4j.appender.rolling.MaxBackupIndex=1 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n What else should I specify, or configure to make it to work? I have log4j-1.2.4.jar in my WEB-INF/lib/ Should I set any system propreties? or web.xml? or struts-config? In my classes I am doing that: protected static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(this.class); if (log.isDebugEnabled()) log.debug(getMessage( + locale + , + key + )); (How can I enable/disable the Debug or Trace?) Thank you in advance. I am really stuck and I couldnt make it to work. I am using tomcat 4.18 Rabih - 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]
Re: How To Render Binary Output - spreadsheet - from Struts
use display tag, it can do it for you transparently http://edhill.its.uiowa.edu/display/ -Dan - Original Message - From: douglas reames [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 11:24 AM Subject: How To Render Binary Output - spreadsheet - from Struts I need to render a POI constructed spreadsheet on the fly. With Struts I can: [1] [ Action / Business Bean ] dynamically design - based on user's selections, [2] [ JSP ] construct a java file, [3] [ JSP ] compile the java file. [4] [ JSP ] execute the class file Will JSP output a Byte Array to the Response output stream? regards, Douglas Reames _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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]
Re: file upload and unicode
Just upload the file as normal binary file. When you read this file at the server side, make sure to read it with correct encoding of unicode type (like UTF8,UTF16, etc) You probably need to allow the user to enter the upload file encoding type, and pass along this info to server -Dan - Original Message - From: Dzidorius Martinaitis (kafka) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, June 22, 2003 11:46 PM Subject: file upload and unicode Hello, I try use filter, but always get this error: 09:38:52,076 ERROR [Digester] Parse Error at line 65 column -1: Element web-app does not allow filter here. org.xml.sax.SAXParseException: Element web-app does not allow filter here. at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) My server is Tomcat 4.1.12 I want add filter from: http://www.anassina.com/struts/i18n/i18n.html I have problem with file upload and unicode and will hope that this solve my problem. Now I use my RequestProcessor, but it not solve problem with file upload and unicode. This code I use in RequestProcessor: try { request.setCharacterEncoding(UTF-8) ; } catch(java.io.UnsupportedEncodingException e) { System.out.println(e); } Could I hope, what filter will solve my problem with file upload and unicode and why I get this error? - 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]
Re: Access to MessageResources instance
MessageResources messages = this.getResources(request); - Original Message - From: Duma Rolando [EMAIL PROTECTED] Newsgroups: Struts Sent: Monday, June 23, 2003 3:29 AM Subject: Access to MessageResources instance I would like to know if it's possible to access an existing struts MessageResources instance without creating a new one with the factory class.I need this access outside the struts framework ( i.e. with a static method ). Thanks for your help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error when using ValidatorForm when having indexed property
post a snipet of your actionform and your validation file -D - Original Message - From: Kelvin wu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 21, 2003 11:15 PM Subject: Error when using ValidatorForm when having indexed property Help, when i use Validator form with indexed property, it goes errors. i cannot use the validator framework to validate my field. Would anyone give some suggestions? - 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]
Re: Validator Framework Questions
change your strut config to use org.apache.struts.validator.DynaValidatorForm -Dan - Original Message - From: Thomas Miskiewicz [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, June 15, 2003 9:42 AM Subject: Validator Framework Questions Hello! Reading a Struts book I wanted to give the validator framework a whirl. Since it's poorly described in the book I checked out Struts website. I wonder if when we speak about automatic form validation, then if do we mean the validator from the website http://home.earthlink.net/~dwinterfeldt or has another validator been integrated into Struts. How doI setup an automatic form validation? I've build a form with 3 fields called field1, field2, field3 and a submit button. I've defined the validation rules in the validation.xml file, but this thing just doesn't work. Below my setup. my validation.xml looks like this: form-validation formset form name=postTestForm field property=field1 depends=required,maxlength msg name=required key=error.posttest.field.null/ msg name=maxlength key=error.posttest.field.length/ arg0 key=myapp.posttest.form.titlelabel/ arg1 name=maxlength key=${var:maxlength} resource=false/ var var-namemaxlength/var-name var-value5/var-value /var /field field property=field2 depends=required,maxlength msg name=required key=error.posttest.field.null/ msg name=maxlength key=error.posttest.field.length/ arg0 key=myapp.posttest.form.introlabel/ arg1 name=maxlength key=${var:maxlength} resource=false/ var var-namemaxlength/var-name var-value2048/var-value /var /field field property=field3 depends=required,maxlength msg name=required key=error.posttest.field.null/ msg name=maxlength key=error.posttest.field.length/ arg0 key=myapp.posttest.form.bodylabel/ arg1 name=maxlength key=${var:maxlength} resource=false/ var var-namemaxlength/var-name var-value10/var-value /var /field /form /formset /form-validation my struts-config.xml lookis like this: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config form-beans form-bean name=postTestForm type=org.apache.struts.validator.DynaActionForm form-property name=field1 type=java.lang.String initial=/ form-property name=field2 type=java.lang.String initial=/ form-property name=field3 type=java.lang.String initial=/ /form-bean /form-beans global-forwards forward name=system.error path=/WEB-INF/jsp/systemError.jsp/ forward name=default.action path=/execute/homePageSetuo/ /global-forwards action-mappings action path=/homePageSetup type=com.mycompany.HomePageSetupAction unknown=true forward name=homepage.success path=/WEB-INF/jsp/homePage.jsp/ /action action path=/postTestSetup type=com.mycompany.PostTestSetupAction name=postTestForm scope=request validate=false forward name=posttest.success path=/WEB-INF/jsp/postTest.jsp / /action action path=/postTest input=/WEB-INF/jsp/postTest.jsp type=com.mycompany.PostTest name=postTestForm scope=request validate=true forward name=posttest.success path=/execute/homePageSetup/ /action /action-mappings plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml/ /plug-in /struts-config Thanks in advance for you help! Tom - 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]
Re: Validator Framework Questions
Thomas, I have seen may developers struggling with Struts Validation (IMHO, it is a GIFT to us). The best way is to read some good book like the one from Chuck Cavaness. I read it once and my validation never fail me. Or you can view his article http://jakarta.apache.org/struts/resources/articles.html -Dan - Original Message - From: Thomas Miskiewicz [EMAIL PROTECTED] Newsgroups: Struts Sent: Sunday, June 15, 2003 10:09 AM Subject: Re: Validator Framework Questions Dan, change your strut config to use org.apache.struts.validator.DynaValidatorForm That helped. Could you or someone please else answer my questions regarding the validator framework itself? Is it part of Struts framework or not (I'm using the 1.1 rc2). What steps are required to setup and use it? Where do I find more info about it. Thanks Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Login and security checks
if role check fails, Struts sets HttpResponse code 400 (Bad Request) -D - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 14, 2003 2:44 AM Subject: Re: Login and security checks What happens if you don't put a security constraint in the web.xml, but instead just specify a role in action in struts-config.xml? Adam Erik Price wrote: You can limit the resources that are protected by container managed authentication in the deployment descriptor. Whichever Action requires authentication, just make sure that you've specified it as requiring such in the web.xml. Erik - 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]
Re: UML diagrams in Struts source
do a google search struts +uml ;-) -D - Original Message - From: Rahul [EMAIL PROTECTED] To: Struts Users [EMAIL PROTECTED] Sent: Friday, June 13, 2003 6:54 PM Subject: UML diagrams in Struts source Greetings All, First of all, I take this opportunity to congratulate Ted, Cedric, George and David for an amazing job with their book Struts in Action (I got my copy couple of days ago). So much so that I am inquisitive and 've set my copy aside today and downloaded the RC2 src and having a look at 'what lies beneath' !! As for the source, it's well-documented, explained and with UML diagrams. ah ! that reminds me .. I would like to know if these UML diagrams are being generated by an open source tool. May be I could use something like that to get some neat UML diagrams for other few java project trees sitting on my PC and whose number of source files is dreary enuff to make me dizzzy. also, it might be a good idea to invite some suggestions on this list on what different strategies people adopt on reading and understanding a piece of software ? Suggestions please ...! Cheers, rahul ;o) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a jsp question:how to get the web application's directory?
Cant you just create a stream on the fly and ship it back to the user thru HTTPResponse? In you insist on writting to a webapp directory, look up getRealPath(). -Dan - Original Message - From: lcl [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 7:41 PM Subject: a jsp question:how to get the web application's directory? Hi all, I just have a question about jsp/servlet, how to gain the directory in the file system of a web application? because I want to create a file under the web application, and redirect it to user. Best Regards lcl - 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]
Re: OT FRIDAY: Take a break with struts users
They are active during the week ;-) -D - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 8:31 PM Subject: RE: OT FRIDAY: Take a break with struts users Bah! Theres nobody there! ... boring... -Original Message- From: Brandon Goodin [mailto:[EMAIL PROTECTED] Sent: Friday, 13 June 2003 04:39 To: Struts Users Mailing List Subject: RE: OT FRIDAY: Take a break with struts users try: irc.darkmyst.org 6667 #struts_users Brandon Goodin -Original Message- From: Vic Cekvenich [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 1:54 PM To: [EMAIL PROTECTED] Subject: OT FRIDAY: Take a break with struts users Did they come up with the official irc url for Struts/Friday? (this one did not work for me.) U R in trouble. Say: Ervis, and no booze: http://www.icebox.com/icebox/shows/show_54/viewer_frameset_ep1.html Mark Galbreath wrote: IRC your way to www.darkmyst.org 6667 #struts_users and relax for a while with your fellow developers. Mark - 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] - 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]
Re: Best practive for presenting a search result to a user
http://edhill.its.uiowa.edu/display/ ? - Original Message - From: Marc BEGUIGNEAU [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 9:14 AM Subject: Best practive for presenting a search result to a user Hello, I would like to know what is for you the best practice to present to a user the result of a db query (a ResultSet variable)? If, you can take some example of your suggestion, it will help me to understand... thank you in advance regards Marc ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.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]
Re: Struts Dependencies
http://jakarta.apache.org/struts/userGuide/release-notes-1.1-rc2.html But it does not have ORO info -D - Original Message - From: Doyle, Michael J [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 10:21 AM Subject: Struts Dependencies Hi, Does anyone know what version of Jakarta ORO is packaged with the Struts 1.1 RC release? Actually, it would be useful to know the versions of all the dependent libraries in the release. Is there a way to find out from a Jakarta jar what its version is? Thanks in advance! - Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Dependencies
I really dont know, for my case I use SecurityFilter which requires ORO. Why dont you take ORO out of your deployment and see if your app chokes? -Dan - Original Message - From: Doyle, Michael J [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 12:53 PM Subject: RE: Struts Dependencies Thanks for the pointer. Does this mean that Struts is not really dependent on ORO?? -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 1:59 PM To: Struts Users Mailing List Subject: Re: Struts Dependencies http://jakarta.apache.org/struts/userGuide/release-notes-1.1-rc2.html But it does not have ORO info -D - Original Message - From: Doyle, Michael J [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 10:21 AM Subject: Struts Dependencies Hi, Does anyone know what version of Jakarta ORO is packaged with the Struts 1.1 RC release? Actually, it would be useful to know the versions of all the dependent libraries in the release. Is there a way to find out from a Jakarta jar what its version is? Thanks in advance! - Mike - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: commons-logging problem in 1.1 RC2
same here, I had to replace an older version to common-loggin to get my app working ing rc2 -D - Original Message - From: Raible, Matt [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, June 09, 2003 3:10 PM Subject: commons-logging problem in 1.1 RC2 I found that this release candidate has a (seemingly) bad commons-logging.jar. I have a nightly build of Struts (20030326) and it's commons-logging.jar is 31K. The one shipped with 1.1 RC2 is only 22K and none of my JUnit tests emit any log messages. If I replace 1.1 RC2's commons-logging.jar with the one that's 31K, everything works as expected. Looks like the following files are missing: Log4jCategoryLog.class Log4jFactory.class Log4JLogger.class LogKitLogger.class package.html Here's a screenshot of the diff between the two: http://tinyurl.com/dvtw Is this as designed? Thanks, Matt -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED] Sent: Monday, June 09, 2003 1:29 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [ANNOUNCEMENT] Struts 1.1 Release Candidate 2 released The Struts team is proud to announce the release of Struts 1.1 Release Candidate 2. This release includes some new functionality, but mostly just fixes for a number of bugs which were reported against earlier versions. The Struts Team believes that this release is ready for prime time, hence its designation as a release candidate. The binary distribution is available at: http://www.apache.org/dist/jakarta/struts/binaries/ and the source distribution is available at: http://www.apache.org/dist/jakarta/struts/source/ In addition, the library distribution, which contains updated binaries without the sample applications, is available at: http://www.apache.org/dist/jakarta/struts/library/ Details of the changes in this release are available in the Release Notes, which can be found here: http://jakarta.apache.org/struts/userGuide/release-notes-1.1-rc2.html Special thanks to Ted Husted for his help in preparing this release. -- Martin Cooper - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: debugging bean populate
add this line to your log4j.properties file log4j.logger.org.apache.commons.beanutils=DEBUG -D - Original Message - From: Nathan Coast [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, June 09, 2003 6:41 PM Subject: debugging bean populate Hi, I'm getting an IllegalArgumentException presumably due to trying to populate a field of a form with the wrong datatype. I can't see where I'm going wrong. Is there a simple way to turn on debugging for the BeanUtils.populate code to see which attribute is failing? thanks Nathan java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j ava:1789) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j ava:1684) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17 13) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097) - 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]
Re: should I use struts
How complex is complex? Struts is here to solve complex problem unless the problem is so complex that struts cannot solve ;-) -Dan - Original Message - From: Hariharan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 06, 2003 9:18 PM Subject: should I use struts Hello guys, I am new to struts, I have a small doubt should I consider srtuts for any complex j2ee projects.. or is there any major problem in using srtuts for complex j2ee based proj's bye - 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]
Re: adding / creating new collection elements in a form
I just implemented myself, so let me throw a shot at this. In my case, I make my action derived from LookupDispatchAction which can handle multiple button submission handlers. One of the button is called something like addRow. When you hit this addRow button, struts will repopolate what ever on your screen and dispatch it to your addRow handler where you can add new empty row to your collection and forward back to your screen. regarding your out of index problem, I would suggest to use common Collection ListUtils.lazyList. Here is an example a lazy collection in a my form private List gradeViews = ListUtils.lazyList(new ArrayList(), new GenericFactory(org.glvnsjc.view.StudentGradeView)); //there is no direct setXXX, call getXXX first and populate the object // lazy list takes care all dynamic allocation public StudentGradeView getGradeView(int index) {return (StudentGradeView) gradeViews.get(index); } public void removeAllGradeView() { this.gradeViews.clear(); } public List getGradeViews() { return this.gradeViews;} Please look up GenericFactory in the maling list, I dont want to repost it If you dont know LookupDispatchAction yet, learn it. It has the magic that I cant live without Good luck!!! -Dan - Original Message - From: Rob [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 8:55 AM Subject: Re: adding / creating new collection elements in a form Perhaps I was not making myself clear when I first posted this. I know how to write the javascript, I know how to use struts nested/logic tags. What I was looking for when I posted was a solution whereby I could add new elements to a collection in a form. Not update existing elements, thus increasing the size of a collection based on properties from fields that were added by client side scripting. I've not been able to find a solution to this within the mailing list. But I would like to the following. I have a page with a collection of fields which are populated by a form (via it's collection). I also have a button which would allow the addition of a new row. (hopefully) Name Descrip [ xy ][ foo ] [ ab ][ bar ] Add (1) I would like to have the add button add a new pair of text input fields each time it is clicked. (2) I would like it if clicking add did not make a request to the server this being the case it suggests some kind of client side javascript adding the new fields. The problems of course with this are the following. (1) client side code won't be able to utilise the struts tags and as such I won't know what values to set the appropriate input text element attributes to. (2) It is highly likely that even if I solved problem (1) that it would result in a IndexOutOfBounds exception, or just not bother with the properties from the new fields. Has anyone else solved this? Does struts have a mechanism for dealing with this? I'm fully aware of nested/logic tags but if they are the way I can't see how. Suggestions would be appreciated, Thanks! Rob - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How Smart is DynaActionForm?
Hi Mark, thanks for reply. I knew it is a popular topic but at the time, I was not able to think of good search key for looking into the archive. Until I tumbled on a old post regarding lazyList. and the answer is there just like you have explained ;-) I hope Struts 1.2 will incorporate the patch submit by Goodwin to solve this scenario since I know lots of people have to create their own form bean to handle dynamic collection. Thanks and thanks ;-) -Dan - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 10:52 AM Subject: Re: How Smart is DynaActionForm? If you take an example of a traditional action form, the same would happen with that. If you've populated the form in the referring action then you should have an insight into how action forms and actions work together. The form bean should always be there, but know it won't self populate just like a standard action form. You can scope the form to session or repopulate as part of the action invoked via the form submission. cheers mark On Thursday, Jun 5, 2003, at 07:35 Europe/London, Dan Tran wrote: hmm, I thought the topic was designed to catch attention ;) -D - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 2:40 PM Subject: How Smart is DynaActionForm? Hello, I have an ArrayList as a element of an DyanActionForm. The list contains elements of another bean that has properties as strings. I can populate the DynaActionForm in my action and have the JSP to display it . The question here is does DynaActionForm has the intelligent to reconstruct itself after the form is submited back to the server? I tried but the ArrayList always come back emtpy.. Any suggestion? -Dan - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How Smart is DynaActionForm?
Mark, I think Brandon Goodin proposed a batch to enhance DyanActionForm to automaticly pupolating dyanamic list with a known element type It has nothting to do controller and model. Just an enhancement to the tool. Am I wrong? -Dan - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 11:28 AM Subject: Re: How Smart is DynaActionForm? I'm still not beard-sporting on these types of issues... but... wouldn't that start to cloud the demarcation between model and controller? On Saturday, Jun 7, 2003, at 19:02 Europe/London, Dan Tran wrote: Hi Mark, thanks for reply. I knew it is a popular topic but at the time, I was not able to think of good search key for looking into the archive. Until I tumbled on a old post regarding lazyList. and the answer is there just like you have explained ;-) I hope Struts 1.2 will incorporate the patch submit by Goodwin to solve this scenario since I know lots of people have to create their own form bean to handle dynamic collection. Thanks and thanks ;-) -Dan - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 10:52 AM Subject: Re: How Smart is DynaActionForm? If you take an example of a traditional action form, the same would happen with that. If you've populated the form in the referring action then you should have an insight into how action forms and actions work together. The form bean should always be there, but know it won't self populate just like a standard action form. You can scope the form to session or repopulate as part of the action invoked via the form submission. cheers mark On Thursday, Jun 5, 2003, at 07:35 Europe/London, Dan Tran wrote: hmm, I thought the topic was designed to catch attention ;) -D - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 2:40 PM Subject: How Smart is DynaActionForm? Hello, I have an ArrayList as a element of an DyanActionForm. The list contains elements of another bean that has properties as strings. I can populate the DynaActionForm in my action and have the JSP to display it . The question here is does DynaActionForm has the intelligent to reconstruct itself after the form is submited back to the server? I tried but the ArrayList always come back emtpy.. Any suggestion? -Dan - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to submit Unicode text in Struts/JSP?
http://www.anassina.com/struts/i18n/i18n.html I heard Struts 1.2 may incorporate this in the future. -Dan - Original Message - From: Dimitar Georgievski [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 11:41 AM Subject: how to submit Unicode text in Struts/JSP? hi, I'm trying to submit Unicode encoded to a search engine through a web client developed is Struts. Each JSP page of the Web client sets the page encoding using the following HTML statement: meta http-equiv=Content-Type content=text/html; charset=utf-8 After the submission, in the Action servlet, I compare the request with what I would expect to receive as a submission: It goes like this: String request2 = new String(\u017Eivot); if (request2.equals(_request)){ System.out.println(request OK); } They are not the same and I don't know why. When request2 is submitted directly to the search engine there is result received back. How to submit successfully Unicode text to the server? I'm using J2SE 1.4.1 JBoss 3.0.4 Tomcat 4.1.x thanks, dimitar - 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]
Re: Re: struts validator
I must give Chuck a Kudo here, since the day I read his book review, Strut's validator never fail me. -Dan - Original Message - From: Chuck Cavaness [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 8:53 AM Subject: Re: Re: struts validator Obviously I can only speak for the multiple projects (both my own and those I've consulted on), various articles and presentations that I've written on the Validator and of course the work that I've done with it while writing the Struts books, but the fact is that the Validator does work. Like other framework components underneath Jakarta, there are versions that have this bug or that bug. In general however, I have found the Validator to do everything that it was designed to do. I can't explain why some have had more trouble than others; it might just be the version of the software they were using at the time. Like many other facets about Struts and its related technologies, it can become unyielding at times, but is manageable. So, for those of you who have yet to try it, don't be afraid. Get yourself a book that covers it, read the docs, search the lists. Whatever you do, don't reinvent the wheel. For lexical or syntactical validation (whether client or server side), the Validator gives you a development boost. You just have to take the time to learn how to use it. Chuck From: David Graham [EMAIL PROTECTED] Date: 2003/06/05 Thu AM 09:50:08 EDT To: [EMAIL PROTECTED] Subject: Re: struts validator Not sure all this talk of validator is that justifiable. I've had no issues generating both the client side and server side validation, and its saved me a lot of work. Like others i think it would be nice to define form beans and validation rules in the same place but I like it as it is, unless anybody has any alternatives? One thing to consider is that Struts validation is based on commons-validator which reads its own xml config file. Moving the validation configuration to struts-config.xml would require us to do all the validator setup in Struts rather than leveraging the commons-validator code. David Thats my 2 pence.. Mark On Thursday, Jun 5, 2003, at 05:24 Europe/London, Jeff Kyser wrote: So jump in and help David fix it. Otherwise, you're likely to wake up and find a large block of cheddar in your bed. :) On Wednesday, June 4, 2003, at 11:18 PM, Mark Galbreath wrote: You know, I just don't get it. I think Validator was a great idea that simply proved wrong in implementation. And I know I am not alone it this assessment. Mark -Original Message- From: Jeff Kyser [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 12:03 AM To: Struts Users Mailing List Subject: Re: struts validator Like I said, I dont use client-side, and its been pretty smooth sailing for me. Sorry your experience was different, but personally, I like it. Especially defining constants for validation masks and using them over and over on lots of different forms in different projects even. And the requiredif has been pretty handy for a number of cases to boot Of course, there are still cases where I need to go to validate() methods in the actions, but they are less and less, just as I use actual FormBeans less and less, now that i halfway grok DynaValidatorForms... cheers, -jeff On Wednesday, June 4, 2003, at 10:40 PM, Mark Galbreath wrote: yeah, well, DUH! When are you guys going to realize that Validator should never have come out here even in beta. It sucks. Mark -Original Message- From: Jeff Kyser [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 9:25 PM To: Struts Users Mailing List Subject: Re: struts validator I only did server-side validations, using v1.1b3, until I saw lots of people complaining that v1.1rc1 wasn;t working for client-side validations. I tried it (rc1) and it didn't work for me either. I haven't messed with the nightly builds - just went back to 1.1b3. Its probably been fixed in the latest, but since 1.1rc2 is coming out soon, figure I'll wait until then to check it out again. -jeff On Wednesday, June 4, 2003, at 08:18 PM, Mark Galbreath wrote: Beats me, dude. I struggled with it for 3 days and said enough is enough, and wrote my own validations in my Action classes. If you look through the mail archive, you'll see right off that this is what happens to the majority of people trying to get Validator to work. Good luck, Mark -Original Message- From: Frances Aleah Z. de Guzman [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 8:55 PM To: Struts Users Mailing List; Mark Galbreath Subject: Re: struts validator how can i fix it? On Friday 30 May 2003 08:20 pm, Mark Galbreath wrote: That's because the Validator works
Re: Action Form Bean required ???
Ba?o, what kind of problem do you see? Here is example of action without actionForm action path=/nextYearReport scope=request type=org.glvnsjc.action.student.NextYearReportActionforward name=success path=/nextYearReport.jsp?page=1 redirect=false //action Note, there is no name attribute and make sure to setup the scope (the default is session, i think) My acction has no form, it create a List object and stick it into request object so that JSP can display - Original Message - From: Tran Nguyen Thanh Bao [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 1:40 AM Subject: RE: Action Form Bean required ??? Dear Andrew, Could u please send me your struts-config.xml file that you configure for some of your screens not to use form bean ??? I tried many times but not successful :( Thanks and Best Regards, TRANBAONGUYEN -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 6:42 PM To: Struts Users Mailing List Subject: RE: Action Form Bean required ??? I am doing this for some of my screens - these being the listview screens - where Im not taking in much in the way of info from the user, and hadnt bothered to create an actionForm but just grabbed what I needed straight from the request. Your probably better off having an action form however - in most cases David's criticism is valid. One 'gotcha' with not using an actionform is when you are using multipart forms. Struts is nice enough to wrap multipart requests in a MultipartRequestWrapper with the POSTed parameters available *but* it populates this wrapper from the same method that populates the actionForm. No action form means no MultipartRequestWrapper population, which means request.getParameter will return null for all except those parameters appended to the url to which the form was submitted. Of course that only affects multipart forms which yourd only be using if that page needs file upload... -Original Message- From: David Chelimsky [mailto:[EMAIL PROTECTED] Sent: Wednesday, 4 June 2003 19:20 To: Struts Users Mailing List Subject: Re: Action Form Bean required ??? You could access all of the form properties in your Action with request.getParameter(paramName); but why would you ever do that? Using the rest of the framework without FormBeans is like pushing your car down the street instead of just starting the engine Tran Nguyen Thanh Bao wrote: Dear all, I'm a new user of Struts. If I dont have Action Form Bean for each form in my application, is there any problem ? I've already tried to test with no Action Form Bean (basing on Struts examples, just remove Action Form Bean), but not successful. Can I do that in some way ? Pls give me some advises from you, experienced users :) Best Regards, TRANBAONGUYEN - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How Smart is DynaActionForm?
Hello, I have an ArrayList as a element of an DyanActionForm. The list contains elements of another bean that has properties as strings. I can populate the DynaActionForm in my action and have the JSP to display it . The question here is does DynaActionForm has the intelligent to reconstruct itself after the form is submited back to the server? I tried but the ArrayList always come back emtpy.. Any suggestion? -Dan
Re: How Smart is DynaActionForm?
hmm, I thought the topic was designed to catch attention ;) -D - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 2:40 PM Subject: How Smart is DynaActionForm? Hello, I have an ArrayList as a element of an DyanActionForm. The list contains elements of another bean that has properties as strings. I can populate the DynaActionForm in my action and have the JSP to display it . The question here is does DynaActionForm has the intelligent to reconstruct itself after the form is submited back to the server? I tried but the ArrayList always come back emtpy.. Any suggestion? -Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayList as an element of DynaActionForm
Mark, my ArrayList is a list of another value object beans which has few string properties. In my JSP I use c:foreach and display all fields in the array, of course I make them editable. When I submit the button, I would think struts is smart enought to move the form in HttpServletRequest back to the DynaActionForm. am I wrong? -Dan - Original Message - From: Mark Lowe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 2:32 AM Subject: Re: ArrayList as an element of DynaActionForm How/where do you populate your ArrayList? On Tuesday, Jun 3, 2003, at 08:58 Europe/London, Dan Tran wrote: Hello, I define an ArrayList as an element of my DynaActionForm. I set up my form and load it up on my jsp using c:foreach But when I submit the form back to the server, my ArrayList always empty. What did I do wrong? Thanks -Dan - 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]
ArrayList as an element of DynaActionForm
Hello, I define an ArrayList as an element of my DynaActionForm. I set up my form and load it up on my jsp using c:foreach But when I submit the form back to the server, my ArrayList always empty. What did I do wrong? Thanks -Dan
Re: Yahoo for the late night junkies
Why? -D - Original Message - From: Brandon Goodin [EMAIL PROTECTED] To: Struts User List [EMAIL PROTECTED] Sent: Friday, May 30, 2003 9:27 PM Subject: Yahoo for the late night junkies Hey all. I set up a temporary room on Yahoo chat at: Computers Internet Users Rooms Struts Room Brandon Goodin - 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]
Re: Yahoo for the late night junkies
can't find Users Rooms. Found Users Group -Dan - Original Message - From: Brandon Goodin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, May 30, 2003 10:51 PM Subject: RE: Yahoo for the late night junkies because :-D Brandon Goodin -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 11:17 PM To: Struts Users Mailing List Subject: Re: Yahoo for the late night junkies Why? -D - Original Message - From: Brandon Goodin [EMAIL PROTECTED] To: Struts User List [EMAIL PROTECTED] Sent: Friday, May 30, 2003 9:27 PM Subject: Yahoo for the late night junkies Hey all. I set up a temporary room on Yahoo chat at: Computers Internet Users Rooms Struts Room Brandon Goodin - 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] - 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]
Re: Too many session scoped form beans!
Nicolas, thank your for all great suggestions. But I think I will stick with the original session implementation. It is much simpler ... -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:00 AM Subject: Re: Too many session scoped form beans! That is just an example, I don't know what MAX value can be used for the datas you want the user to submit. Another solution would be to put form-bean into session scope and add a to-be-removed mecanism : When an action puts some form-bean on session scope for editing, it can set a to-be-removed string in session scope with the form-bean name. Every action of the application has to do is job, and look for this to-be-removed. If it exists, remove the associated objet from session. This way : - Your action sets the form-bean for editing, with an intialized ArrayList as item property. - Jsp generates HTML text fields for items. - If user follows the correct application behaviour, your edit-action gets its form-bean from session and can remove it itself. - If user clicks on menu or use a bookmark, form-bean will be removed by any other action. Nico. Of course, your newest solution is better, but it still does not feel right regarding the MAX_INDEX allowed ;-) -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 10:44 PM Subject: Re: Too many session scoped form beans! If this hacking scenario makes you nervous, you can set an acceptable max index value : private static final int MAX_INDEX = 100; public void setItem(int index, Object obj) { if (index MAX_INDEX) { throw new IndexOutOfBoundsException(); } Nico. Nicolas, Your great suggestion makes me nervous ... It is possible for a hacker to change the index so big that it can hog the CPU, which busy creating empty node, for each request. However, I cant come up with another solution Any comments? anyone? -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, March 28, 2003 5:19 AM Subject: Re: Too many session scoped form beans! Reading my own post I realize this code will throw an IndexOutOfBoundsException You need to put 'empty' datas on the List as needed : protected List item; public void setItem(int index, Object obj) { if (this.item == null) { this.item = new ArrayList(index); } for (int i = this.item.size(); i index; i++) { this.item.add(); } this.item.add(index, obj); } Nico. I think you can use something like this in a request scoped form-bean : protected List item; public void setItem(int index, Object obj) { if (this.item == null) { this.item = new ArrayList(index); } else { this.item.ensureCapacity(index); } this.item.add(index, obj); } This way, when form-bean population occurs, you will get a new Collection when needed. Nico. I'd like to know if it's possible to avoid using to many session scoped form beans. I have a bean that contains a collection and I use nested:iterate to display entry fields on my html:form. When the form is submitted, I get an error in BeanUtils.populate(), because the new bean (when the bean is request scoped) contains an empty collection and populate() tries to set the properties of the elements that existed on the bean of the previous request. If I change the bean to session scope, everything works fine (because now the bean is the same for both requests), but I think it's kind of messy to have lots of session scoped beans. I'd appreciate to have any comments on this subject. Thanks Jorge Mascena - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED]
Re: Populate options with integers
Take alook at Struts-example.war in the distribution It uses html:select/html:options and LabelValueBean to do what you need. -Dan - Original Message - From: Dhruva B. Reddy [EMAIL PROTECTED] To: Struts User Mailing List [EMAIL PROTECTED] Sent: Monday, March 31, 2003 9:43 AM Subject: Populate options with integers Hi, I'm trying to populate a drop down list with integers. Basically, I want the following to be generated: select option value=11/option option value=22/option option value=33/option option value=44/option /select Is there an easy way to do this? I can't seem to find anything in the documentation or on Google. Thanks, Dhruva -- Dhruva B. Reddy ResortQuest International, Inc. phone: +1 303 604 4893 aim:dhruvarqi - 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]
Re: It's late and I'm feeling stupid
Jeff, I tried to look at your original post and I dont really understand the exact problem. You post your minimal code and see if I can help. -Dan - Original Message - From: Jeff Smith [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 8:42 AM Subject: Re: It's late and I'm feeling stupid Another day, and I start it out much more alert and perceptive. Unfortunately I'm still not seeing the solution. (Undoubtedly I am ignorant of some key piece of struts knowledge that is holding me back. :-) I see how struts-el would allow me to reference ${foo} values within the html-el:link tag, but that isn't the problem. The field of the html:link tag that I want to use only takes references to beans, so I have to get my value into a dynamically declared bean first. I don't think struts-el tags will help with this - at least not this step in the problem. Or am I missing something? Any other suggestions? Jefficus - Original Message - From: Dan Tran [EMAIL PROTECTED] It is late too and my mind also slowing down as well ;-) So here is my vague ans. Use Struts-el tag lib, it works well with JSTL -Dan - 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]
Re: Validation for anything other than html:text
Required select works for me! do you have the normal text file validation working ? -Dan - Original Message - From: Steven Citron-Pousty [EMAIL PROTECTED] To: struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 1:43 PM Subject: Validation for anything other than html:text Greetings all: How do you validate a html:select or html:radio for required using the validator plugin. All the doco deals with html:text. I found some old postings but they didn't really explain how to do this. I tried it out and it doesn't seem to work. I want the form to return an error if the user forgets to pick something off the select list. I printed out what was in the request for the select list and its a blank or null, which, according to the javaDoc should fail for a required field. Thanks for your help, Steve - 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]
Re: Setting up JSTL---How?
suggestion!! download Struts-el example, load and run it. And use it as template for your new jstl work. -Dan - Original Message - From: joni santoso [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 11:15 PM Subject: Setting up JSTL---How? Hi, I have downloaded jakarta-taglibs-20030316.zip. I have unzipped and installed it to my tomcat 4.1.18. Here is my test web-app's web.xml (is it wrong?) : !-- ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app taglib taglib-urihttp://java.sun.com/jstl/core/taglib-uri taglib-location/WEB-INF/c-1_0.tld/taglib-location /taglib /web-app -- and my test's web-inf has all the tld files from jakarta taglib. in the lib directory there are jstl.jar and standard.jar. here is my test.jsp : !-- %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % Your name is : c:out value=$param.userName default=Unknown / -- when i ran it, errors happened. this is the error: please explain. thx type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:386) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:530) at java.lang.Thread.run(Thread.java:536) root cause java.lang.NoClassDefFoundError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.getEvalu atorByName(ExpressionEvaluatorManager.java:146) at org.apache.taglibs.standard.tlv.JstlBaseTLV.validateExpression(JstlBaseTLV.j ava:202) at org.apache.taglibs.standard.tlv.JstlCoreTLV$Handler.startElement(JstlCoreTLV .java:181) at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.j ava:459) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXML DocumentParser.java:221) at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBin der.java:874) at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinder.ja va:591) at
Re: Too many session scoped form beans!
Of course, your newest solution is better, but it still does not feel right regarding the MAX_INDEX allowed ;-) -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 10:44 PM Subject: Re: Too many session scoped form beans! If this hacking scenario makes you nervous, you can set an acceptable max index value : private static final int MAX_INDEX = 100; public void setItem(int index, Object obj) { if (index MAX_INDEX) { throw new IndexOutOfBoundsException(); } Nico. Nicolas, Your great suggestion makes me nervous ... It is possible for a hacker to change the index so big that it can hog the CPU, which busy creating empty node, for each request. However, I cant come up with another solution Any comments? anyone? -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, March 28, 2003 5:19 AM Subject: Re: Too many session scoped form beans! Reading my own post I realize this code will throw an IndexOutOfBoundsException You need to put 'empty' datas on the List as needed : protected List item; public void setItem(int index, Object obj) { if (this.item == null) { this.item = new ArrayList(index); } for (int i = this.item.size(); i index; i++) { this.item.add(); } this.item.add(index, obj); } Nico. I think you can use something like this in a request scoped form-bean : protected List item; public void setItem(int index, Object obj) { if (this.item == null) { this.item = new ArrayList(index); } else { this.item.ensureCapacity(index); } this.item.add(index, obj); } This way, when form-bean population occurs, you will get a new Collection when needed. Nico. I'd like to know if it's possible to avoid using to many session scoped form beans. I have a bean that contains a collection and I use nested:iterate to display entry fields on my html:form. When the form is submitted, I get an error in BeanUtils.populate(), because the new bean (when the bean is request scoped) contains an empty collection and populate() tries to set the properties of the elements that existed on the bean of the previous request. If I change the bean to session scope, everything works fine (because now the bean is the same for both requests), but I think it's kind of messy to have lots of session scoped beans. I'd appreciate to have any comments on this subject. Thanks Jorge Mascena - 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] - 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] - 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]
Re: Setting up JSTL---How?
struts-el uses JSTL. So if you follow the template of struts-el example app, your JSTL will work. struts-el is under struts distribution in contrib directory. - Original Message - From: joni santoso [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 11:24 PM Subject: Re: Setting up JSTL---How? where can i get that struts-el? still i am curious why the jstl didn't work :(. On Sun, 30 Mar 2003 23:20:03 -0800 Dan Tran [EMAIL PROTECTED] wrote: suggestion!! download Struts-el example, load and run it. And use it as template for your new jstl work. -Dan - Original Message - From: joni santoso [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 11:15 PM Subject: Setting up JSTL---How? Hi, I have downloaded jakarta-taglibs-20030316.zip. I have unzipped and installed it to my tomcat 4.1.18. Here is my test web-app's web.xml (is it wrong?) : !-- ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app taglib taglib-urihttp://java.sun.com/jstl/core/taglib-uri taglib-location/WEB-INF/c-1_0.tld/taglib-location /taglib /web-app -- and my test's web-inf has all the tld files from jakarta taglib. in the lib directory there are jstl.jar and standard.jar. here is my test.jsp : !-- %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % Your name is : c:out value=$param.userName default=Unknown / -- when i ran it, errors happened. this is the error: please explain. thx type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio n FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC h ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j a va:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo k eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j a va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo k eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:18 0 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo k eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve . java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo k eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:17 2 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo k eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav a :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invo k eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConn e ction(Http11Protocol.java:386) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.ja v a:530) at java.lang.Thread.run(Thread.java:536) root cause java.lang.NoClassDefFoundError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140
Re: Bitmechanic JDBC Connection Pool or Struts Connection Pool
http://jakarta.apache.org/struts/faqs/database.html -D - Original Message - From: niksa_os [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 2:28 AM Subject: Bitmechanic JDBC Connection Pool or Struts Connection Pool I search the [EMAIL PROTECTED] but I didn't find anything on how to setup Bitmechanic JDBC Connection Pool. http://www.bitmechanic.com/projects/jdbcpool/ Does someone can explain me how to setup Bitmechanic in struts-config.xml, web.xml and how to get connection in Action? I use MySQL: jdbc:mysql://localhost/MyDB user name:aa password: bb Or, does Struts have connection pool? If yes, how to setup with my MyDB. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Do Struts increase developer productivity?
James Michell is out of work? Me too. How many good ppl are in the same situation these days? Sorry for breaking out of the rythm. -D - Original Message - From: Micael [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 12:05 AM Subject: RE: Do Struts increase developer productivity? If you have a good lead person on your team, that makes all the difference. Someone has to know what they are doing, and then everyone speeds up. That is especially true if you are using the pluses of the Xtremists. There are lots of good people out there to take these positions. I understand James Mitchell is looking for work and I would hire him at the drop of a hat, if I had a position, which I don't. My sense is that there are a lot of good people that can take Struts out the door, today, anywhere. Struts is not the problem. Struts is the solution. There are other simpler frameworks, like Maverick. You can even build your own framework. Struts is a pretty good framework (I take pretty good to be very good) that you can also tweak. I personally wish that the Struts people would just take the bull by the horns and make a big shift in the framework, using all the things that have been learned since its inception. I probably am not as smart as they are in this respect. There is a pretty huge change, however, in 1.1 which is really welcomed. At 01:54 AM 3/29/03 -0600, you wrote: I think you can do the kid in a candy store thing with Struts all too easily. As with any project, make sure you set your goals in a design doc, just because struts can do it, doesn't mean you should do it. I had a project hit a wall because my boss kept asking if I could do this and that, yeah, struts can allow me to do that... Okay, why don't we add that then... -Jacob | -Original Message- | From: Navjot Singh [mailto:[EMAIL PROTECTED] | Sent: Friday, March 28, 2003 9:51 PM | To: Struts Users List | Subject: Re: Do Struts increase developer productivity? | | here are my 2 cents to this discussion ;-) | | Initially, the development with struts can be slow. I won't say Struts is | complex, it is easy but to create a simple form submission you got to have | quite a number of files in set up. But slowly the things get sunk into | your | mind and then it's real fast process. | However, the speed can be increased with tools like Easystruts and IDEs | giving extensive support to Struts. | | - navjot singh | | - Original Message - | From: Igor Shabalov [EMAIL PROTECTED] | To: Struts Users Mailing List [EMAIL PROTECTED] | Sent: Saturday, March 29, 2003 4:26 AM | Subject: Re: Do Struts increase developer productivity? | | | | I 100% agree, Struts is good staff for use by the end of the day, but it | can slow development process. So, can we do something to reduce that | backslash? My answer is  yes, by introducing tools that helps | developers | to fight with Struts complexity. Can Struts be better from functional | prospective? Of course yes, however, it can increase complexity even | more, | so we see more demand for good tools. | | Once again, I do not to offend anybody. | | Thank you for answer, | Igor. | | On Fri, 28 Mar 2003 17:30:20 -0500, Mark Zeltser | [EMAIL PROTECTED] wrote: | | Plus all QA work each of us does by testing struts in different | environments. | | Igor, | | In our experience, struts will decrease initial productivity due to | the | learning | curve. However, this will be time well spent, assuming you will be | getting | maintainable application, plus struts is widely used, so there is a | good | chance you | will be able to find talent if needed. | | Re. individual components. Start with well defined directory structure | for your | source, images, etc. and ant based build script. Keep adding | functionality as you | feel that there is a need for it. (E.g.: need to authenticate users. | Before | implementing your own authentication search the archives, you will | find | that a lot | of problems were already discussed and solved) | | Mark. | | David Graham wrote: | | I don't have real numbers but thousands of hours of work from many | highly | paid software engineers has gone into Struts. Say an average | developer | gets | $50/hour * 2000 hours (probably low) = $100,000. | | Does your company or your clients want to pay that much to develop | their | own | framework? | | David | | From: Igor Shabalov [EMAIL PROTECTED] | Reply-To: Struts Users Mailing List struts- | [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Subject: Do Struts increase developer productivity? | Date: Fri, 28 Mar 2003 14:00:00 -0800 | | | Hello, all! | Do anybody have any data how using Struts can increase (or | decrease) | developer productivity. I mean, for example, â??using Strutsâ?? can | save up | to xx% of development cost. Or save up to
Re: initialize application-scope variables
I dont think there is a way. You can refactor it by moving the JSP init code to a java bean and have both JSP and PlugIn to call the java bean is it okie? -D - Original Message - From: Brian Buckley [EMAIL PROTECTED] To: Struts Users [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:12 AM Subject: initialize application-scope variables Hello, I am writing a PlugIn (subclass of org.apache.struts.action.PlugIn ) to initialize a bunch of application-scope variables. Several of my JSP snippets also initialize application-scope variables (using either c:set ..scope=application /, jsp:useBean ...scope=application /, bean:define... /, and/or % application.setAttribute(...); %) and I would like to reuse these. Is it possible to call JSPs from the init() method of a PlugIn? One could of course just translate the JSP snippets to java for the PlugIn, but the JSP is already written and some of the initializations are more easily written in JSP than java anyway. Any tips appreciated. Brian - 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]
Re: application.getRealPath(/) from ActionForm???
If you deploy your app as a WAR file, then it is the correct result since there is no real directory to return But you can use this code InputStream is = servlet.getServletContext().getResourceAsStream(pathName); where pathName is the context path to your file in the WAR archive. (ie /WEB-INF/yourFileName.txt) Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 1:07 PM Subject: application.getRealPath(/) from ActionForm??? When deploying my Struts application I ran in to a small problem. I had hard coded the path to an xml file used to load values into my form. I need to get a relative path. I tried the following, but got a null pointer. ActionServlet as = this.getServlet(); ServletContext application = as.getServletConfig().getServletContext(); String basePath = application.getRealPath(/); Thanks for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering - 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]
Re: Setting externally JNDI properties
The following snippets may help snippet //place your jndi under your WEB-INF/classes ClassLoader classLoader = getClass().getClassLoader(); InputStream in = classLoader.getResourceAsStream(jndi.properties); if ( in == null ) throw new MissingResourceException(JNDI property file jndi.properties' not found in classpath., null, null); Properties jndiProperties = new Properties(); try { jnidProperties.load(in); }catch ( IOException e ) { throw new MissingResourceException(Problem loading 'jndi.properties', null, null); } /snippet Or snippet //place your jndi file under WEB-INF InputStream is = servlet.getServletContext().getResourceAsStream(/WEB-INF/jndi.properties); if ( in == null ) throw new MissingResourceException(jndi property file jndi.properties' not found in classpath., null, null); Properties jndiProperties = new Properties(); try { jndiProperties.load(in); }catch ( IOException e ) { throw new MissingResourceException(Problem loading 'jndi.properties', null, null); } /snippet Good luck. -D - Original Message - From: Marco Tedone [EMAIL PROTECTED] To: Struts-user-list [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 2:12 PM Subject: Setting externally JNDI properties Hi, At present my application is 'talking' with Jboss via specific properties set a compile time. I would like to move those properties in a jndi.properties file (which I would put under WEB-INF/classes). How could I retrieve jndi.properties without specifying the exact location (which could vary from user by user), i.e. dynamically? I tried with the following: getServlet().getServletContext().getResource(jndi.properties); but the return is null. I also tried getServlet().getServletContext().getResource(/jndi.properties) but the return was the same. I also tried to put jndi.properties in the jar file containing the application's classes but nothing. Any idea? Thanks, Marco - 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]
Re: application.getRealPath(/) from ActionForm???
My guess about the null control serverlet, is because struts may not init the form's control servlet after the form constructor completes. If you can take a look at my answer to Setting external JNDI properties, you can put your file in classpath and load it. BTW, you might have a performance problem loading the file for every constructor of your action object. You might want to load your file at startup and access it thru a singleton. Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 7:53 PM Subject: RE: application.getRealPath(/) from ActionForm??? ActionServlet as = this.getServlet(); This is returning null. What is the proper way to get a reference to the controller servlet from and Action from? Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Jason Long [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:49 PM To: Struts Users Mailing List Subject: RE: application.getRealPath(/) from ActionForm??? Actually I am calling a funtion that loads values into the form in the object. This load method needs to find a relative path. I cannot seem to get a reference to the controller servlet or any other way to get the path to my WEB-INF. public final class ManagerForm extends ActionForm { public ManagerForm() throws Exception { this.load(); } ... ... } -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 8:25 PM To: Struts Users Mailing List Subject: Re: application.getRealPath(/) from ActionForm??? If you deploy your app as a WAR file, then it is the correct result since there is no real directory to return But you can use this code InputStream is = servlet.getServletContext().getResourceAsStream(pathName); where pathName is the context path to your file in the WAR archive. (ie /WEB-INF/yourFileName.txt) Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 1:07 PM Subject: application.getRealPath(/) from ActionForm??? When deploying my Struts application I ran in to a small problem. I had hard coded the path to an xml file used to load values into my form. I need to get a relative path. I tried the following, but got a null pointer. ActionServlet as = this.getServlet(); ServletContext application = as.getServletConfig().getServletContext(); String basePath = application.getRealPath(/); Thanks for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to logic:iterate throu serveral collections at once ?
The answer is yes. Please check struts doc However, by place your id and label into LabelValueBean. It will make your code easier write thru logic:iterate -Dan - Original Message - From: Slava_L [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:02 PM Subject: how to logic:iterate throu serveral collections at once ? Suppose i have ids[] array and labels[] array I need to render link a href=someaction.do?id=ids[i] label[i] /a is it possible to do with logic:iterate ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: example of PlugIn for java.sql.Date Converter registration
Jeff, your code suggests a better way to make date format configurable. Thanks -Dan - Original Message - From: Jeff Kyser [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 4:45 PM Subject: Re: example of PlugIn for java.sql.Date Converter registration Hi all, as a follow-up to my question, wanted to thank Dan Tran for his help and also Rick Reumann for his. I was trying to add a PlugIn in the struts-config.xml file to augment the functionality of the BeanUtils.copyProperties function to handle java.util.Date going from a form to a model bean. If this was obvious to others, please excuse the post, but it sure wasn't obvious to me. I ended up reviewing the sources for the validator and tiles plugins to get this to work. Here's a snippet from my struts-config.xml file; in addition to loading the custom converters, I wanted to be able to supply a value to be used by the SimpleDateFormat, hence my dateFormat property below. !-- A PlugIn to extend BeanUtils.copyProperties to handle java.sql.Date -- plug-in className=torch.beans.ConvertUtils.ConverterPlugIn set-property property=dateFormat value=-MM-dd/ /plug-in And here's (below) the init() method I ended up with as a part of implementing the PlugIn interface. The basics came from Dan, and finding the proper PlugIn to retrieve my dateFormat property was gleaned from the sources. Well, it works, but as to whether there is a cleaner/shorter way to do this, I don't know, but would be glad to hear it. regards, -jeff public final class ConverterPlugIn implements org.apache.struts.action.PlugIn { /** * init - implements the PlugIn interface */ public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { PlugInConfig[] plugs = config.findPlugInConfigs(); boolean found = false; int i = 0; while (i plugs.length !found) { if (this.getClass().getName().equals(plugs[i].getClassName())) found = true; else i++; } if (found) { Object fmt = plugs[i].getProperties().get(dateFormat); if (fmt != null) setDateFormat(fmt.toString()); } ConvertUtils.register(new DateConverter(),Date.class); ConvertUtils.register(new StringConverter(), String.class); } public static void setDateFormat(String fmt) { fmt_ = fmt; } I had a default format, in case there wasn't one in the config file, and in the DateConverter, I retrieved the date format... On Thursday, March 27, 2003, at 08:40 PM, Jeff Kyser wrote: Hi, I want to use BeanUtils.copyProperties to copy FROM my model TO my form, and I have java.sql.Dates in my model. From numerous related posts, I glean that the best place for a a custom Converter to be registered is in a PlugIn in your struts-config.xml file. 1. Does anyone have an example of this they could offer up? i think I've broken google... 2. Do you really have to do this to get a java.sql.Date from a model bean onto a form as a String using BeanUtils? or is there a better way? thanks, -jeff - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Test
I keep seeing double messages sending to me when I make a post to this group Please ignore this mail -Dan _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Test
Please ignore -D _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: application.getRealPath(/) from ActionForm???
Is your XML file static? If it does, you cam place the xml file in your class path and use my other posted solution to have access to its InputStream. If you dont like to place it in classpath, you can create a Singleton wrapper around your XML and load it up during application startup, via Struts plugin or a servlet. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:31 PM Subject: RE: application.getRealPath(/) from ActionForm??? This file is and xml file that contain that data that the form needs to be filled with. It is in my WEB-INF/data folder. The problem is that I cannot find a way to tell my form where to load this data from. I need need to access to the ServletContext so I can get the real path of the web application. Some has to know how to do this easily. Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:29 PM To: Struts Users Mailing List Subject: Re: application.getRealPath(/) from ActionForm??? My guess about the null control serverlet, is because struts may not init the form's control servlet after the form constructor completes. If you can take a look at my answer to Setting external JNDI properties, you can put your file in classpath and load it. BTW, you might have a performance problem loading the file for every constructor of your action object. You might want to load your file at startup and access it thru a singleton. Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 7:53 PM Subject: RE: application.getRealPath(/) from ActionForm??? ActionServlet as = this.getServlet(); This is returning null. What is the proper way to get a reference to the controller servlet from and Action from? Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Jason Long [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:49 PM To: Struts Users Mailing List Subject: RE: application.getRealPath(/) from ActionForm??? Actually I am calling a funtion that loads values into the form in the object. This load method needs to find a relative path. I cannot seem to get a reference to the controller servlet or any other way to get the path to my WEB-INF. public final class ManagerForm extends ActionForm { public ManagerForm() throws Exception { this.load(); } ... ... } -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 8:25 PM To: Struts Users Mailing List Subject: Re: application.getRealPath(/) from ActionForm??? If you deploy your app as a WAR file, then it is the correct result since there is no real directory to return But you can use this code InputStream is = servlet.getServletContext().getResourceAsStream(pathName); where pathName is the context path to your file in the WAR archive. (ie /WEB-INF/yourFileName.txt) Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 1:07 PM Subject: application.getRealPath(/) from ActionForm??? When deploying my Struts application I ran in to a small problem. I had hard coded the path to an xml file used to load values into my form. I need to get a relative path. I tried the following, but got a null pointer. ActionServlet as = this.getServlet(); ServletContext application = as.getServletConfig().getServletContext(); String basePath = application.getRealPath(/); Thanks for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: how to logic:iterate throu serveral collections at once ?
logic:iterate exposes an collection's index, with can be use to access other collection, right? -D - Original Message - From: Slava_L [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:15 PM Subject: Re: how to logic:iterate throu serveral collections at once ? Struts doc says that only one object can be iterated inside on logic:iterate - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 12:39 PM Subject: Re: how to logic:iterate throu serveral collections at once ? The answer is yes. Please check struts doc However, by place your id and label into LabelValueBean. It will make your code easier write thru logic:iterate -Dan - Original Message - From: Slava_L [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:02 PM Subject: how to logic:iterate throu serveral collections at once ? Suppose i have ids[] array and labels[] array I need to render link a href=someaction.do?id=ids[i] label[i] /a is it possible to do with logic:iterate ? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: It's late and I'm feeling stupid
It is late too and my mind also slowing down as well ;-) So here is my vague ans. Use Struts-el tag lib, it works well with JSTL -Dan - Original Message - From: Jeff Smith [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:47 PM Subject: It's late and I'm feeling stupid I have some data in an XML file. I read it in from JSP using x:set (the JSTL X tags) I then transfered it to a variable like so: c:set var=somevarname x:out ... / /c:set I can now dump it out happily using c:out It turns out that this particular value (an integer) is useful in a subsequent JSP page (if my user elects to go there by clicking the appropriate link). So I want to pass it as a parameter when I link to that next page. Aha! the html:link allows me to add parameter information. But it appears that such info must be in a bean. So I created a bean: jsp:useBean id=foo class=java.lang.String/ But for all my efforts, I can't figure out how to get the somevarname value into foo I tried: jsp:useBean id=foo class=java.lang.Stringc:out value=${somevarname}//jsp:useBean but that isn't working. (Subsequent attempts to bean:write name=foo/ come up blank.) I just know when I wake up tomorrow, the answer is going to be obvious and I'm going to feel stupid for asking. But one of the advantages of working late without much sleep is that we don't care how we're going to feel about it in the morning. Any suggestions? Jefficus - 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]
Re: how to logic:iterate throu serveral collections at once ?
A clean solution is to put your label, value, and boolean flag in a Bean then you can access all those properties as you iterating thru. Regarding the coloring, instead of using html:options tag, your can use logic:iterate and writing out the html code and color yourself -Dan - Original Message - From: Jain, Shilpi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:51 PM Subject: RE: how to logic:iterate throu serveral collections at once ? Hi I am using an options tag to display a label value collection. I have an additional propert associated with each of the values on this option which I have stored as another boolean[]. Now in my UI, I want to have each of these options to appear in two different colors depending on the corresponding value in my boolean[]. How can I implement this. -Shilpi -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Sunday, March 30, 2003 11:15 AM To: Struts Users Mailing List Subject: Re: how to logic:iterate throu serveral collections at once ? logic:iterate exposes an collection's index, with can be use to access other collection, right? -D - Original Message - From: Slava_L [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:15 PM Subject: Re: how to logic:iterate throu serveral collections at once ? Struts doc says that only one object can be iterated inside on logic:iterate - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 30, 2003 12:39 PM Subject: Re: how to logic:iterate throu serveral collections at once ? The answer is yes. Please check struts doc However, by place your id and label into LabelValueBean. It will make your code easier write thru logic:iterate -Dan - Original Message - From: Slava_L [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:02 PM Subject: how to logic:iterate throu serveral collections at once ? Suppose i have ids[] array and labels[] array I need to render link a href=someaction.do?id=ids[i] label[i] /a is it possible to do with logic:iterate ? - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: application.getRealPath(/) from ActionForm???
Have you given a thought on my Singleton solution? -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:48 PM Subject: RE: application.getRealPath(/) from ActionForm??? It is not static. I need it to load when ActionForm is loaded. Is there no way to load form values from an external source? Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 11:42 PM To: Struts Users Mailing List Subject: Re: application.getRealPath(/) from ActionForm??? Is your XML file static? If it does, you cam place the xml file in your class path and use my other posted solution to have access to its InputStream. If you dont like to place it in classpath, you can create a Singleton wrapper around your XML and load it up during application startup, via Struts plugin or a servlet. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:31 PM Subject: RE: application.getRealPath(/) from ActionForm??? This file is and xml file that contain that data that the form needs to be filled with. It is in my WEB-INF/data folder. The problem is that I cannot find a way to tell my form where to load this data from. I need need to access to the ServletContext so I can get the real path of the web application. Some has to know how to do this easily. Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 10:29 PM To: Struts Users Mailing List Subject: Re: application.getRealPath(/) from ActionForm??? My guess about the null control serverlet, is because struts may not init the form's control servlet after the form constructor completes. If you can take a look at my answer to Setting external JNDI properties, you can put your file in classpath and load it. BTW, you might have a performance problem loading the file for every constructor of your action object. You might want to load your file at startup and access it thru a singleton. Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 7:53 PM Subject: RE: application.getRealPath(/) from ActionForm??? ActionServlet as = this.getServlet(); This is returning null. What is the proper way to get a reference to the controller servlet from and Action from? Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering -Original Message- From: Jason Long [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:49 PM To: Struts Users Mailing List Subject: RE: application.getRealPath(/) from ActionForm??? Actually I am calling a funtion that loads values into the form in the object. This load method needs to find a relative path. I cannot seem to get a reference to the controller servlet or any other way to get the path to my WEB-INF. public final class ManagerForm extends ActionForm { public ManagerForm() throws Exception { this.load(); } ... ... } -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 8:25 PM To: Struts Users Mailing List Subject: Re: application.getRealPath(/) from ActionForm??? If you deploy your app as a WAR file, then it is the correct result since there is no real directory to return But you can use this code InputStream is = servlet.getServletContext().getResourceAsStream(pathName); where pathName is the context path to your file in the WAR archive. (ie /WEB-INF/yourFileName.txt) Good luck. -Dan - Original Message - From: Jason Long [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 29, 2003 1:07 PM Subject: application.getRealPath(/) from ActionForm??? When deploying my Struts application I ran in to a small problem. I had hard coded the path to an xml file used to load values into my form. I need to get a relative path. I tried the following, but got a null pointer. ActionServlet as = this.getServlet(); ServletContext application = as.getServletConfig().getServletContext(); String basePath = application.getRealPath(/); Thanks for your time, Jason Long - CEO and Chief Software Engineer Supernova Software - supernovasoftware.com BS
Test,please ignore
-D _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Too many session scoped form beans!
Nicolas, Your great suggestion makes me nervous ... It is possible for a hacker to change the index so big that it can hog the CPU, which busy creating empty node, for each request. However, I cant come up with another solution Any comments? anyone? -D - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, March 28, 2003 5:19 AM Subject: Re: Too many session scoped form beans! Reading my own post I realize this code will throw an IndexOutOfBoundsException You need to put 'empty' datas on the List as needed : protected List item; public void setItem(int index, Object obj) { if (this.item == null) { this.item = new ArrayList(index); } for (int i = this.item.size(); i index; i++) { this.item.add(); } this.item.add(index, obj); } Nico. I think you can use something like this in a request scoped form-bean : protected List item; public void setItem(int index, Object obj) { if (this.item == null) { this.item = new ArrayList(index); } else { this.item.ensureCapacity(index); } this.item.add(index, obj); } This way, when form-bean population occurs, you will get a new Collection when needed. Nico. I'd like to know if it's possible to avoid using to many session scoped form beans. I have a bean that contains a collection and I use nested:iterate to display entry fields on my html:form. When the form is submitted, I get an error in BeanUtils.populate(), because the new bean (when the bean is request scoped) contains an empty collection and populate() tries to set the properties of the elements that existed on the bean of the previous request. If I change the bean to session scope, everything works fine (because now the bean is the same for both requests), but I think it's kind of messy to have lots of session scoped beans. I'd appreciate to have any comments on this subject. Thanks Jorge Mascena - 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] - 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]
Re: tags within tags i18n
try this snippet bean:define id=myVar bean:message key=myKey / /bean html:link title=%=myVar % forward= ... / /snippet -D - Original Message - From: Vivian, Nigel (N.) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 28, 2003 7:04 AM Subject: tags within tags i18n Hi all Im trying to i18n an application and am using the standard bean:message key=myKey/ tag. Everything works OK but i want to write something like html:link title=bean:message key='myKey'/...forward= ... / and this just put in the quoted string without any substitution (ive tried a few variants on the quotation marks but often get messages about the bean not being found) I ve tried bean:define name=MessageResources id=myVar property=myKey type=java.lang.String.../ and then html:link title=%=myVar%...forward= ... / but all I get is an exception saying that the MessageResources bean cannot be found in any scope and bean:define id=myVar type java.lang.String bean:message key=myKey/ /bean:define now I get hashmap is null (essentially) So can anyone think of a method that works using any of these methods or something else or do I have to resort to getting the MessageResources bundle myself in scriptlet? Oh and if I do that *how* do I do that? I'm using iPlanet 6.0 service pack 1 jdk 1.2.2 struts 1.0.2 I may be able to change to struts 1.1 but its not known yet. I cannot change the server - I think that means that I cant use struts-el whatever that is because of the Sevlet specification level. Nigel Vivian - 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]
Re: Actions based on Role
http://securityfilter.sourceforge.net/ click on File item on the top right cornor. -Dan - Original Message - From: Mike Duffy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 8:55 PM Subject: Re: Actions based on Role Mark, Do you have experience with security filter? Have you examined the source code? I went to SourceForge to get the download. There was a JAR but no source except for a limited implementation class. I would not want to implement a security filter without seeing the source. Can anyone tell me where to find the source? Mike --- Mark Zeltser [EMAIL PROTECTED] wrote: Siva, Take a look at authentication provided by web container. One of the reasons to use your own authentication is to make it deployable on any container. However, you can use securityfilter to make this transparent. Suggestion: search the archives on security/securityfilter. Spend some time understanding provided authentication mechanism. Usually, there is no need to reinvent the wheel. Mark. Jagadeesan,Sivakumar wrote: Mark: It is a very simple system. The user logs into the system. The user role is based on the what kind of membership that user is in. So the role for a user will keep changing. So the only place I thought I could map the user to role is in database. So it will be pure business logic rather then something I do in deployment time. If I am wrong in my approach pls let me know how I could do this thanx --Siva Jagadeesan -Original Message- From: Mark Zeltser [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 5:02 PM To: Struts Users Mailing List Subject: Re: Actions based on Role Why do you want to have your own authentication system? Mark. Jagadeesan,Sivakumar wrote: I guess I have to do that way So I have manually chk every time whether that user is authorized to access this Action, rather then having it in struts-config.xml which is more configurable -Original Message- From: Edgar Dollin [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 4:55 PM To: 'Struts Users Mailing List' Subject: RE: Actions based on Role If you use a filter, to filter actions based on role, the action wouldn't have to know about security. If your authentication sticks the user information into the session, the action could make decisions based on the user information. Edgar -Original Message- From: Jagadeesan,Sivakumar [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:50 PM To: 'Struts Users Mailing List' Subject: Actions based on Role I have web application where users could of three types (Roles) 1) Basic User 2) Silver User 3) Gold User According to Type / Role of user some actions could be performed or not performed. I could set in my stuts-config.xml, the role based access in Action Element I am having my own authentication System that uses the database . The User table has the userName and also the Role. I am not sure how could I create a Role that the Action is expecting , if I am using my own authentication Thanx --Siva Jagadeesan - 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] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - 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] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
Re: Scope and Action objects (struts 1.1)
You need to put the count var in your actionForm, and increment it in your action class. But if you put the actionform in request, the increment has no effect. The action instance itself is cached by struts. -D - Original Message - From: Chai Ang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 7:40 PM Subject: Scope and Action objects (struts 1.1) Hi there all, I looked through the numerous queries in the archives but couldnt find anything that answered my question. If I have an action class, with a class member count eg public class QueryAction extends Action { private int count = 0; etc... } and in the execute() function I increment count by 1; in my struts-config.xml action path=/query parameter=/WEB-INF/jsp/myform.jsp type=web.QueryAction scope=request validate=false name=queryForm forward name=success path=/WEB-INF/jsp/myform.jsp/ forward name=failure path=/WEB-INF/jsp/myform.jsp/ /action On requests to http://localhost:8080/query, on printing out count in the execute() function in the Action, I get the value 0 and 1, 2, 3 etc.. on subsequent request. I thought by having scope=request the value of count would be 0? Is this right? Would there be some other source code location where one needs specify the scope? My jsp form header looks like this html:form action=query etc.. /html:form I noticed the scope attribute had been deprecated in the API. Thanks in advance, Chai ## Attention: The information in this electronic mail is privileged and confidential, intended only for use of the individual or entity named. If you are not the intended recipient, any dissemination, copying or use of the information is strictly prohibited. If you have received this transmission in error, please delete it immediately from your system and inform us via mailto [EMAIL PROTECTED] This e-mail has been scanned and cleared by MailMarshal ## - 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]
Re: validate= true destroys form defaults
This is my be a long shot, but I encountered it before. Makesure to make all your actions to have the same scope In this case: request. Do not leave it blank. ]-D - Original Message - From: Carsten Hammer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 12:01 PM Subject: validate= true destroys form defaults Hi, I use a dispatchaction to set actionform parameters using the actionform setter methods (I do not write it to the session!). The flow is this way: 1. Url: http://localhost:8080/mydispatchaction.do?method=view ;here the information is pulled from the database and put to the actionformbean using its setter methods. 2. This mydispatchaction.do forwards to the jsp. There the information from the database is presented and can be changed and submitted again to the mydispatchaction.do?method=save This all works as expected. Unfortunatly as soon as I switch on the validate switch in the struts config (1.1x) the information that was written to the actionformbean seems to get lost and the jsp presents empty html:text fields. It seems like using the validate=true switch makes the actionformbean to be instantiated again. I can see the reset method is called between the setting of the formbean parameters and the viewing of the jsp because all parameters get the values set in the reset method if set there when using validate=true. All former settings get lost then of course. I do not understand why this is the case. How should the validate switch be used then? Or do I have to write the information that I want to present in a jsp using a actionform always into the session? I thought it should be possible to write it to the actionform inside of the dispatchaction if it is possible to read it from the actionform in the dispatchaction. Can anybody explain to me the best practice is in this case? How does the lifecycle look like of an actionform (for request scope settings in the struts config)? Best regards, Carsten Hammer - 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]
Re: take over an existing HttpSession
Just an idea!! Store all your sessions's reference in the servelt context and when a new session is create, check against the session list in the servelt context, copy over data from old session to new session, and destroy the old session Then You have to deal with all kind of multithreaded and usibility issues. Sound scary ;-) Good luck - Original Message - From: Dmitri Ilyin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 24, 2003 5:59 AM Subject: Re: take over an existing HttpSession Stephen Smithstone [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Use the servlet context to store the details in instead of the session context and the label it via a the users username or something Thank you Stephen, that's Ok but i also have to invalidate an old session, so the user can only have one session at time. On Monday 24 March 2003 12:40 pm, Dmitri Ilyin wrote: Hi, i'm may be out of topic. But i think there are a lot of gurus here they could help me. I have to implement one feature in my application for that there is may be already a solution here. Szenario: A user logged on in application. He dose some work, dosn't logged out and goes to another workstation. In new workstation he logged in application again with the same userID. The user must get in the application an exactly the same place and have the same data from his last workstation and his last session must be invalidated. So the user must take over his last session. any ideas?? thanks for any advise regards Dmitri - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: take over an existing HttpSession
With this design idea, I am sure you will need to place a collection to store all active sessions. Vector collection type will to do job to protect multi threaded situation. You will need a SessionListener to remove the expired session from servlet context. You will need to know what to copy from old session to new session. This is the hardest one I beleive since struts do lots of this stuff behind the scene, you may need to know struts code to do this work. Are you sure you want to do this? sound like a mantainent nightmare for me ;-) -D - Original Message - From: Dmitri Ilyin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 24, 2003 9:23 AM Subject: Re: take over an existing HttpSession Thank you Dan. I will try it this way. I don't see any problem with multithreading here. I will not change the old session i will invalidate it. What do you think?? Dan Tran [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Just an idea!! Store all your sessions's reference in the servelt context and when a new session is create, check against the session list in the servelt context, copy over data from old session to new session, and destroy the old session Then You have to deal with all kind of multithreaded and usibility issues. Sound scary ;-) Good luck - Original Message - From: Dmitri Ilyin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 24, 2003 5:59 AM Subject: Re: take over an existing HttpSession Stephen Smithstone [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Use the servlet context to store the details in instead of the session context and the label it via a the users username or something Thank you Stephen, that's Ok but i also have to invalidate an old session, so the user can only have one session at time. On Monday 24 March 2003 12:40 pm, Dmitri Ilyin wrote: Hi, i'm may be out of topic. But i think there are a lot of gurus here they could help me. I have to implement one feature in my application for that there is may be already a solution here. Szenario: A user logged on in application. He dose some work, dosn't logged out and goes to another workstation. In new workstation he logged in application again with the same userID. The user must get in the application an exactly the same place and have the same data from his last workstation and his last session must be invalidated. So the user must take over his last session. any ideas?? thanks for any advise regards Dmitri - 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] - 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]
Re: case study with security
In your case, you can make administrator is a 'user' itself so that /EditAccount.do works for both roles. However, I strongly suspect your action/view you have to do lots of if else block to determine what to do and what to display. Encapsulation is the key here, I would provide 2 separate actions, one for the normal current login user and one for administrator to edit any user account. -Dan - Original Message - From: Dan Allen [EMAIL PROTECTED] To: Struts-User List [EMAIL PROTECTED] Sent: Sunday, March 23, 2003 11:03 AM Subject: case study with security There have been several discussions on this list about how security should be loosely coupled with the ActionServlet itself (a filter on top of the application), but I am curious to know the best practicing for handling the following type of case. Assume I have an action with a path of /EditAccount. Naturally if a user is not logged in, this path should be protected via filtering. However, /EditAccount has two purposes, one for the regular user to edit his/her own account, but also for the administrator to edit any user account via the query string ?user=username. In this case, I have to check in the action class if the user is allowed to take on the role of another user in which case the form is populated with that user's data or, if not, the form should populate with the user's own data. Is this something that is reasonable to do in the action, or should I create another action path /EditUserAccount?user=username and filter that to only admins and then forward to the /EditAccount once the proper credientials have been established, hence relieving the action behind /EditAccount from looking at any roles? Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, [EMAIL PROTECTED] http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you are going to play the game of trial and error, don't be surprised when the results are revealing. -- me - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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]
Re: case study with security
BTW,the current login user can only change his/her own login/acount profile -D - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, March 23, 2003 11:16 AM Subject: Re: case study with security In your case, you can make administrator is a 'user' itself so that /EditAccount.do works for both roles. However, I strongly suspect your action/view you have to do lots of if else block to determine what to do and what to display. Encapsulation is the key here, I would provide 2 separate actions, one for the normal current login user and one for administrator to edit any user account. -Dan - Original Message - From: Dan Allen [EMAIL PROTECTED] To: Struts-User List [EMAIL PROTECTED] Sent: Sunday, March 23, 2003 11:03 AM Subject: case study with security There have been several discussions on this list about how security should be loosely coupled with the ActionServlet itself (a filter on top of the application), but I am curious to know the best practicing for handling the following type of case. Assume I have an action with a path of /EditAccount. Naturally if a user is not logged in, this path should be protected via filtering. However, /EditAccount has two purposes, one for the regular user to edit his/her own account, but also for the administrator to edit any user account via the query string ?user=username. In this case, I have to check in the action class if the user is allowed to take on the role of another user in which case the form is populated with that user's data or, if not, the form should populate with the user's own data. Is this something that is reasonable to do in the action, or should I create another action path /EditUserAccount?user=username and filter that to only admins and then forward to the /EditAccount once the proper credientials have been established, hence relieving the action behind /EditAccount from looking at any roles? Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, [EMAIL PROTECTED] http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you are going to play the game of trial and error, don't be surprised when the results are revealing. -- me - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation - Require One of Multiple Fields
http://jakarta.apache.org/struts/userGuide/dev_validator.html may help. Look for twofield example. -D - Original Message - From: Joey Ebright [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 20, 2003 10:54 PM Subject: Validation - Require One of Multiple Fields Hello, I am looking for a way to validate that the user filled in at least one field of a possible many fields. These fields represent search criteria to use for constructing an SQL query to a database and I want to ensure the user gives me at least one item to search on... I looked at the requiredif validator but it is only server-side and I want both client side and server side validation. If I just wanted server side I could have written the validation code in my ActionForm myself... I did come up with some rudimentary JavaScript to do this but am lost at how to do this in the same manner in a generic fashion on the server side. The elegant approach of the validator framework on the client side is that it passes an array of fields that are to be validated and the validate method is only called once. This allowed me in my JavaScript to just see if the addition of all the fields put together equaled an empty string. On the server side, the framework differs in its approach to validation of fields and each field to be validated calls the validating method once. Hence without reworking the validator framework, the same approach cannot be used - unless of course I am mistaken. Anyone else got some ideas out there??? TIA, Joey - 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]
Re: design concern
According to Struts, every thing should go to action. It is a good habit consistent with MVC2 frameword/pattern. -Dan - Original Message - From: santhosh [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Saturday, March 15, 2003 5:01 AM Subject: design concern Hello Everybody, I have one design concern. In our project we have ejb's. Now in some modules i have only the some sql quries to be executed based on the user search condition. here where should i prepare the sql queries. should i create in Action class or session bean. waiting for the reply. Thanx with regds santhosh hegde A - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design concern
oops, I misread the question. Please see the answers from both David and Dan Alen - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 15, 2003 4:47 PM Subject: Re: design concern According to Struts, every thing should go to action. It is a good habit consistent with MVC2 frameword/pattern. -Dan - Original Message - From: santhosh [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Saturday, March 15, 2003 5:01 AM Subject: design concern Hello Everybody, I have one design concern. In our project we have ejb's. Now in some modules i have only the some sql quries to be executed based on the user search condition. here where should i prepare the sql queries. should i create in Action class or session bean. waiting for the reply. Thanx with regds santhosh hegde A - 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]
Conditional Displaying form properties - Seek Advice
Hi I would like to display/disable a set of form's properties base on another properties in the form. some thing like this html-el:form table if ( theForm.aProperty) { tr td html-el:text property=myprob / /td /tr } /table /html-el:form Advice is greatly appricated. -Dan
Re: Conditional Displaying form properties - Seek Advice
Hi David here is the code, but i dont know how to set up the properties for c:if c:if test=${action == 'add'} do something /c:if where action is one of the properties of my form. what is corrector the setup the test variable in my snippet code? Thanks ahead -Dan - Original Message - From: David Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 2:27 PM Subject: Re: Conditional Displaying form properties - Seek Advice You can use the c:if JSTL tag to perform conditional logic. David From: Dan Tran [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Conditional Displaying form properties - Seek Advice Date: Wed, 12 Mar 2003 14:25:43 -0800 Hi I would like to display/disable a set of form's properties base on another properties in the form. some thing like this html-el:form table if ( theForm.aProperty) { tr td html-el:text property=myprob / /td /tr } /table /html-el:form Advice is greatly appricated. -Dan _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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]
Re: Conditional Displaying form properties - Seek Advice
Thank you to both David and Rick, I replace myForm to the form name in my strut config file. Then I recieve the following exception org.apache.jasper.JasperException: An error occurred while evaluating custom action attribute value with value ${loginUserForm.action == 'delete'}: Unable to find a value for action in object of class org.apache.struts.validator.DynaValidatorForm using operator . Then I replace ${loginUserForm.action == 'delete'} for ${loginUserForm[action ]== 'delete'} since my form is a DynaForm however, I dont think ${loginUserForm[action] contains the intended value. am I using the correct syntax? Again, thank you for all advices -Dan - Original Message - From: David Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 2:49 PM Subject: Re: Conditional Displaying form properties - Seek Advice Struts puts your form bean in the request or session scope so you can access it just like any other bean: c:if test=${myForm.action == 'add'} myForm is the name you gave your form in struts-config.xml David From: Dan Tran [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Conditional Displaying form properties - Seek Advice Date: Wed, 12 Mar 2003 14:34:49 -0800 Hi David here is the code, but i dont know how to set up the properties for c:if c:if test=${action == 'add'} do something /c:if where action is one of the properties of my form. what is corrector the setup the test variable in my snippet code? Thanks ahead -Dan - Original Message - From: David Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 2:27 PM Subject: Re: Conditional Displaying form properties - Seek Advice You can use the c:if JSTL tag to perform conditional logic. David From: Dan Tran [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Conditional Displaying form properties - Seek Advice Date: Wed, 12 Mar 2003 14:25:43 -0800 Hi I would like to display/disable a set of form's properties base on another properties in the form. some thing like this html-el:form table if ( theForm.aProperty) { tr td html-el:text property=myprob / /td /tr } /table /html-el:form Advice is greatly appricated. -Dan _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - 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]
Re: Conditional Displaying form properties - Seek Advice - Solved
The actual syntax for DynaForm is myForm.map.mypropertiy Thank you for everything -Dan - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 3:14 PM Subject: Re: Conditional Displaying form properties - Seek Advice Thank you to both David and Rick, I replace myForm to the form name in my strut config file. Then I recieve the following exception org.apache.jasper.JasperException: An error occurred while evaluating custom action attribute value with value ${loginUserForm.action == 'delete'}: Unable to find a value for action in object of class org.apache.struts.validator.DynaValidatorForm using operator . Then I replace ${loginUserForm.action == 'delete'} for ${loginUserForm[action ]== 'delete'} since my form is a DynaForm however, I dont think ${loginUserForm[action] contains the intended value. am I using the correct syntax? Again, thank you for all advices -Dan - Original Message - From: David Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 2:49 PM Subject: Re: Conditional Displaying form properties - Seek Advice Struts puts your form bean in the request or session scope so you can access it just like any other bean: c:if test=${myForm.action == 'add'} myForm is the name you gave your form in struts-config.xml David From: Dan Tran [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Conditional Displaying form properties - Seek Advice Date: Wed, 12 Mar 2003 14:34:49 -0800 Hi David here is the code, but i dont know how to set up the properties for c:if c:if test=${action == 'add'} do something /c:if where action is one of the properties of my form. what is corrector the setup the test variable in my snippet code? Thanks ahead -Dan - Original Message - From: David Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 2:27 PM Subject: Re: Conditional Displaying form properties - Seek Advice You can use the c:if JSTL tag to perform conditional logic. David From: Dan Tran [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Conditional Displaying form properties - Seek Advice Date: Wed, 12 Mar 2003 14:25:43 -0800 Hi I would like to display/disable a set of form's properties base on another properties in the form. some thing like this html-el:form table if ( theForm.aProperty) { tr td html-el:text property=myprob / /td /tr } /table /html-el:form Advice is greatly appricated. -Dan _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Advice on File Uplaod
I have the same problem but unable to find solution yet, except to validate as much as I can in the browser side so that I can retain the file field. -Dan - Original Message - From: John Brayton [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 5:48 PM Subject: Advice on File Uplaod I am somewhat of a Struts newbie, and I could use some advice on implementing a component of an application. I have a form that allows a user to upload a file, along with associated meta-data. If the form's validate() method returns ActionErrors, the form will keep the originally entered fields as default values so that the user can just fix his or her errors and continue. Is there a facility to do something similar with a file? I don't really want to have the file transmitted back and forth in the case of a form validation error, and there does not seem to be a mechanism in HTML for including an entire file as a default value anyway. But I do not want the user to need to re-select the file from the file system just because one or more of the meta-data fields has a validation error. Any thoughts on how to go about this? Thanks! John - 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]
Re: Accessing DynaActionForm fields within custom tag
Use the combination of JSTL and Struts-el Here is an example, where based on a property in my form, the submit button is displayed differently. The formName is defined in your struts config file Good luck -Dan %@ page contentType=text/html; charset=utf-8 % %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % %@ taglib uri=/WEB-INF/struts-bean-el.tld prefix=bean-el % %@ taglib uri=/WEB-INF/struts-logic-el.tld prefix=logic-el % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % html-el:html locale=true head titleStudent/title META HTTP-EQUIV=Expires CONTENT=-1 META HTTP-EQUIV=Pragma CONTENT=no-cache META HTTP-EQUIV=Cache-Control CONTENT=no-cache LINK REL=STYLESHEET HREF=../site.css TYPE=text/css html-el:base / /head body class=mainframe center html-el:errors / c:set value=${loginUserForm.map.command} var=command/ html-el:form focus=userName action=/dispatch table border=0 align=center html-el:hidden property=command/ tr td align=left bean-el:message key=label.userName / /td td align=left html-el:text property=userName / /td /tr tr td align=left bean-el:message key=label.password / /td td align=left html-el:password property=password readonly=${istrue} / /td /tr tr td align=left/ td align=left c:choose c:when test=${command == 'add'} html-el:submit property=action bean-el:message key=button.user.add/ /html-el:submit /c:when c:when test=${command == 'update'} html-el:submit property=action bean-el:message key=button.user.update/ /html-el:submit /c:when c:when test=${command == 'delete'} html-el:submit property=action bean-el:message key=button.user.delete/ /html-el:submit /c:when /c:choose /td /tr /table /html-el:form - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 5:51 PM Subject: Accessing DynaActionForm fields within custom tag I have a form where the submit button is supposed to say add login or update login depending on if the user in question (based on field fkMember) already exists in the login database. I have tags called HasLogin and HasNoLogin that take an integer parameter, and return whether or not the condition is true. I am using a DynaActionForm to populate the rest of the fields. The DynaActionForm is a session scoped bean called loginForm -- the following code actually works: !-- form tags and all that above -- tdhtml:submit jsp:useBean id=loginForm scope=session class=org.apache.struts.action.DynaActionForm/ app:HasNoLogin idMember=%=new Integer (Integer.parseInt((String)loginForm.get(fkMember)))% bean:message key=button.addlogin/ /app:HasNoLogin app:HasLogin idMember=%=new Integer (Integer.parseInt((String)loginForm.get(fkMember)))% bean:message key=button.updatelogin/ /app:HasLogin /html:submit/td !-- rest of page below -- The syntax above offends my sensibilities. First, I ought to be able to refer to the bean in question without using a jsp:useBean I think; it's obviously available to the rest of the form, if the form works (and it does). Seconds, casting the get() as a String and doing a parseInt to it to create a new Integer is silly. Isn't there a more elegant way to do this? Ian - 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]
Re: Accessing bean in JSP but w/in java
your actionForm should be already placed in your session or request object based on yours strut config file. To access the a field in the field your can accessit using yourFormName.yourFieldName if you are using regular java bean or yourFormName.map.yourFieldName if you are using DynaForm type class See my last few post to see how I access it using JSTL which is really cool and clean Good Luck -Dan - Original Message - From: Scott Seong [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 6:21 PM Subject: Accessing bean in JSP but w/in java Hello, I have a little problem that I need help from experienced users. I'm trying to access actionForm value in the JSP inside the java code. Why would I use Java inside the JSP? I needed to derive options values based on the value I received from the ActionForm. For example, ActionForm contains a property, today which will contain a string value -- say 20030312. From this value, I need to generate 5 additional business days to be provided in the options pick list. In order to generate additional values, I need to assign a reference to a variable. So, how do I gain access to the actionForm in the JSP? Thanks, Scott - 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]
Re: Accessing DynaActionForm fields within custom tag
try this % org.apache.struts.action.DynaActionForm form = (org.apache.struts.action.DynaActionForm) request.getSession().getAttribute(yourFormName); % to see if this works But for long term, I suggest to looking into JSTL it will make all your code much much cleaner Sorry, cant help to advocate -Dan - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 6:26 PM Subject: Re: Accessing DynaActionForm fields within custom tag Looks neat, but I'd rather have two lines of kludgy code than have to add two additional libraries to the application. It's pretty basic so far, so it's probably not worth adding that layer of complexity for this one thing. Seems like I ought to be able to do this: app:HasLogin idMember=%=loginForm.get(fkMember)% dfdfdf /app:HasLogin but it claims not to know what loginForm is. Argh. - Original Message - From: Dan Tran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 9:17 PM Subject: Re: Accessing DynaActionForm fields within custom tag Use the combination of JSTL and Struts-el Here is an example, where based on a property in my form, the submit button is displayed differently. The formName is defined in your struts config file Good luck -Dan %@ page contentType=text/html; charset=utf-8 % %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % %@ taglib uri=/WEB-INF/struts-bean-el.tld prefix=bean-el % %@ taglib uri=/WEB-INF/struts-logic-el.tld prefix=logic-el % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % html-el:html locale=true head titleStudent/title META HTTP-EQUIV=Expires CONTENT=-1 META HTTP-EQUIV=Pragma CONTENT=no-cache META HTTP-EQUIV=Cache-Control CONTENT=no-cache LINK REL=STYLESHEET HREF=../site.css TYPE=text/css html-el:base / /head body class=mainframe center html-el:errors / c:set value=${loginUserForm.map.command} var=command/ html-el:form focus=userName action=/dispatch table border=0 align=center html-el:hidden property=command/ tr td align=left bean-el:message key=label.userName / /td td align=left html-el:text property=userName / /td /tr tr td align=left bean-el:message key=label.password / /td td align=left html-el:password property=password readonly=${istrue} / /td /tr tr td align=left/ td align=left c:choose c:when test=${command == 'add'} html-el:submit property=action bean-el:message key=button.user.add/ /html-el:submit /c:when c:when test=${command == 'update'} html-el:submit property=action bean-el:message key=button.user.update/ /html-el:submit /c:when c:when test=${command == 'delete'} html-el:submit property=action bean-el:message key=button.user.delete/ /html-el:submit /c:when /c:choose /td /tr /table /html-el:form - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 5:51 PM Subject: Accessing DynaActionForm fields within custom tag I have a form where the submit button is supposed to say add login or update login depending on if the user in question (based on field fkMember) already exists in the login database. I have tags called HasLogin and HasNoLogin that take an integer parameter, and return whether or not the condition is true. I am using a DynaActionForm to populate the rest of the fields. The DynaActionForm is a session scoped bean called loginForm -- the following code actually works: !-- form tags and all that above -- tdhtml:submit jsp:useBean id=loginForm scope=session class=org.apache.struts.action.DynaActionForm/ app:HasNoLogin idMember=%=new Integer (Integer.parseInt((String)loginForm.get(fkMember)))% bean:message key=button.addlogin/ /app:HasNoLogin app:HasLogin idMember=%=new Integer (Integer.parseInt((String)loginForm.get(fkMember)))% bean:message key=button.updatelogin/ /app:HasLogin /html:submit/td !-- rest of page below -- The syntax above offends my sensibilities. First, I ought to be able to refer to the bean in question without using a jsp:useBean I think; it's obviously available to the rest of the form, if the form works (and it does). Seconds, casting the get() as a String and doing a parseInt to it to create a new Integer is silly. Isn't there a more elegant way to do this? Ian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Advice on File Uplaod
Agree. The reason why there is no way to retain the file name after server side validation fail, is security. Imagine this, the server side can make the File field hidden and automatically submit the form so that it retrieve a file on your browser computer. -Dan - Original Message - From: Brandon Goodin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 7:42 PM Subject: RE: Advice on File Uplaod Validate with javascript before the submit. That is the only way. There is no means to pass the file reference back to the page. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 7:09 PM To: Struts Users Mailing List Subject: Re: Advice on File Uplaod I have the same problem but unable to find solution yet, except to validate as much as I can in the browser side so that I can retain the file field. -Dan - Original Message - From: John Brayton [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 5:48 PM Subject: Advice on File Uplaod I am somewhat of a Struts newbie, and I could use some advice on implementing a component of an application. I have a form that allows a user to upload a file, along with associated meta-data. If the form's validate() method returns ActionErrors, the form will keep the originally entered fields as default values so that the user can just fix his or her errors and continue. Is there a facility to do something similar with a file? I don't really want to have the file transmitted back and forth in the case of a form validation error, and there does not seem to be a mechanism in HTML for including an entire file as a default value anyway. But I do not want the user to need to re-select the file from the file system just because one or more of the meta-data fields has a validation error. Any thoughts on how to go about this? Thanks! John - 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] - 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]