Re: concurrency issue in v. 1.0.2
On 10/11/07, Dmitry Beransky [EMAIL PROTECTED] wrote: Hi, We are still using an old version of Struts (1.0.2) and at this point upgrading to a newer version would require a really compelling reason, which I might have found. While investigating reasons behind slowness of our website under a heavy load, I stumbled upon a very heavy contention issue with PropertyDescriptor.getReadMethod(). Profiling with YourKit showed that all Tomcats threads block each other while in that method at a rate close to 50%. Backtracing revealed that calls to getReadMethod() are done via commons-beanutil (we are using v. 1.6) from Struts' own OptionsTag.doEndTag(). AFAIK Struts 1.0.2 was before Commons BeanUtils (Struts utility classes were factored out to become Commons BeanUtils) - but my understanding is that Struts only used Commoms BeanUtils from 1.1 onwards - up till then they (e.g. PropertyUtils) were internal to Struts. Anyway, thats a bit of a moot point since both the old internal Struts PropertyUtils and current Commons BeanUtils's PropertyUtils both still use PropertyDescriptor.getReadMethod() - so it doesn't seem like upgrading from Struts 1.0.2 to later Struts BeanUtils would make any difference. Since where you say you have an issue though is in java's PropertyDescriptor.getReadMethod() then perhaps upgrading the JDK might make a difference? Would be interesting to know which JDK version (and Tomcat version) you're using Niall Can anyone tell me if this issue has been addressed and fixed in more recent releases of Struts? Thanks Dmitry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DispatchAction and execute Method
On 10/11/07, Mariano Rico [EMAIL PROTECTED] wrote: Hi, I have an action class extending the DispatchAction class to get different methods executed. My question is if the execute() method of DispatchAction is being executed before my own methods in my action class. Yes and its the DispatchAction's execute method which actually calls your methods Niall Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s1][ANNOUNCE] Commons BeanUtils 1.8.0 Beta release
The Commons team is pleased to announce the release of Commons BeanUtils 1.8.0 Beta. Commons BeanUtils provides easy-to-use wrappers around the Reflection and Introspection APIs provided by the Java language. BeanUtils 1.8.0 Beta is binary compatible with version 1.7.0 and contains quite a few bug fixes and enhancements. Since it has been nearly three years since the last BeanUtils release, it is hoped that this Beta release will facilitate wider testing to ensure that there are no major compatibility issues before the final 1.8.0 release. Commons BeanUtils Website: http://commons.apache.org/beanutils/ Release notes: http://commons.apache.org/beanutils/v1.8.0-BETA/RELEASE-NOTES.txt Download: http://commons.apache.org/downloads/download_beanutils.cgi Niall Pemberton, on behalf of the Commons community - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1]minipulate output of bean:write
On 8/2/07, Alexander Jede [EMAIL PROTECTED] wrote: Hallo list, I have an ActionForm with an attribute (String) to print the value of this attribute I use bean:write name=myBean property=myAttr/. The problem is the String could have small and capital letters but I would like to print it always the same. For example always with capital letters. Exists a way to do this with struts or have I to write my own Tag to do this? Nothing in Struts, but Jakarta taglibs already has such tags: http://jakarta.apache.org/taglibs/doc/string-doc/intro.html Niall Thanks Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] access values of a Map
On 8/1/07, Alexander Jede [EMAIL PROTECTED] wrote: Hallo, me bean has a Map attribute. Now I want to get access to the values of the Map. But I do not want iterate throw the entire Map. In Java I would write something like: map.get(key) What is the best way to do this in my JSP with struts 1.3.8 ? If you have a mapped property called foo and you want to access the bar key value - then you can use either c:out JSTL tag or Struts's bean:write: c:out value='${foo.bar}'/ bean:write property=foo(bar)/ The following might work (can't remember if it does in BeanUtils 1.7.0 - but it will in the upcoming BeanUtils 1.8.0) bean:write property=foo.bar/ Niall Thanks Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [1.3.8] input autocomplete=off
On 7/11/07, Tomas KRAMAR [EMAIL PROTECTED] wrote: This seems like exactly what I need, but I just can't figure out how to use it. My search in google showed nothing. I was hoping to find some configuration file inside struts-taglib.jar, but nothing too. Could you point me to the right direction? There is nothing else - you have to create your own custom tag implementation(s) (with tlds) with the code for any your new attributes - it just provides a method that implementations can override at an appropriate point so that all you need are the getters/setters for your new attribute(s) and the logic to render the attribute in that method. Niall 2007/7/10, Niall Pemberton [EMAIL PROTECTED]: On 7/10/07, Tomas KRAMAR [EMAIL PROTECTED] wrote: Hi folks, I need to turn off the autocompletion feature on a html text input. I am using my own ajax autocompletion, but the default autocompletion interferes with mine. I have read, that struts taglib does not support this, as it is not part of HTML specification. It it is a worthwhile trade for me, because my autocompletion is now unusable. I have read that struts provides some hooks to change the default behaviour, but couldnt' find something more specific. I dont feel like modifying struts tlds and taglibs. Can you guys give me some hint how to add autocomplete=off support? It seems to me like a common request, and I dont't want to reinvent the wheel. The hooks are methods in the tags where custom attributes can be added - which is the only mechanism provided: http://tinyurl.com/3ydoop Niall Thanks in advance. -- Tomas Kramar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [1.3.8] input autocomplete=off
On 7/10/07, Tomas KRAMAR [EMAIL PROTECTED] wrote: Hi folks, I need to turn off the autocompletion feature on a html text input. I am using my own ajax autocompletion, but the default autocompletion interferes with mine. I have read, that struts taglib does not support this, as it is not part of HTML specification. It it is a worthwhile trade for me, because my autocompletion is now unusable. I have read that struts provides some hooks to change the default behaviour, but couldnt' find something more specific. I dont feel like modifying struts tlds and taglibs. Can you guys give me some hint how to add autocomplete=off support? It seems to me like a common request, and I dont't want to reinvent the wheel. The hooks are methods in the tags where custom attributes can be added - which is the only mechanism provided: http://tinyurl.com/3ydoop Niall Thanks in advance. -- Tomas Kramar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: action class does not perfom
On 7/5/07, Nhut Thai Le [EMAIL PROTECTED] wrote: Hi, I have configured my app as follow: $CATALINA_HOME/conf/server.xml Host name=localhost appBase=webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false Context path=/Core1 docBase=Core1 debug=5 reloadable=true crossContext=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=iam password=mypass driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/mydb?autoReconnect=true/ /Context /host This tells the servlet container that the Core1 application has a connection pool ready to be used Then in the WEB-INF/web.xml i have: listener listener-class com.core.listener.ResourceManagerListener /listener-class /listener servlet servlet-nameaction/servlet-name servlet-class org.apache.struts.action.ActionServlet /servlet-class init-param param-nameconfig/param-name param-value /WEB-INF/struts-config.xml /param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namedetail/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping session-config session-timeout 30 /session-timeout /session-config welcome-file-list welcome-file index.jsp /welcome-file /welcome-file-list error-page exception-typeException/exception-type location/WEB-INF/error/error.jsp/location /error-page resource-ref descriptionDB connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref The above tell the servlet container that the appication Core1 uses struts framework which handle all requests ended with .do. Finally, the struts-config.xml: global-forwards forward name=main path=/index.jsp/ forward name=login path=/authentication/login.jsp/ forward name=testS path=testStruts.jsp/ /global-forwards action-mappings !-- action path=/Welcome forward=/welcomeStruts.jsp/ -- action path=/testStruts type=com.core.servlet.testStruts/ action path=/authentication type=com.core.servlet.Authentication/ action path=/protected/financial type=com.core.servlet.Financial forward name=/protected/financialDisplay path=/financial/financialDisplay.jsp/ forward name=/protected/financialInput path=/financial/financialInput.jsp/ forward name=/protected/financialManager path=/financial/financialManager.jsp/ forward name=/protected/financialSearch path=/financial/financialSearch.jsp/ /action action path=/protected/financialProcess type=com.core.servlet.FinancialProcessor/ /action-mappings Now, I have a testStruts class which extends Action class as follow: public class testStruts extends Action { public ActionForward perform( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, UserInputException, InternalException { System.out.println(print of this method is invoked); return mapping.findForward(testS); } } and the testStruts.jsp is just a normal jsp file in WEB-INF folder. If its in the WEB-INF folder then it should be: forward name=testS path=/WEB-INF/testStruts.jsp/ Niall When I try to access testStruts.do (the controler) from my browser: http://localhost:8084/Core1/testStruts.do i though the testStruts.jsp will be displayed but there is nothing happen. I got a blank page. The testStruts class doesnt seem to be invoked anyway because nothing is print out in the console. Does anyone know why? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Issues with migration from struts 1.1. to 1.2.9
On 6/30/07, pavan reddy [EMAIL PROTECTED] wrote: Thanks Wendy But I followed the struts upgrade steps The problem here is with tiles plugin this my code in struts-config.xml plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=definitions-debug value=0 / set-property property=definitions-parser-details value=0 / set-property property=definitions-parser-validate value=true / //even tried making this attribute false /plug-in and in tiles-def.xml the doc type is !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration//EN http://struts.apache.org/dtds/tiles-config_1_1.dtd; // tried just giving tiles-config_1_1.dtd it throws parser exception or tries to serach for .dtd in some other location and says not found The dtd def at the top of your tiles-def.xml is wrong - you have specified the Tiles 1.0 public identifier - with the URL for the Tiles 1.1 dtd - try the following: !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration 1.1//EN http://struts.apache.org/dtds/tiles-config_1_1.dtd; Niall error org.apache.struts.tiles.DefinitionsFactoryException: IO Error while parsing file '/WEB-INF/tiles-defs.xml'. struts.apache.org at org.apache.struts.tiles.xmlDefinition.I18nFactorySet.parseXmlFile(I18nFactorySet.java:523) at org.apache.struts.tiles.xmlDefinition.I18nFactorySet.parseXmlFiles(I18nFactorySet.java:446) at org.apache.struts.tiles.xmlDefinition.I18nFactorySet.createDefaultFactory(I18nFactorySet.java:263) at org.apache.struts.tiles.xmlDefinition.I18nFactorySet.initFactory(I18nFactorySet.java:238) at org.apache.struts.tiles.xmlDefinition.I18nFactorySet.initFactory(I18nFactorySet.java:188) at org.apache.struts.tiles.definition.ComponentDefinitionsFactoryWrapper.init(ComponentDefinitionsFactoryWrapper.java:102) at org.apache.struts.tiles.TilesUtilImpl.createDefinitionsFactory(TilesUtilImpl.java:136) at org.apache.struts.tiles.TilesUtil.createDefinitionsFactory(TilesUtil.java:165) at org.apache.struts.tiles.TilesPlugin.initDefinitionsFactory(TilesPlugin.java:222) at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:137) at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336) at javax.servlet.GenericServlet.init(GenericServlet.java:258) Thanks Pavan - Original Message From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Saturday, 30 June, 2007 9:57:53 AM Subject: Re: Issues with migration from struts 1.1. to 1.2.9 On 6/30/07, pavan reddy [EMAIL PROTECTED] wrote: I have issues with moving from different strtuts version with tiles plugin in tiles-def.xml the doc type seems to raise an xml parse error i tried moving the tiles dtd file to web-inf and pointing it to it but didnt help much, any clues on it thanks in advance Have you reviewed the community maintained upgrade notes? http://wiki.apache.org/struts/StrutsUpgrade -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3.8 Error on multiple servers Geronimo 1.1, Tomcat 5.5 and Sun App 8.2
On 6/30/07, Andrew Burger [EMAIL PROTECTED] wrote: I am trying to use Struts 1.3.8 on Geronimo 1.1, Tomcat 5.5 and Sun App 8.2 I am getting the same error. on all 3. I thought at first it was my struts-config.xml but the struts-blank-1.3.8.war is give my the same error. I tried struts-blank-1.3.5.war and don't get the error. I have read http://struts.apache.org/1.x/userGuide/installation.html#Containers and don't see any special instruction for these containers. I would check the verion of Commons Digester you have deployed - Struts 1.3.6 moved to a dependency on Digester 1.8 which introduced a new parse method to resolve an issue: http://struts.apache.org/1.3.8/userGuide/release-notes-1_3_6.html http://issues.apache.org/jira/browse/DIGESTER-29 Niall Here is the error from geronimo log: 12:42:46,656 INFO [ActionServlet] Loading chain catalog from jar:file:/C:/var/apps/geronimo-1.1.1/repository/default/struts-blank-1.3.8/1183221765765/struts-blank-1.3.8-1183221765765.war/WEB-INF/lib/struts-core-1.3.8.jar!/org/apache/struts/chain/chain-config.xml 12:42:47,046 ERROR [ActionServlet] Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency. java.lang.NoSuchMethodError: org.apache.commons.digester.Digester.parse(Ljava/net/URL;)Ljava/lang/Object; at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:740) at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:689) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:356) at javax.servlet.GenericServlet.init(GenericServlet.java:168) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3915) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4176) at org.apache.geronimo.tomcat.GeronimoStandardContext.access$201(GeronimoStandardContext.java:67) at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:337) at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:31) at org.apache.geronimo.tomcat.GeronimoStandardContext.start(GeronimoStandardContext.java:192) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:313) at org.apache.geronimo.tomcat.TomcatContainer$$FastClassByCGLIB$$9370b073.invoke(generated) at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:817) at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57) at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35) at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96) at org.apache.geronimo.tomcat.TomcatContainer$$EnhancerByCGLIB$$dd41618a.addContext(generated) at org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:438) at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:981) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:267) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:540) at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379) at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:374) at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:527) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:508) at
Re: Dynamically rendering image - Servlet/Action
On 7/1/07, Stjepan Brbot [EMAIL PROTECTED] wrote: Hi, I have one classic HttpServlet for dynamically rendering an image from given (database retrieved) data. Actually this servlet takes data from session (previously retrieved from database and put inside session) and renders the image. Since this is not Action but classis servlet it is mapped in web.xml as '/ImageServlet'. When I have in my html/jsp tag like this one 'img src=/ImageServlet', I get wanted image. That's all fine. Now, I'd like to avoid using session for this purpose and like to take data for ImageServlet from request but I see that request data is not forwarded in additional browser's request for image. When I originally request page like 'page.jsp?id=1' this 'id=1' is not forwarded in request for image data 'img src=/ImageServlet' from page.jsp! That's why I use session. Is this only possibility? Can I use 'html:img src=.../' or 'html:img action=...' and expect original page request to be forwarded to image request as well? On the other hand, how to create Struts' Action that could be used for the same purpose of rendering image? In classic HttpServlet there are methods doPost/doGet which do not return any data (void) but Struts' Action expects ActionForward as a return value. What might be the return value in case that this Action is used for rendering image and called inside 'img src=/ImageAction' or 'html:img action=/ImageAction/'? There is just such a DownLoad action designed to help with this - you just need to return null from the Action's execute method, rather than an ActionForward: http://wiki.apache.org/struts/StrutsFileDownload http://struts.apache.org/1.3.8/apidocs/org/apache/struts/actions/DownloadAction.html Niall SB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validwhen returns is required error msg
On 7/2/07, Xavier Vanderstukken [EMAIL PROTECTED] wrote: I have the following validation rule : field property=newPasswordConfirm depends=validwhen arg position=0 key=valid.confirmnewpassword/ var var-nametest/var-name var-value(*this* == newPassword)/var-value /var /field In my ressource file: errors.required={0} is required. errors.invalid={0} is invalid. valid.confirmnewpassword=Confirm new password If I enter two differents values for newPasswordConfirm and newPassword the error message displayed by html:errors tag is : Confirm new password is required instead of Confirm new password is invalid. Am I doing something wrong? By default the validwhen validator uses the key errors.required - if you want to use a different key for the message then you need to specify it for the field using a msg element - something like msg name=validwhen key=errors.invalid/ Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validwhen returns is required error msg
On 7/2/07, Xavier Vanderstukken [EMAIL PROTECTED] wrote: Thanks a lot :) Do you think this required a documentation update because I don't find your information here: http://struts.apache.org/1.3.8/faqs/validator.html On that page it says: he default error message for a pluggable validator can be overriden with the msg element. So instead of using the msg attribute for the mask validator to generate the error message the msg attribute from the field will be used if the name of the field's name attribute matches the validator's name attribute. ..but if you think its not clear enough, then improvments are always welcome :) http://struts.apache.org/helping.html http://svn.apache.org/viewvc/struts/struts1/trunk/src/site/xdoc/faqs/validator.xml Niall 2007/7/2, Niall Pemberton [EMAIL PROTECTED]: On 7/2/07, Xavier Vanderstukken [EMAIL PROTECTED] wrote: I have the following validation rule : field property=newPasswordConfirm depends=validwhen arg position=0 key=valid.confirmnewpassword/ var var-nametest/var-name var-value(*this* == newPassword)/var-value /var /field In my ressource file: errors.required={0} is required. errors.invalid={0} is invalid. valid.confirmnewpassword=Confirm new password If I enter two differents values for newPasswordConfirm and newPassword the error message displayed by html:errors tag is : Confirm new password is required instead of Confirm new password is invalid. Am I doing something wrong? By default the validwhen validator uses the key errors.required - if you want to use a different key for the message then you need to specify it for the field using a msg element - something like msg name=validwhen key=errors.invalid/ Niall - 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: Problems with my struts_config.xml?
On 6/28/07, Søren Blidorf [EMAIL PROTECTED] wrote: I upgraded from STRUTS 1.0 and I also upgraded to tomcat 6.0 from a 4.xx So possibly something might have gone wrong when you upgraded Tomcat. Without any error messages its hard to help though. I would start by trying to get more logging output from both Tomcat when it starts up and your webapp. Going from Struts 1.0 to 1.2 is going to mean you're going to have issues to resolve (some things were deprecated in 1.1 and removed in 1.2.x). We don't have notes for upgrading from 1.0 - but there are reasonable notes for 1.1 -- 1.2 here: http://wiki.apache.org/struts/StrutsUpgrade One thing I noticed is your message resources - for 1.2 these should be configured in the struts-config.xml rather than the web.xml Niall Soren - Original Message - From: Niall Pemberton [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, June 28, 2007 3:31 AM Subject: Re: Problems with my struts_config.xml? On 6/27/07, Søren Blidorf [EMAIL PROTECTED] wrote: Can anybody see if something is wrong with this struts-config.xml. I have just upgraded struts to 1.2.9. And a simple .do call does not work. Nothing happends. I get a blank screen and no errors is reported i the logs Just out of interest what version of Struts were you upgrading from? Also were you just upgrading Struts - or were you changing other things as well (like upgading your servlet container)? Niall *** !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; struts-config !-- Form Bean Definitions -- form-beans type=org.apache.struts.action.ActionFormBean !-- Most of the form-beans has been removed -- form-bean name=SearchForm type=um.forms.sob.SearchForm / /form-beans !-- = Global Exception Definitions -- global-exceptions !-- sample exception handler exception key=expired.password type=app.ExpiredPasswordException path=/changePassword.jsp/ end sample -- /global-exceptions !-- === Global Forward Definitions -- global-forwards type=org.apache.struts.action.ActionForward forward name=success path=index.jsp redirect=true / forward name=error redirect=true path=/error/index.jsp / /global-forwards !-- === Action Mapping Definitions -- action-mappings type=org.apache.struts.action.ActionMapping !-- Admin START -- action path=/admin/addFormBean type=org.apache.struts.actions.AddFormBeanAction / action path=/admin/addForward type=org.apache.struts.actions.AddForwardAction / action path=/admin/addMapping type=org.apache.struts.actions.AddMappingAction / action path=/admin/reload type=org.apache.struts.actions.ReloadAction / action path=/admin/removeFormBean type=org.apache.struts.actions.RemoveFormBeanAction / action path=/admin/removeForward type=org.apache.struts.actions.RemoveForwardAction / action path=/admin/removeMapping type=org.apache.struts.actions.RemoveMappingAction / !-- Admin SLUT -- !-- Most of the mappings has been removed -- action parameter= name=SearchForm path=/sob/search input=/sob/um.jsp validate=true type=um.actions.sob.SearchAction scope=requestforward name=success redirect=false path=/sob/search.jsp /forward name=error redirect=false path=/sob/searchError.jsp //action /action-mappings controller processorClass=org.apache.struts.action.RequestProcessor contentType=text/html/ message-resources parameter=resources.application/ /struts-config *** BR. Soren, DK - 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: Problems with my struts_config.xml?
On 6/27/07, Søren Blidorf [EMAIL PROTECTED] wrote: Can anybody see if something is wrong with this struts-config.xml. I have just upgraded struts to 1.2.9. And a simple .do call does not work. Nothing happends. I get a blank screen and no errors is reported i the logs Just out of interest what version of Struts were you upgrading from? Also were you just upgrading Struts - or were you changing other things as well (like upgading your servlet container)? Niall *** !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; struts-config !-- Form Bean Definitions -- form-beans type=org.apache.struts.action.ActionFormBean !-- Most of the form-beans has been removed -- form-bean name=SearchForm type=um.forms.sob.SearchForm / /form-beans !-- = Global Exception Definitions -- global-exceptions !-- sample exception handler exception key=expired.password type=app.ExpiredPasswordException path=/changePassword.jsp/ end sample -- /global-exceptions !-- === Global Forward Definitions -- global-forwards type=org.apache.struts.action.ActionForward forward name=success path=index.jsp redirect=true / forward name=error redirect=true path=/error/index.jsp / /global-forwards !-- === Action Mapping Definitions -- action-mappings type=org.apache.struts.action.ActionMapping !-- Admin START -- action path=/admin/addFormBean type=org.apache.struts.actions.AddFormBeanAction / action path=/admin/addForward type=org.apache.struts.actions.AddForwardAction / action path=/admin/addMapping type=org.apache.struts.actions.AddMappingAction / action path=/admin/reload type=org.apache.struts.actions.ReloadAction / action path=/admin/removeFormBean type=org.apache.struts.actions.RemoveFormBeanAction / action path=/admin/removeForward type=org.apache.struts.actions.RemoveForwardAction / action path=/admin/removeMapping type=org.apache.struts.actions.RemoveMappingAction / !-- Admin SLUT -- !-- Most of the mappings has been removed -- action parameter= name=SearchForm path=/sob/search input=/sob/um.jsp validate=true type=um.actions.sob.SearchAction scope=requestforward name=success redirect=false path=/sob/search.jsp /forward name=error redirect=false path=/sob/searchError.jsp //action /action-mappings controller processorClass=org.apache.struts.action.RequestProcessor contentType=text/html/ message-resources parameter=resources.application/ /struts-config *** BR. Soren, DK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Subclass LookupDispatchAction
On 6/25/07, Xavier Vanderstukken [EMAIL PROTECTED] wrote: Good morning, I need to subclass the LookupDispatchAction to write a BaseLookupDispatchAction to centralize the UserRole check of my application (etc.). I try the following piece of code : public abstract class BaseLookupAction extends LookupDispatchAction { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try{ //Check des users puis ActionForward succes=super.execute(mapping,form,request,response); return succes; } catch(Exception ex) { ex.printStackTrace(); ActionMessages errors = new ActionMessages(); ActionMessage error = new ActionMessage(error.fatal); errors.add(ActionErrors.GLOBAL_MESSAGE,error); saveErrors(request, errors); return mapping.findForward(error); } The problem with that code is that I can not use my CustomErrorHandler because the signature of the execute method does not throw an exception. I checked LookupDispatchAction and it does declare Exception as being thrown on the execute method - so I don't understand why you're having a problem - what version of Struts are you using? Niall So I must catch it and manually forward to an error page. Is there a better way to do that? } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where are the .tld files ?
On 6/22/07, hicham [EMAIL PROTECTED] wrote: Hello I'm new beginner starting with a struts-blank-1.3.8.war web application, deployed on tomcat 5.5, but I couldn't find the .tld files anywhere. They are shipped in the struts-taglib-1.3.8.jar - so as long as you deploy that jar, then that should be enough http://struts.apache.org/1.x/userGuide/configuration.html#dd_config_taglib_uri Niall thanks for replying hicham - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is the ognl source?
On 6/20/07, David Harland [EMAIL PROTECTED] wrote: Hi, I have been to www.ognl,org and can only find the source for 2.6.9 where are the struts 2 team getting the new releases from as it seems to be a dead site? http://www.opensymphony.com/ognl/ Niall Thanks Dave. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation and XHTML
On 6/20/07, lextest [EMAIL PROTECTED] wrote: Hello, We have a client using Struts 1.2.9. They are experiencing a problem when trying to use client side validation on a struts page that is using html:xhtml. It's the exact problem described in this bug report: http://issues.apache.org/struts/browse/STR-2482 The above link leads me to believe this problem was fixed in 1.2.8. Any idea why we would still be experiencing the problem using 1.2.9? Saying your client is experiencing the same problem doesn't really tell us alot. If they are running Struts 1.2.9 then they should see different markup being rendered for the form (i.e. it should be rendered with an id attribute rather than name) - is that the case? If not it would suggest they are not running Struts 1.2.9. If they do see that then as well as the fixes to Struts - there were also related changes in Commons Validator - I believe in Validator 1.2.0 (but I would recommend the latest Validator 1.3.1 which is compatible with Struts 1.2.9) - so they also need to make sure they have upgraded to that version of validator. Niall Regards. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javax.el.ExpressionFactory
On 6/20/07, cilquirm [EMAIL PROTECTED] wrote: This is most probably not related to Struts. I can't claim to know the intrinsics of your setup but it looks like you're missing some jars need for JSF. It might be that you're running an older version of the J2EE stack. javax.el.ExpressionFactory comes with J2EE 5, and is part of JSF 1.2 This is incorrect - javax.el.ExpressionFactory is part of the new Unified EL that was developed under JSR 245[1] - which is the JSR for JSP 2.1. However the Unified EL - (called that because it aims to unify the expression language implementations used by JSP and JSF) has been released as a separate specification under that JSR and is independant of any servlet technology (i.e. no dependencies on JSP, JSF or any servlet specs). So although its true to say that both JSP 2.1 and JSF 1.2 use the Unified EL (EL 2.1) - it is part of neither. Niall [1] http://jcp.org/en/jsr/detail?id=245 GEDA wrote: Hi. I created an interceptor which extends AbstractInterceptor and implements StrutsStatics. Also I added it in the applicationcontext.xml of the Spring framework. My problem is the following and I don't know where to get the missing class: Jun 20, 2007 2:32:16 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Error configuring application listener of class com.sun.faces.config.GlassFishConfigureListener java.lang.NoClassDefFoundError: javax/el/ExpressionFactory at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.newInstance0(Class.java:326) at java.lang.Class.newInstance(Class.java:308) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3678) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432) Jun 20, 2007 2:32:16 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Skipped installing application listeners due to previous error(s) Jun 20, 2007 2:32:18 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Thank you. -- View this message in context: http://www.nabble.com/javax.el.ExpressionFactory-tf3951985.html#a11217621 Sent from the Struts - User mailing list archive at Nabble.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: Réf. : Re: No Collection Found problem
On 6/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello Niall, Actually I did a mistake when i wrote my email, because i already do what you told me to do, so I still have the same problem: %= TEST % % Collection col = (Collection)request.getSession().getAttribute( cautionVos); % %= col.size() % %= col.isEmpty() % logic:notEmpty name=cautionVOs scope=session tr td align=center colspan=2 table class=result tr td class=header/td td class=headerbDate du paiement/b/ td td class=headerbMode du paiement/b/ td td class=headerbCompte de facturation/ b/td td class=headerbMontant/b/td td class=headerbCommentaire/b/td /tr /table div style=overflow:auto; height:100px; table class=result logic:iterate name=cautionVOs id= remPayVO type=RemPayVO tr tdhtml:radio styleClass= radio name=remPayVO property=paymentId value=%= remPayVO.getPaymentId().toString() % onclick=forward ('prepare','/modifycautionmanagement.do','ModifyCautionForm');waiting(); / /td tdbean:write name=remPayVO property=dateModifStatut //td tdbean:write name=remPayVO property=modePay //td tdbean:write name= ModifyCautionForm property= compteFacturation //td tdbean:write name=remPayVO property=montant //td tdbean:write name=remPayVO property=commentaire //td /tr /logic:iterate /table /div /td /tr /logic:notEmpty I really think that the problem is with the logic:notEmpty tag, because not even my first table is displayed in the JSP. In your original mail you said that you were getting an exception with the message No Collection Found - the not empty tag doesn't throw an exception with that message - but the iterate tag does. And I have an exception if i do % Collection col = (Collection)request.getSession().getAttribute( cautionVos); % Its hard to help without you telling us details of the exception - and preferably stack trace. If I were having the kind of problems you are I would simplify (i.e. remove a load of stuff) my jsp page - start with just the logic:notEmpty - get that working and then start adding back in the rest of the page bit by bit. Niall Does anyone have any idea? Marianne On 6/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I am having some problems with getting a session attribut in my JSP. A have a JSP where the user can make a search based on information he must enter in a form. The result of the search must be displayed in a table. To display the result I do: logic:notEmpty name=cautionVOs scope=session tr td div style=overflow:auto; height:100px; table class=result logic:iterate id=cautionVOs name=remPayVO type =RemPayVO tr tdhtml:radio styleClass=radio name =remPayVO property =paymentId value=%= remPayVO.getPaymentId().toString() % onclick=forward ('prepare','/modifycautionmanagement.do','ModifyCautionForm');waiting(); / /td tdbean:write name=remPayVO property= dateModifStatut //td tdbean:write name=remPayVO property =modePay //td tdbean:write name=ModifyCautionForm property = compteFacturation //td tdbean:write name=remPayVO property =montant //td tdbean:write name=remPayVO property= commentaire //td /tr /logic:iterate /table /div /td /tr /logic:notEmpty The problem is that I get the error javax.servlet.jsp.jspException: No Collection found, and i think i get it with logic:notEmpty name= cautionVOs scope=session Here is a piece of my Action class: * ModifyCautionForm modifyCautionForm = (ModifyCautionForm)form; errors =
Re: No Collection Found problem
On 6/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I am having some problems with getting a session attribut in my JSP. A have a JSP where the user can make a search based on information he must enter in a form. The result of the search must be displayed in a table. To display the result I do: logic:notEmpty name=cautionVOs scope=session tr td div style=overflow:auto; height:100px; table class=result logic:iterate id=cautionVOs name=remPayVO type=RemPayVO tr tdhtml:radio styleClass=radio name=remPayVO property=paymentId value=%= remPayVO.getPaymentId().toString() % onclick=forward ('prepare','/modifycautionmanagement.do','ModifyCautionForm');waiting(); / /td tdbean:write name=remPayVO property= dateModifStatut //td tdbean:write name=remPayVO property=modePay //td tdbean:write name=ModifyCautionForm property= compteFacturation //td tdbean:write name=remPayVO property=montant //td tdbean:write name=remPayVO property= commentaire //td /tr /logic:iterate /table /div /td /tr /logic:notEmpty The problem is that I get the error javax.servlet.jsp.jspException: No Collection found, and i think i get it with logic:notEmpty name= cautionVOs scope=session Here is a piece of my Action class: * ModifyCautionForm modifyCautionForm = (ModifyCautionForm)form; errors = modifyCautionForm.validate(mapping, request); purgeSession(request); RechercheCautionVO rechercheCautionVO = new RechercheCautionVO(); rechercheCautionVO.setCompteFacturation(modifyCautionForm.getCompteFacturation ()); rechercheCautionVO.setPaymentMethod(modifyCautionForm.getModePay()); rechercheCautionVO.setMontant(modifyCautionForm.getMontant()); rechercheCautionVO.setDate(date); rechercheCautionVO.setPaymentID(modifyCautionForm.getPaymentID()); rechercheCautionVO.setBanque(modifyCautionForm.getBanque()); rechercheCautionVO.setAgence(modifyCautionForm.getAgence()); rechercheCautionVO.setCompte(modifyCautionForm.getCompte()); rechercheCautionVO.setNumPiece(modifyCautionForm.getNumPiece()); Collection cautions = null; try { PaymentDelegate payDelegate = new PaymentDelegate(); cautions = payDelegate.getAccountCaution(rechercheCautionVO); log.debug(*** cautions size + cautions.size()); log.debug(*** cautions is empty? + cautions.isEmpty()); request.getSession().setAttribute( SESSION_REMPAYVOS, cautions); Collection col = (Collection)request.getSession ().getAttribute(SESSION_REMPAYVOS); log.debug(*** cautions is empty? + col.isEmpty()); modifyCautionForm.setCautionVOs(cautions); Iterator it = modifyCautionForm.getCautionVOs().iterator(); while(it.hasNext()){ RemPayVO rpVO = (RemPayVO)it.next(); log.debug(paymentID: + rpVO.getPaymentId()); } (SESSION_REMPAYVOS = cautionVOs) When I look at the log I can verify that cautions is not null, and neither is the session attribute. But if i add % Collection col = (Collection)request.getSession().getAttribute( cautionVos); % in my JSP right before logic:notEmpty name=cautionVOs scope=session I get a java.lang.NullPointerException Somewhere between my action class and my jsp the session attribute is set to null. Are you sure that it is the logic:notEmpty that is causing the problem? The reason I'm asking is that your logic:iterate doesn't seem to tie up with what you have in logic:notEmpty and doesn't match what you say your session attribute is. Looks to me like you have the id and name attributes the wrong way round - should be: logic:iterate name=cautionVOs id=remPayVO type=RemPayVO Niall Does anyone have some idea of what is happening?? Thanks in advance!! Marianne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormFile: Catching IllegalArgumentException
On 6/8/07, Eric Jain [EMAIL PROTECTED] wrote: I have a form with a FormFile field, which works great, except that when someone submits a plain string for this field (e.g. a spammer crawling the site and doing random submissions) I get an ugly stack trace logged... I wonder is there a way to catch this? For Struts 1.3.x you could define an exception handler for IllegalArgumentException - although I'm not sure if that would prevent this getting logged or not - but its worth a try. Other than that then the only other thing I can think of is changing the configuration of your logging implementation (or maybe a combination of the two). Niall 2007-06-08 16:04 org.apache.commons.beanutils.PropertyUtils ERROR: Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759) at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648) at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:451) at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:45) at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:57) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) ... - 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 can one servlet (ActionServlet) effect another servlet (AxisServlet)...?
On 6/11/07, Jeff Amiel [EMAIL PROTECTED] wrote: On 6/7/07, Jeff Amiel [EMAIL PROTECTED] wrote: Thanks muchwill continue to investigate. I really appreciate the information and will post back if I get any concrete results Shortly thereafter, while pouring through the tomcat issues repository, I stumbled across this: http://issues.apache.org/bugzilla/show_bug.cgi?id=41772 After reading, I became more convinced that re-used response objects was at the heart of my issue. I searched high-and low through my user code looking for anything that might retain a handle to a response objectfinding nothing obvious. Of course, such a bug could exist in any number of libraries we were usingDWR, DisplayTag, etc. So.I simply changed by startup config to run tomcat with a -Djava.security.manager option (my policy file allowing everything to everybody). And ...voila! No more issue!!!. (And yes...I m sure. During a period of time where we would have had dozens of these events normally, we now have zero) I am torn as to where to vent my displeasure (or even if I should have any displeasure now that my production issue has 'gone away'. ) I notice that in Tomcat 6.0 that there is now an option for how the Reponse and Request objects are recycled (not just when a Security Manager is used). http://mail-archives.apache.org/mod_mbox/tomcat-dev/200611.mbox/[EMAIL PROTECTED] There must be a reason for this. While I'm sure there is some aspect of my code (or the libraries that I am using) that is violating the servlet specs by 'holding onto' the response and accessing it later, I am distraught that Tomcat's default behavior is to permit this. I'm sure very few web applications out there are simple or stand-alone enough to not use a plethora of third party libraries (like jasper reports, jfreechart, displaytag, dwr, etc)...all of which might represent an underlying 'threat' to that recycled response object. I am still a bit concerned that I could not track my specific cause down. If it was something as innocuous as what was seen by the submitter of the issue above, I would not be worried (garbage collection calling flush on a un-closed stream)but My issue could be worse.sending data intended for one response (that is long gone) to a different one... Any advice or thoughts would be appreciated. I guess the question is whether using the security manager is acutally solving the problem or just masking it. If its the latter I would, like you, want to know the cause. I would start by asking on the Tomcat user list to try and understand why it shouldn't happen with re-cycled objects - or what must the application be doing for it to happen. Since it is happening when the Axis servlet is calling setBufferSize() - perhaps also a question to the Axis user list - to see if they can shed some light on it - or if anyone else has hit the same issue. Niall Jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can one servlet (ActionServlet) effect another servlet (AxisServlet)...?
On 6/6/07, Jeff Amiel [EMAIL PROTECTED] wrote: On 6/5/07, Niall Pemberton [EMAIL PROTECTED] wrote: Might be a Tomcat issue - can you be more precise about the version of Tomcat 5.5? from org/apache/catalina/util/ServerInfo.properties server.info=Apache Tomcat/5.5 server.number=5.5.0.0 server.built=Sep 25 2005 10:08:45 Looks like this information isn't reliable since Tomcat 5.5.12 was released on 24 July 2005 http://tinyurl.com/yojvdq The latest Tomcat 5.5 release is 5.5.23 in March 2007. If you really are running a very old version of Tomcat - then upgrading would be a good idea anyway - whether it fixes this bug or not. First step though is to work out what version you're running. Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3.x : Dynavalidatorform : initialize prepopulate ArralyList with data after submisstion
Use a LazyValidatorForm - define an array of User objects for the form in your struts-config and it will automatically populate it for you: form-bean name=myForm type=org.apache.struts.validator.LazyValidatorForm form-property name=users type=sompackage.User[] / /form-bean http://struts.apache.org/1.x/userGuide/building_controller.html#lazy_action_form_classes Niall On 6/6/07, Raghupathy, Gurumoorthy [EMAIL PROTECTED] wrote: Hi, Situation : One DynaValidatorForm has a property of type java.util.ArrayList and size is not known in advance The Arraylist consists of elements of type User which is a simple Javabean and dispayed using struts:text indexed=true Question : How can I get the collection back as an ArrayList prepopulated back when i submit the data back I want to know a solution with the least amount of code ... Please note : I have done google search for this and there does nto seems to be an elegant way of doing this with DynaValidatorForm Please help Regards Guru - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts File Not Found (404) Behavior or Lack of...
On 6/6/07, Nathan Hook [EMAIL PROTECTED] wrote: I've run into a problem. If a user either accidentally or maliciously enters an incorrect path that has a struts extension the user will receive an Exception and a Stack Trace. For example if we have the path www.xxx.com/login.do mapped like so... action path=/login type=com.xxx.actions.LoginAction forward name=success path=/message.do redirect=true / forward name=failure path=/login_error.jsp redirect=true / forward name=new_user path=/new_user.do redirect=true / forward name=user_not_active path=/user_not_active.jsp redirect=true/ /action and the user types in www.xxx.com/login2.do they will receive an Exception with the following Stack Trace... javax.servlet.ServletException: No action config found for the specified url. org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.kf.servlet.CacheControlFilter.doFilter(CacheControlFilter.java:44) com.kf.servlet.TrackingFilter.doFilter(TrackingFilter.java:36) com.kf.servlet.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:34) Root Cause org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url. org.apache.struts.chain.commands.AbstractSelectAction.execute(AbstractSelectAction.java:71) org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.xxx.servlet.CacheControlFilter.doFilter(CacheControlFilter.java:44) com.xxx.servlet.TrackingFilter.doFilter(TrackingFilter.java:36) com.xxx.servlet.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:34) Instead of a user receiving a nice 404 File Not Found message they are displayed an Exception. In my mind making the company look bad. Also, a malicious user now knows our underlying technology, the flow of our application, and specific class names. Is there any configuration settings that we can set to make these exceptions return a 404 page instead of a Exception? Notice that this error fails WAY before any of the global-exceptions are used. Did you try specifying and exception handler for InvalidPathException? While it was true in Struts 1.2.x that the exception handler only dealt with exceptions thrown by the Action - AFAIK Struts 1.3.x exception handling covers the whole request processing chain - so it should work. Also using the standard exception handler you can(from memory) specify a message key - I believe theres an example(s) in the struts-examples webapp for InvalidCancelException (in the validation module) - that does just this. Also as I suggested in the related thread you posted earlier this week you can also specify an unknown action to handle this - just add unknown=true to one (and only 1) of your actions in the struts-config.xml Niall As of right now I'm planning on Extending the org.apache.struts.action.ActionServlet class to check to see if we receive an org.apache.struts.chain.commands.InvalidPathException and if so then show a 404 page, but I'm not excited about extended super basic Struts behavior. Does anyone have any thoughts on this subject and what do you think the behavior or Struts should be in this case? I do like the fail fast aspect of what is happening, but there should be a more elegant way of handling the Exception. Looking forward to any and all response. Thank you for your time. _ Don't miss your chance to WIN $10,000 and other great prizes from Microsoft Office Live http://clk.atdmt.com/MRT/go/aub0540003042mrt/direct/01/ - 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: Handeling org.apache.struts.chain.commands.InvalidPathException
You can either set up an exception handler for InvalidPathException or you can mark one of your actions in the struts-config.xml as unknown. Niall On 6/4/07, Nathan Hook [EMAIL PROTECTED] wrote: We have recently upgraded to struts 1.3.8 and have been running into the org.apache.struts.chain.commands.InvalidPathException when a user types in a url that doesn't map correctly. I am hoping to instead of show the user the tomcat exception page, I wanted to show a 404 error page. How do I go about changing the config files or struts to show the 404 page. Thank you for your time. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How To Lock User Account If he Failed to give Correct Password in three attempts
Your initial response to Srinivasula was OT and vague enough to make me think WTF? This is a place for individuals to meet and get help - whoever they work for and whatever their skill level. Lets not put new people off asking questions - just don't reply if something annoys you. Niall P.S. I think the same about using RTFM - just don't bother if you can't be courteous On 6/5/07, Al Sutton [EMAIL PROTECTED] wrote: I'm a firm beleiver in your RTFM answer. You seem to think I was being in some way racist against Indians, this isn't the case. If he had come from a company that said it was The UKs leading IT and technology company I would have made the same remark quoting the title of their website. My point was that if it's a leading IT and technology company of any country why doesn't he have a mentor or collegue to turn to who can answer this as opposed to using this list to go over some basics which should be part of the basic skills of anyone working on a webapp. Al. -Original Message- From: Raghupathy, Gurumoorthy [mailto:[EMAIL PROTECTED] Sent: 05 June 2007 12:48 To: Struts Users Mailing List Subject: RE: How To Lock User Account If he Failed to give Correct Password in three attempts May be he is just a trainee learning java / struts / MVC .. If he knew this concepts then why would he come here :) My suggestion is RTFM Remember I am an Indian as well (though I work in the UK) .. nothing wrong in being Indian or working for leading technology company as long as this type of questions is for training purpose and not into a production system for some company who are off-shoring their projects to them By the way why are we here? To help. :) Regards Guru -Original Message- From: Al Sutton [mailto:[EMAIL PROTECTED] Sent: 05 June 2007 12:24 To: 'Struts Users Mailing List' Subject: RE: How To Lock User Account If he Failed to give Correct Password in three attempts You know theres something about requests like this coming from hcl.in who describe themselves as Indias leading IT Technology Company that deeply concerns me. -Original Message- From: Srinivasula Reddy A , Bangalore [mailto:[EMAIL PROTECTED] Sent: 05 June 2007 12:08 To: Struts Users Mailing List Subject: RE: How To Lock User Account If he Failed to give Correct Password in three attempts Thanks guru I will come back to you after trying this snippet -Original Message- From: Raghupathy, Gurumoorthy [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 05, 2007 4:29 PM To: Struts Users Mailing List Subject: RE: How To Lock User Account If he Failed to give Correct Password in three attempts HttpSession session = request.getSession(); If ( session.getAttribute(LoginCount) == null ) { Session.setAttribute(LoginCount, new Integer(1)); } else { Integer loginCount = session.getAttribute(LoginCount); try { Writecode to login; } catch (Loginexception e) { If (loginCount.intValue() 2 ) { Write code to block the user return mapping.findForware(AccountLocked); } else { loginCount = new Integer(loginCount.intValue() +1 ); return mapping.findForware(Login); } } } Regards Guru -Original Message- From: Srinivasula Reddy A , Bangalore [mailto:[EMAIL PROTECTED] Sent: 05 June 2007 11:45 To: Struts Users Mailing List Subject: RE: How To Lock User Account If he Failed to give Correct Password in three attempts Yaa I know but I need some sample exact steps -Original Message- From: Raghupathy, Gurumoorthy [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 05, 2007 4:13 PM To: Struts Users Mailing List Subject: RE: How To Lock User Account If he Failed to give Correct Password in three attempts Store the count in the session using appropriate name Once that is above the limit then write the code to lock it ... . One suggestion though . All business logic code in single action That is not a good design ... Cant you make your business objects more layered ? Regards Guru -Original Message- From: Srinivasula Reddy A , Bangalore [mailto:[EMAIL PROTECTED] Sent: 05 June 2007 10:17 To: Struts Users Mailing List Subject: How To Lock User Account If he Failed to give Correct Password in three attempts Hi Struts User Community, Here I am sending my login action code (part only) and My DAO Code. Now I have to lock the user if he failed to enter correct user name and password in three attempts. How can I implement this in struts? Please help me with some sample code or rough idea? String username = ((LoginForm) form).getUsername(); String password = ((LoginForm) form).getPassword(); String newPassword =
Re: Handeling org.apache.struts.chain.commands.InvalidPathException
On 6/5/07, Nathan Hook [EMAIL PROTECTED] wrote: Thank you for your response. We actually have an Exception Handler setup and it catches java.lang.Exception. Here is the mapping for it... global-exceptions exception handler=com.xxx.action.ExtendedExceptionHandler key=global.error.message scope=request type=java.lang.Exception/ /global-exceptions Wouldn't this normally catch the org.apache.struts.chain.commands.InvalidPathException? Or do we specifically catch the InvalidPathException? Looking at the source code seems that you have to define each specific exception. Niall Thank you for your time. Original Message Follows From: Niall Pemberton [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Handeling org.apache.struts.chain.commands.InvalidPathException Date: Tue, 5 Jun 2007 11:52:14 +0100 You can either set up an exception handler for InvalidPathException or you can mark one of your actions in the struts-config.xml as unknown. Niall On 6/4/07, Nathan Hook [EMAIL PROTECTED] wrote: We have recently upgraded to struts 1.3.8 and have been running into the org.apache.struts.chain.commands.InvalidPathException when a user types in a url that doesn't map correctly. I am hoping to instead of show the user the tomcat exception page, I wanted to show a 404 error page. How do I go about changing the config files or struts to show the 404 page. Thank you for your time. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ PC Magazine's 2007 editors' choice for best Web mail—award-winning Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_pcmag_0507 - 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 can one servlet (ActionServlet) effect another servlet (AxisServlet)...?
On 6/6/07, Jeff Amiel [EMAIL PROTECTED] wrote: Recent issue is driving me batty. Suddenly started receiving exceptions in app server logs (tomcat a la jboss)... Servlet.service() for servlet AxisServlet threw exception java.lang.IllegalStateException org.apache.catalina.connector.ResponseFacade.setBufferSize(ResponseFacade.java:220) org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:610) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) After many many hours of research, appears that I get this exception if a specific struts action (one of several) executes at the same time as a SOAP call to the AxisServlet. It ends up causing the return of an empty dataset to the calling SOAP client (and giving me a bad headache to boot). Weird. The actions that appear to cause this aren't special in any way (not any different than other actions in my application), but I am obviously missing something. I have a suspicion that the struts actions that cause this are all chained events (one action calls another which leads to a JSPbut can't completely confirm). Any thoughts? How can the activities of one servlet effect another such as this? Yes...they are in the same war/ear..and they probably share some common classes. For the record...Jboss 4./tomcat 5.5 Struts 1.3X and Axis 1.2 (although have tried 1.4...same results). Java 1.5 on FreeBSD 6.0. Any help would be appreciated. Might be a Tomcat issue - can you be more precise about the version of Tomcat 5.5? Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.2.9 and UNICODE issue on form submittal
On 5/29/07, Adam Gordon [EMAIL PROTECTED] wrote: We're using the html:form element and we have the acceptCharset attribute set to UTF-8 and when we enter a unicode character in a textarea in this form element, the UTF-8 character (in this case \u2022, the bullet symbol: •) displays correctly. However, when the form is submitted, I'm printing out the bean property for this textarea and I'm finding that Struts has broken up the UNICODE character into 3 separate characters: â¢. We have the Content-Type meta tag set to the UTF-8 charset on the JSP and we've set the @page directive for contentType also to text/html; charset=UTF-8. We've found a workaround, but it's totally a hack as we basically remove all encodings and then reconstruct the string from a byte array. Anyone have an idea as to what might be going on and why Struts appears to be mucking with the encoding? Thanks. Struts doesn't do anything with the encoding - I imagine if you accessed the parameter value directly from the request you will see the same issue. You could try setting the encoding on the request using the setCharacterEncoding(UTF-8) - but you need to do that before the request is processed - (either in the request processor in Struts 1.2.x or inserting a Command into the chain for 1.3.x) http://java.sun.com/j2ee/1.4/docs/tutorial/doc/WebI18N5.html If that doesn't work then I would look at the Servlet Container you're using - for example Tomcat has the following FAQ: http://tomcat.apache.org/faq/misc.html#tomcat5CharEncoding Niall --adam
Re: [S2] JSTL Advice Experience
On 6/1/07, Zoran Avtarovski [EMAIL PROTECTED] wrote: I was wondering what people's experience has been with using JSTL as opposed to OGNL with regards to performance. I saw the Wiki entry for the ActionPropertyExportInterceptor but I'm concerned it may have to big a performance hit, essentially copying the value stack elements to the request scope. The reason I ask is that we are using Tomcat 6 with jsp 2.1 which is fantastic and the expression language is what it should be. Along comes S2 and OGNL and another expression language to use, combined with freemarker for templates... You can see where I'm heading. I'm finding most things about S2 absolutely great. But, the display component is driving me nuts. My ideal would be to use JSP for everything (display, templates, etc), but some posts have indicated serious performance issues. Do you mean use the Unified EL for everything - rather than JSP ? Sounds like a good plan to me (from a non-S2 user) since the unified EL[1][2] is no longer dependant on JSP. The Tomcat project has recently published its EL implementation on the maven repos - so theres a license compatible version available[3][4]. Niall [1] http://java.sun.com/products/jsp/reference/techart/unifiedEL.html [2] http://jcp.org/en/jsr/detail?id=245 [3] http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/tomcat/el-api/ [4] http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/tomcat/jasper-el/ I'm sorry if this is a bit of a Friday post, but I guess it's Friday. Z. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] Struts JavaScript Validation staticJavascript generates too much code
On 5/9/07, Antony Stubbs [EMAIL PROTECTED] wrote: Having staticJavascript=true generates *all* the validation functions specificed in struts-validators.xml (?) even if the form it's generating for only uses the REQUIRED validator. Is there a way to minimise the javascript generated? Commons Validator 1.3.1 introduced a couple of things to help with this... The first is that included in the Commons Validator jar are compressed versions of all the validation script (for example as well as validateRequired.js there is also a validateRequired-compress.js) which are significantly smaller. Struts 1.3.8 shipped with a version of the validator-rules.xml file which is configured with the compressed javascript (called validator-rules-compressed.xml and can be found in src/core/src/main/resources/org/apache/struts/validator) See below for the second... I'm going to try a work around, where I've extracted the generated javascript, and have put it in an external file that I will reference. Once I've decided which functions I am not going to use, I will remove them from this file. Validator 1.3.1 ships with two files which contain all the scripts (compressed and uncompressed versions) which are in the binary distribution: commons-validator-1.3.1.js commons-validator-1.3.1-compress.js Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3.8 and URL Validation
On 5/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm using Struts version 1.3.8 and I intend to use URL validation for a field using the validation.xml file. But, when I declare the field in validation.xml, it does not validate the field to check whether the URL is a valid one, meaning that it takes any input that I give in that textbox. Here's the entry from my validation.xml file: field property=vendorURL depends=url arg key=form.vendor.VendorURL position=0/ /field Also, other validations like required, email, maxlength..etc are working fine on this form. Is there anything else that I need to do for having client-side URL validation besides declaring in validation.xml? There is no JavaScript implementation of the url validation. Niall Thanks. -Pushkar. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ValidatorException: No ValidatorAction named required found for field fieldname
On 5/3/07, Sandra Reichert [EMAIL PROTECTED] wrote: Hi, Our web application offers two ways for data input. The first way is an html from. Here the user can enter record by record. Validation works fine. The second way is to import data from a .cvs file. I want to use the same validation.xml file for the validation of these data. But this Exception occurs: org.apache.commons.validator.ValidatorException: No ValidatorAction named required found for field fieldname at org.apache.commons.validator.Field.handleMissingAction(Field.java:867) at org.apache.commons.validator.Field.validate(Field.java:843) at org.apache.commons.validator.Form.validate(Form.java:290) at org.apache.commons.validator.Validator.validate(Validator.java:354) Abstract from UploadAction: //-- InputStream in = this.getClass().getResourceAsStream(validation.xml); ValidatorResources resources = new ValidatorResources(in); // Construct validator based on the loaded // resources and the form key Validator validator = new Validator(resources, GeneForm); // add the name bean to the validator as a // resource for the validations to be performed on. validator.setParameter(Validator.BEAN_PARAM, importGene); // Get results of the validation. ValidatorResults results = null; results = validator.validate(); // here the exception occurs //-- Whats`s my mistake? It can't find a validator named required - for a Struts webapp most people use the validator-rules.xml shipped with Struts which defines all the standard validators. Looks like you are just using your custom rules. So you could do something like the following: InputStream[] streams = new InputStream[2]; streams[0] = this.getClass().getResourceAsStream(validator-rules.xml); streams[1] = this.getClass().getResourceAsStream(validation.xml); ValidatorResources resources = new ValidatorResources(streams); Niall Thanks a lot Sandra - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] Form validation woes...
On 5/3/07, Dave Newton [EMAIL PROTECTED] wrote: Hey, Working on an S1 app at the moment (shaddup, all a' ya'). Things are set up a bit weird compared to what I'm used to; in this case there's an action that uses an ActionForm that isn't declared in struts-config, and that ActionForm contains nested ActionForms. I need to do some validaton on one of the nested ActionForms and would prefer to put it in validation.xml, but since neither the parent nor child forms are declared in struts-config I'm not sure I can do this. AFAIK the only link to the struts-config.xml is the ActionMapping passed to the validate method - which is used in the getValidationKey() method to determine the form name defined in your validation.xml My naive implementation (define the sub-form validation in validation.xml and call subForm.validate(mapping, request) throws an NPE from inside ValidatorForm.validate(). Which line is it failing on (and which Struts version)? My guess is if, as you say, no forms are defined in the struts-config.xml then the attribute value of the ActionMapping is null - probably causing your NPE. So either override the getValidationKey() method in your action form - or create your own dummy ActionMapping with the attribute set to the name of the form defined in your validator.xml for the validations you want executed. Niall I've never really even thought of doing anything this way so I'm unfamiliar with how struts-config and validation.xml interact (or if they do). All the forms seem to be instantiated by hand etc. so... I'm afraid I have to do the validation by hand (which would suck, because there's a wad of intRanges and validwhens and the version of validator they're using doesn't seem to have all the standalone validation routines). I'm just wondering if what I want to do is (reasonable and) possible. - make sure whatever action mapping has the appropriate value Thanks, Dave __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://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: [S1] Form validation woes... (SOLVED)
Doh! Just replied to the other thread :) Niall On 5/3/07, Dave Newton [EMAIL PROTECTED] wrote: Followup: Overriding getValidationKey(...) fixed it. --- Dave Newton [EMAIL PROTECTED] wrote: Hey, Working on an S1 app at the moment (shaddup, all a' ya'). Things are set up a bit weird compared to what I'm used to; in this case there's an action that uses an ActionForm that isn't declared in struts-config, and that ActionForm contains nested ActionForms. I need to do some validaton on one of the nested ActionForms and would prefer to put it in validation.xml, but since neither the parent nor child forms are declared in struts-config I'm not sure I can do this. My naive implementation (define the sub-form validation in validation.xml and call subForm.validate(mapping, request) throws an NPE from inside ValidatorForm.validate(). I've never really even thought of doing anything this way so I'm unfamiliar with how struts-config and validation.xml interact (or if they do). All the forms seem to be instantiated by hand etc. so... I'm afraid I have to do the validation by hand (which would suck, because there's a wad of intRanges and validwhens and the version of validator they're using doesn't seem to have all the standalone validation routines). I'm just wondering if what I want to do is (reasonable and) possible. Thanks, Dave __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://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: [S1] Form validation woes...
On 5/4/07, Dave Newton [EMAIL PROTECTED] wrote: Hey, Just out of curiosity, when did you post this? I've had some weird list timing things happening lately, 'cuz I posted that I had solved this yesterday (with the getValidationKey solution :) Yeah I was reading thru' in order and didn't see you had already solved it I only posted a few minutes ago. I might have replied earlier except some guys made me go out drinking beer till late last night here at ApacheCon Niall Thanks, d. --- Niall Pemberton [EMAIL PROTECTED] wrote: On 5/3/07, Dave Newton [EMAIL PROTECTED] wrote: Hey, Working on an S1 app at the moment (shaddup, all a' ya'). Things are set up a bit weird compared to what I'm used to; in this case there's an action that uses an ActionForm that isn't declared in struts-config, and that ActionForm contains nested ActionForms. I need to do some validaton on one of the nested ActionForms and would prefer to put it in validation.xml, but since neither the parent nor child forms are declared in struts-config I'm not sure I can do this. AFAIK the only link to the struts-config.xml is the ActionMapping passed to the validate method - which is used in the getValidationKey() method to determine the form name defined in your validation.xml My naive implementation (define the sub-form validation in validation.xml and call subForm.validate(mapping, request) throws an NPE from inside ValidatorForm.validate(). Which line is it failing on (and which Struts version)? My guess is if, as you say, no forms are defined in the struts-config.xml then the attribute value of the ActionMapping is null - probably causing your NPE. So either override the getValidationKey() method in your action form - or create your own dummy ActionMapping with the attribute set to the name of the form defined in your validator.xml for the validations you want executed. Niall I've never really even thought of doing anything this way so I'm unfamiliar with how struts-config and validation.xml interact (or if they do). All the forms seem to be instantiated by hand etc. so... I'm afraid I have to do the validation by hand (which would suck, because there's a wad of intRanges and validwhens and the version of validator they're using doesn't seem to have all the standalone validation routines). I'm just wondering if what I want to do is (reasonable and) possible. - make sure whatever action mapping has the appropriate value Thanks, Dave __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://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] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://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 examples not working
Would also be good to know which version of Struts you are talking about. Niall On 4/26/07, Laurie Harper [EMAIL PROTECTED] wrote: hardc0d3r wrote: i have jdk 1.6 and tomcat 5.5 installed and i tried to run the examples of struts by putting the war files in the webapps directory. when i try to run the example i get a 404 error.. all the examples in tomcat are working fine. can anyone please help me with this error? Did you look in the Tomcat logs? A 404 suggests either (a) you're trying to browse to an invalid URL, (b) there was a problem deploying the application or (c) there was a problem within the application. Without more details (what URL you were trying, what was logged during startup and during the failed request) it's difficult to diagnose. L. - 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: Use EL to access to a key from the MessageResources.properties
On 4/23/07, piloupy GOTTAPIL [EMAIL PROTECTED] wrote: Hi, I'd like to do something like this in a JSP file : html-el:link href=${contact.mail}Email Link/html-el:link where contact.mail is a key from my MessageResources.properties. I think the solution is quite simple, but I can't find how to do. How about.. bean:define id=foobean:message key=contact.mail//bean:define html-el:link href=${foo}Email Link/html-el:link Niall Thanks in advance, piloupy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Set language in JSP
On 4/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've encountered a rather annoying issue. To select the language in which our labels should be displayed, we use fmt:setLocale. Everything works fine, everybody's happy. But. To validate our forms, we use DynaValidator. In our webapp, we have 1 form which has only 1 field. When validation fails, the browser redisplays the form, with an appropriate error message. The problem is that we show our error message with html:errors / and since struts doesn't know the locale which was set with fmt:setLocale, this message is retrieved from the resource bundle of the standard browser language. Struts uses either the Locale stored under a key in the Session (default key is Globals.LOCALE_KEY, but you can specify an alternate on tags like html:errors/) or if thats not present the default locale for the request. So I think you have a number of options: 1) Set the locale in the Session 2) Create a custom TagUtils instance overriding the getUserLocale() method (Struts 1.3.5 or later since thats when the static setInstance() method was added to TagUtils). 3) Create your own custom equivalent of the html:errors/ (or html:messages) tag that access the ActionErrors object created by the validation process Niall Is there anyone who knows how to set the language in a JSP, for that particular page? It has to be on the page itself, it can't be done in an action or somewhere else. Or maybe another way to show the error message with logic:messagesPresent and retrieval of the error message from a resource bundle. Thanks in advance Kind regards, Bjorn De Bakker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Issue w/ ActionServlet.init()...
The init() and init(ServletConfig) methods are part of the servlet API - the container calls init(ServletConfig) and that method then fires init() - so if they are not getting called then I don't think it has anything to do with Struts. Have you checked your logs for any errors? Niall On 4/23/07, David Lehrian [EMAIL PROTECTED] wrote: I have an old application written using Struts 1.1 that has a subclass of ActionServlet which overrides the init() method to load data from some XML files. It works fine w/ Struts 1.1. I haven't touched it for years but now need to do some work on it. My current Netbeans environment has Struts 1.2.9 and I figured I would just update it to the newer version but for the life of me I can't get the system to call the init() method. I have the subclass listed as the action servlet in web.xml (snippet below) and I can break in the doGet and doPost methods so the servlet is definitely being used as the ActionServlet in the application. Why isn't it calling the init() and/or init(ServletConfig config) methods? servlet servlet-nameaction/servlet-name servlet-classTimeClockServlet2.TimeClockActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namedetail/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping Warm Regards, Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] Is JSTL 1.1 compatible with Struts 1.2.9?
On 4/20/07, Crawford, Preston [EMAIL PROTECTED] wrote: Anyone know? I know Struts 1.2 comes with JSTL 1.0. I read somewhere that you have to use JSTL 1.1 with a 2.4 container, which is what we have. I just need to figure out what version of JSTL we can/should run. Struts ships with an optional EL taglib - that is the equivalent of the standard tags but supporting EL. The Struts EL taglib is for use with JSTL 1.0 in a Servlet 2.3/JSP 1.2 environment. JSTL 1.1 became part of the Servlet/JSP spec in version Servlet 2.4/JSP 2.0 - in that environment you would NOT use the Struts EL taglib - just the standard Struts taglib - because the expresion language support is provided by the container (rather than the Struts tags). The only reason for the Struts EL taglib was to allow people to start using EL in a Servlet 2.3/JSP 1.2 environment (i.e. before the container supported it). So in your Servlet 2.4 environment you have to use JSTL 1.1 and the standard Struts taglib. Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] The proper way to define taglibs in a jsp file
Dave is correct since Servlet 2.3/JSP 1.2 TLD files no longer have to be specified in the web.xml - they can be auto-discovered if they're in the web applications resource path which includes the META-INF section of jar files - Struts ships the TLDs in its jars so you don't have to specify this. This mechanism is documented in Section JSP.7.3.2 TLD resource path of the JSP 1.2 Specification. Also documented in section 5.4.3.1 Configure the Struts JSP Tag Libraries (Servlet 2.3/2.4) in the Struts User Guide: http://struts.apache.org/1.x/userGuide/configuration.html Niall On 4/19/07, Crawford, Preston [EMAIL PROTECTED] wrote: That's my impression, the part about not being able to find it locally. Part of what I was thinking of doing is not having the tld's locally available. But it occurs to me that then it might spin out to the Interwebs whenever it compiles a JSP page. Trying to find a reference on this to get a definitive answer. I'm trying to make it cleaner this time. Preston -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 3:44 PM To: Struts Users Mailing List Subject: RE: [S1] The proper way to define taglibs in a jsp file --- Crawford, Preston wrote: Oh, I just remembered something. There might be overhead/risk to jsps hitting the dtd on the Internet vs. the local tld, no? I'm not sure that that's what the URI really does; they *look* like URLs but I think they're just look-up values to find the corresponding TLD. (This has always been a somewhat murky area for me, because I've never really cared, but I think the only time it spins out to the 'net is if it can't find the TLD locally... it might depend on the IDE and/or server, though.) d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] The proper way to define taglibs in a jsp file
Struts EL is for Servlet 2.3 containers only (provided to give people the opportunity to start using EL before it was included in the standard for containers) - you can't use it in Servlet 2.2 and you don't need it in Servlet 2.4 (its part of Servlet 2.4/JSP 2.0 Spec). Niall On 4/20/07, Crawford, Preston [EMAIL PROTECTED] wrote: Although I can't remember if I need struts-el if all I want is jstl + the new version of Struts. Dang, I've had my head in Struts 2, Spring, JSF for too long. Preston -Original Message- From: Crawford, Preston [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 4:26 PM To: 'Struts Users Mailing List' Subject: RE: [S1] The proper way to define taglibs in a jsp file Nevermind, I think the answer is both if I remember correctly. Preston CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. - 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: Validatoin not working
For ValidatorForm it uses the attribute value for the key to the validation - in your case thats LogonForm - but your validation.xml uses the form name of logonForm. So either change the key in the validation.xml or the attribute on your action mapping. You don't actually have to specify attribute on an action mapping - if you don't (which I never do) it uses the form name. So unlesss you have a specific need for it probably the easiest solution is to remove the attribute attribute altogether. If the above doesn't solve your problem then the first step in these kind of problems is to configure the logging to debug for Struts and Commons Validator - that should give you more information about what Struts is trying to do and maybe give you a clue where things are going wrong. Niall On 4/18/07, Kirthi [EMAIL PROTECTED] wrote: I am using Struts Validator Frame work to do both Client and Serverside Validation. I am using Struts 1.2 My Validator is not triggring at all. I am trying to figure out the mistake from the last two days, but no luck. I am extending the ValidatorForm Class. Can anyone help me with this one. thanks Here is the code. ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; struts-config data-sources / form-beans form-bean name=logonForm type=com.yourcompany.struts.LogonForm/ /form-beans global-exceptions / global-forwards / action-mappings action attribute=LogonForm input=/MyJsp.jsp name=logonForm path=/Logon scope=request validate=true type=com.yourcompany.struts.Logon forward name=success path=/MyJspSuccess.jsp / forward name=failure path=/MyHtml.html / /action /action-mappings message-resources parameter=com.yourcompany.struts.ApplicationResources / !-- Validator Configuration -- 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 * !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_0.dtd; form-validation formset form name=logonForm field property=username depends=required arg0 key=prompt.username/ /field /form /formset /form-validation ** package com.yourcompany.struts; import org.apache.struts.validator.ValidatorForm; public class LogonForm extends ValidatorForm { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } ** http://www.nabble.com/file/7961/struts-config.xml struts-config.xml http://www.nabble.com/file/7962/validation.xml validation.xml http://www.nabble.com/file/7963/validator-rules.xml validator-rules.xml -- View this message in context: http://www.nabble.com/Validatoin-not-working-tf3603238.html#a10066448 Sent from the Struts - User mailing list archive at Nabble.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: Load an .xml file when server start up
I've never actually used it but I think the DigestingPlugIn might do this for you http://tinyurl.com/2kzh8b Having said that probably the best plan would be to create your own ServletContextListener to do this which would be independant of Struts http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html Niall On 4/18/07, Zhang, Larry (L.) [EMAIL PROTECTED] wrote: I need to load an .xml file when Websphere server starts up. I am using Struts ActionServlet as the only servlet in the app and I do have a CustomProcessor extending TilesRequestProcessor. I am trying to load the .xml file when the server starts up. I configured to load ActionServlet when server starts up in web.xml. Where should I put my code to load the .xml file during the server starts up. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts module switch
On 4/11/07, Suman Maity [EMAIL PROTECTED] wrote: Well, could u then let me know how to modularize my struts config in case it grows large. How do I modularize my struts web app without having separate struts modules. I am working on a web project where there are three types of users:Admin, Web User and Call Center User. Under each of these there are several screens/modules. Currently we are maintaining only one struts config and tiles def file and their sizes are becoming a issue. Also I would like to use separate application resources properties files for different user types. Could u give me suggestions on how to overcome these issues? You can have multiple struts-config.xml files in one module - you just specify a comm separated list of the file names in the web.xml - take a look at the struts-examples webapp shipped with the latest version of struts - the validation module is broken up in suahc a way. Niall Still I would like to have an answer to my original question, if possible. As I have already told that I have been able to do module switching, but still I haven't been able to use a separate tiles definition file for the second module. If u could help me out at this, I will be thankful to you. Being able to use a separate tiles def file for the second module (having a struts config file of its own) will do for me. pbenedict wrote: Have you considered removing the use of modules? Modules are really a nuisance, and were originally developed to allow multiple Struts apps running under one context. There's a hard barrier between modules and almost all developers I know no longer use them. You can split up your struts config without using modules. I know this advice doesn't answer your question, but think about it, because it will save you time. Paul Suman Maity wrote: Hi, I was trying struts module switching and was successful doing it using SwitchAction. I am also using tiles. The problem is I am not able to use a separate tiles definition file for the other module (i have two modules). I have two struts config files. struts-config.xml for the default module and struts-anotherModule-config.xml for the other module. I have written the following in the default struts config file (struts-config.xml): plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/conf/tiles-defs.xml/ set-property property=definitions-debug value=1/ set-property property=definitions-parser-details value=0/ set-property property=definitions-parser-validate value=true/ /plug-in I had created another tiles definition file for the other module with a name tiles-anotherModule-defs.xml and created some definitions in that. I mentioned this file in struts-anotherModule-config.xml file in the same way as above. In this struts config i wrote a action mapiping which has forward tag like this: forward name=switchModule path=actionExamples The definition of actionExamples is there in the second tiles definition file that is the tiles-anotherModule-defs.xml file. When I run the app, the module switch occurs with the help of SwitchAction but finally it fails to load the definition actionExamples saying Can not get request dispatcher for path actionExamples. Now, the irony is that instead of specifying a seperate tiles definition file, I write the following line in struts-anotherModule-config.xml file: plug-in className=org.apache.struts.tiles.TilesPlugin/ Put the definition actionExamples in the default tiles def file and it works. I even don't need to mention the tiles def file's name here although it simply works. But if i comment the above line, it does not work. I am confused. Can not I use separate tiles definition files for separate modules each having its own struts config file? Please provide example if possible. Thanking in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts-module-switch-tf3552250.html#a9934530 Sent from the Struts - User mailing list archive at Nabble.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: Does struts 1.2.x or 1.3.x support the attribute autocomplete f or forms?
On 4/6/07, Crawford, Preston [EMAIL PROTECTED] wrote: I'm sure many of you know about this. The originally IE specific attribute autocomplete, that when set to off would prevent the browser from saving the data in the form for autocompletion later. I'm working on a project that uses Struts 1.1. So I have a few questions. #1 - Is autocomplete supported in later version of Struts 1? No its not supported in any version - Struts only supports attributes that are in the HTML 4 spec and has a policy of not adding non standard attributes. #2 - If so, which version? The tags were refactored in Struts 1.2.7 to make creating custom implementations and adding additional attributes easier. So if you are going to upgrade then this would be your only option. If you want to do this in the form tag then something like the following: public MyFormTag extends FormTag { protected void renderOtherAttributes(StringBuffer results) { renderAttribute(results, autocomplete, off); } } In the other form input tags the equivalent method is prepareOtherAttributes() For notes on upgrading and the issues you'll face then there are upgrade notes on the wiki: http://wiki.apache.org/struts/StrutsUpgrade Niall I know there are ways to do this with JavaScript. Trapping the enter keydown, etc. and doing a submit. I'm doing that currently. The problem is that I'm trying to avoid attaching the onkeydown event to the body, as many examples have you do, because doing this means that even if you're not inside the form you can just hit enter and submit the form. So you have to attach the onkeydown event to every form field or else somehow check to see if the event was fired by a form element. I'm just trying to support this functionality (enter key submits the form while in the form, but doesn't save any of the fields' data) with minimal headache. It's starting to look like going to autocomplete=off might be better, thus my question. Preston - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Dispatch Action
On 4/6/07, samk [EMAIL PROTECTED] wrote: Hi , I am new to struts , I am using a Tabbed page with multiple buttons on the page (submit, save, clear) can some one let me know the process in doing it? As i have read some article that we can do it with dispatch Action or LookUpDispatch action. There are various flavours of DispatchAction (plus ActionDispatcher) - the struts-examples webapp has a dispatch module with examples of all the flavours (versions 1.2.9 and 1.3.8) - which you can try out and look at the source code to see what suits you. Niall Thx in Adv Sunny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.2 validation not working!
Use the validation-rules.xml that comes with the version of Struts you're using. This exception usually happens when people upgrade their version of Struts but don't use the validation-rules.xml that ships with the new version. Niall On 3/29/07, davout [EMAIL PROTECTED] wrote: I've added Struts validation to my application and I'm getting an exception when I try to use the 'required' validation type. Here's the code... The 'validation.xml' file... [Code] ?xml version=1.0 encoding=UTF-8? [/code] the start of the 'validation-rules.xml' file... [Code] [/code] the related action class... [Code] public class ImpactNegationEditAction extends AbstractImpactNegationAction implements EntityIDs, ImpactNegationIDs { public void save_onClick(FormActionContext aCtx) { ImpactNegationEditForm aForm = (ImpactNegationEditForm) aCtx.form(); aCtx.addErrors(aForm.validate(aCtx.mapping(),aCtx.request())); if (aCtx.hasErrors() == false) { // is add? if (aForm.getImpactNegationIDInt() == ID_UNASSIGNED) { // verify title is unique try { ImpactNegation anOther = getManager(aCtx).findByTitle(aForm.getTitle()); if (anOther != null) { addFieldError(aCtx,title,error.duplicateField,Title); } [/code] the related form... [Code] public abstract class AbstractSorForm extends FWValidatorForm { } public class ImpactNegationEditForm extends AbstractSorForm { private static final long serialVersionUID = 3604637580339030809L; private String fImpactNegationID; private String fTitle; private String fDesc; private String fDisplayOrder; private String fPercent; private String fCaptionDetail = null; private String fFormTitle = null; public ImpactNegationEditForm() { // TODO Auto-generated constructor stub } public String getDesc() { return fDesc; } public void setDesc(String aDesc) { fDesc = aDesc; } public String getDisplayOrder() { return fDisplayOrder; } public int getDisplayOrderInt() { return Integer.parseInt(fDisplayOrder); } public void setDisplayOrder(String aDisplayOrder) { fDisplayOrder = aDisplayOrder; } public String getImpactNegationID() { return fImpactNegationID; } public int getImpactNegationIDInt() { return Integer.parseInt(fImpactNegationID); } public void setImpactNegationID(String aId) { fImpactNegationID = aId; } public String getPercent() { return fPercent; } public double getPercentDouble() { return Double.parseDouble(fPercent); } public void setPercent(String aPercent) { fPercent = aPercent; } public String getTitle() { return fTitle; } public void setTitle(String aTitle) { fTitle = aTitle; } public String getCaptionDetail() { return fCaptionDetail; } public void setCaptionDetail(String aCaptionDetail) { fCaptionDetail = aCaptionDetail; } public String getFormTitle() { return fFormTitle; } public void setFormTitle(String aFormTitle) { fFormTitle = aFormTitle; } } [/code] the JSP body file... [Code] [/code] the exception thrown... [Code:] the exception thrown when the form is validated... ERROR: 18:54:18: org.apache.struts.validator.ValidatorForm: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest) org.apache.commons.validator.ValidatorException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest) at org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:627) at org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:557) at org.apache.commons.validator.Field.validateForRule(Field.java:811) at org.apache.commons.validator.Field.validate(Field.java:890) at org.apache.commons.validator.Form.validate(Form.java:174) at org.apache.commons.validator.Validator.validate(Validator.java:367) at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:112) at com.eis.sor.struts.action.impactnegation.ImpactNegationEditAction.save_onClick(ImpactNegationEditAction.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
Re: HELP, creating my own validation
I can't see anything wrong with what you have here. Can you show us how you have configured Struts to pick up your custom validation rules and also say what version of Struts and what version of Commons Validator you are using Niall On 3/28/07, Dwight Galloway [EMAIL PROTECTED] wrote: I am having troubles getting my own validator to work, I wonder if it is the classpath where I am pointing to my Class with? I am trying to create a dateRange validation to determin if the date falls between two dates or not. This is what I have in my validation.xml field property=startDate depends=required,date,dateRange arg0 key=Start Date resource=false/ varvar-namedatePattern/var-namevar-valueMM/dd//var-value/var varvar-nameminDate/var-namevar-value07/01/2003/var-value/var varvar-namemaxDate/var-namevar-value06/30/2004/var-value/var /field this is what I have in my validator-rules validator name=dateRange classname=gov.utah.dhs.pats.util.ValidationUtil method=validateDateRange methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest depends= msg=errors.dateRange/ and my class looks like this, notice I have a println at the start of my program, it is like it is completely ignoring my class, I am clueless how to test this and to see what is really happening, I don't have much experience with struts so please any suggestions would help,thank you... package gov.utah.dhs.pats.util; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.http.HttpServletRequest; import org.apache.commons.validator.Field; import org.apache.commons.validator.ValidatorAction; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.struts.action.ActionMessages; import org.apache.struts.validator.Resources; public class ValidationUtil { public static final String DEFAULT_FORM_DATE_PATTERN = M/dd/; public static final Date DEFAULT_MIN_DATE = getDefaultMinDate(); public static final Date DEFAULT_MAX_DATE = getDefaultMaxDate(); public static boolean validateDateRange(Object bean, ValidatorAction va, Field field, ActionMessages msg, HttpServletRequest request) { //if we're not properly configured to parse dates, //all date validation will fail System.out.println(!INSIDE THE VALIDATION UTILITY the FIELD.. + field ); if (DEFAULT_MIN_DATE == null || DEFAULT_MAX_DATE == null) return false; try { String value = ValidatorUtils.getValueAsString(bean, field.getProperty()); Date date = getDate(value, DEFAULT_FORM_DATE_PATTERN); Date minDate = getDate(field.getVarValue(minDate), DEFAULT_FORM_DATE_PATTERN); Date maxDate = getDate(field.getVarValue(maxDate), DEFAULT_FORM_DATE_PATTERN); if (date.compareTo(minDate) 0 || date.compareTo(maxDate) 0) { msg.add(field.getKey().toString(), Resources.getActionMessage(request, va, field)); return false; } return true; } catch (Exception e) { e.printStackTrace(); msg.add(field.getKey().toString(), Resources.getActionMessage(request, va, field)); return false; } } protected static Date getDate(String dateString, String pattern) { Date date = null; try { SimpleDateFormat df = new SimpleDateFormat(pattern); date = df.parse(dateString); } catch (Exception e) { e.printStackTrace(); } return date; } protected static Date getDefaultMinDate() { return getDate(01/01/1900, DEFAULT_FORM_DATE_PATTERN); } protected static Date getDefaultMaxDate() { return getDate(12/31/2030, DEFAULT_FORM_DATE_PATTERN); } } if anyone can please just help guide me a bit on this I would appreciate it. Dwight S. Galloway (801) 538-4234 [EMAIL PROTECTED] Department of Technology Services MAKE IT A GREAT DAY! - 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 1.3 and maven
On 3/28/07, Manfred Wolff [EMAIL PROTECTED] wrote: James. I know it. But at least one question: Does anybody know why every little peace of open source is hosted at ibiblio, but not the famous struts. I really don't understand this. It is (both 1.3.5 and 1.3.8 versions) - but in the maven 2 repo here: http://www.ibiblio.org/maven2/org/apache/struts/ AFAIK http://www.ibiblio.org/maven is the maven 1 repo Niall Manne James Mitchell wrote: Ya, I don't know off the top of my head, but keep in mind that you can tell Maven to use different repositories, so you can easily host your own maven repo on your intranet which I presume that all of the devs could see and may or may not be open to the public. HTH -- James Mitchell On Mar 28, 2007, at 11:34 AM, Manfred Wolff wrote: James. For a project with one worker this is a suitable resolution. But in a big project, with developers round the world (in this case Germany, India and Tunesia) it is a good thing to have all needed common open source jars held in the project.xml accessable via a public maven repo as ibiblio. So no one must be careful using the right versions - and no one has problem to get all jars that are needed. I wonder if there is a server who serves this jars for public access as the struts 1.2 jars (last is 1.2.9). Manne James Mitchell wrote: Oh, you're right. Sorry. Would you be able to install them locally and just go with that? Or do you have to have a portable solution? If you can install them locally (on your machine), then drop them in the right place, and call it done. If you must have a portable solution, just drop them on a server that you (and whoever else needs them) can see when building the app. The maven repos are nothing more than a file system fronted with a web server. --James Mitchell The Ruby Roundup http://www.rubyroundup.com/ On Mar 28, 2007, at 11:22 AM, Manfred Wolff wrote: Sorry, but there - as in ibiblio - is no 1.3 Struts in the repository. Manne James Mitchell wrote: http://www.apache.org/dev/repository-faq.html --James Mitchell The Ruby Roundup http://www.rubyroundup.com/ On Mar 28, 2007, at 10:55 AM, Manfred Wolff wrote: Hi Can somebody tell me, why there is no jar file at ibiblio.org/maven - and - where I can get the jars (via url), if I want to make a maven 1 project with struts 1.3.8? Thanks Manne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HELP, creating my own validation
On 3/28/07, Dwight Galloway [EMAIL PROTECTED] wrote: here is what I have inside my struts, I guess I am not sure what I must do inside of the struts config for the validation, but I am using version 1.0 with the config at 1.1.dtd, I inherited this system and I really know very little about struts, thank you for your help... OK I was more wondering what you have configured for the ValidatorPlugIn - should be a plug-in element in your struts config. Also what you say about versions is confusing - can you be explicit about the Struts version and the Commons Validator version you are using. For example the config at 1.1.dtd doesn't tell me whether you're referring to the Struts dtd or the Commons Valdiator dtd? Niall !--=== Cycle ===-- action path=/cycle/edit type=gov.utah.dhs.pats.service.ui.CycleAction name=cycleEditForm scope=request parameter=getCycle validate=false forward name=success path=.view.cycle.edit/ forward name=failure path=.view.cycle.edit/ /action action path=/cycle/save type=gov.utah.dhs.pats.service.ui.CycleAction name=cycleEditForm scope=request parameter=saveCycle validate=false input=/cycle/edit.do forward name=continue path=/session/edit.do/ forward name=failure path=/cycle/edit.do/ /action action path=/cycle/assignedService type=gov.utah.dhs.pats.service.ui.CycleAction name=cycleEditForm scope=request parameter=getAssignedServices validate=false forward name=success path=.view.session.edit/ /action action path=/cycle/search type=gov.utah.dhs.pats.service.ui.CycleAction name=cycleEditForm scope=session parameter=searchCycles validate=false forward name=success path=.view.cycle/ forward name=failure path=.view.cycle/ /action action path=/cycle/picklist forward=/cycle/picklist/search.do / action path=/cycle/picklist/search type=gov.utah.dhs.pats.service.ui.CycleAction name=cycleEditForm scope=session parameter=searchCycles validate=false forward name=success path=.picklist.cycle/ forward name=failure path=.picklist.cycle/ /action Niall Pemberton [EMAIL PROTECTED] 3/28/2007 2:53 PM I can't see anything wrong with what you have here. Can you show us how you have configured Struts to pick up your custom validation rules and also say what version of Struts and what version of Commons Validator you are using Niall On 3/28/07, Dwight Galloway [EMAIL PROTECTED] wrote: I am having troubles getting my own validator to work, I wonder if it is the classpath where I am pointing to my Class with? I am trying to create a dateRange validation to determin if the date falls between two dates or not. This is what I have in my validation.xml field property=startDate depends=required,date,dateRange arg0 key=Start Date resource=false/ varvar-namedatePattern/var-namevar-valueMM/dd//var-value/var varvar-nameminDate/var-namevar-value07/01/2003/var-value/var varvar-namemaxDate/var-namevar-value06/30/2004/var-value/var /field this is what I have in my validator-rules validator name=dateRange classname=gov.utah.dhs.pats.util.ValidationUtil method=validateDateRange methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest depends= msg=errors.dateRange/ and my class looks like this, notice I have a println at the start of my program, it is like it is completely ignoring my class, I am clueless how to test this and to see what is really happening, I don't have much experience with struts so please any suggestions would help,thank you... package gov.utah.dhs.pats.util; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.http.HttpServletRequest; import org.apache.commons.validator.Field; import org.apache.commons.validator.ValidatorAction; import org.apache.commons.validator.util.ValidatorUtils; import org.apache.struts.action.ActionMessages; import org.apache.struts.validator.Resources; public class ValidationUtil { public static final String DEFAULT_FORM_DATE_PATTERN = M/dd/; public static final Date DEFAULT_MIN_DATE = getDefaultMinDate(); public static final Date
Re: contextRelative=true doesn't work in a module
I've never actually used modules in anger - but the contextRelative was considered deprecated in favour of the module attribute since Struts 1.2.4: http://struts.apache.org/1.x/userGuide/release-notes-1_2_4.html http://wiki.apache.org/struts/StrutsUpgradeNotes11to124 So I guess you should change to something like the following: forward module=user name=userHome path=/user/home.do redirect=true / The struts-examples webapp shipped with Struts is split up into modules - so maybe looking at how it works will help you to resovle your issue. Niall On 3/23/07, Oren Livne [EMAIL PROTECTED] wrote: Dear All: My application context is called Catalog. It uses Struts 1.3.8. There are two modules, default and user. In the default component struts config, I have: !-- === Global forwards (alias for main page, etc.). Needs to be placed in every module's Struts config unless we use XDoclet to merge a global global-forwards.xml file. === -- global-forwards !-- Catalog component home page -- !-- contextRelative=true doesn't seem to work from a local action. -- forward name=catalogHome path=/switchMod.do?prefix=/catalogamp;page=/home.do redirect=true / !-- User component home page, which is also the application's front page -- forward contextRelative=true name=userHome path=/user/home.do redirect=true / /global-forwards Both methods work and forward to the correct URLs. However, I have the identical global-forwards in the user module's struts config. Now it forward to the wrong page from an action in the user module. The same result happened when I localized the forward to the action: action path=/logout type=net.ruready.struts.user.action.LogoutAction forward contextRelative=truename=userHome path=/user/home.do redirect=true / /action ... it tries to forward to '/Catalog/user/user/home.do'. What do I do to get it to work? Thanks so much, Oren - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: module attribute for exception ?
On 3/23/07, Oren Livne [EMAIL PROTECTED] wrote: P.S. is there an equivalent attribute to module for global and/or local exception attributes? Right now I have: exception key=error.Exception scope=request handler=net.ruready.struts.common.exception.MailExceptionHandler type=java.lang.Exception path=/switchMod.do?prefix=/erroramp;page=/system.do / I want to have module=/error and path=/system.do instead. Could I use a global-forward declaration instead of the action path used above? (e.g. alias a global forward called systemError to use module=/error and path=/system.do and then write path=systemError) Unfortunately module was never added for exception handler and the default implementation just creates an ActionForward from the path. You could however create your own custom Exception Handler and configure it with a module property public class MyExceptionHandler extends ExceptionHandler { public ActionForward execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException { ActionForward af = super.execute(ex, ae, mapping, formInstance, request, response); af.setModule(ae.getProperty(module)); return af; } } You then configure the exception using the set-property to specify the module (note there are two forms to set-property - either using property or key - in this example you need to use key): exception className=mypackage.MyExceptionConfig key=error.Exception scope=request handler=net.ruready.struts.common.exception.MailExceptionHandler type=java.lang.Exception path=/switchMod.do?prefix=/erroramp;page=/system.do set-property key=module value=/users/ /exception Niall Thanks Oren Oren Livne wrote: Dear Niall: Thanks so much .You are a life saver. It works. Just one note -- the syntax that works is: forward module=/user name=userHome path=/home.do redirect=true / Here the module must start with a /, and the path is relative to the module's URL. Thanks! Oren - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- == Oren Livne, Ph.D. Research Assistant Professor of Mathematics RUReady Software Architect Academic Outreach and Continuing Education 1901 East South Campus Dr., Room 2197-D University of Utah, Salt Lake City, UT 84112-9399 Tel : (801) 581-6831 Cell: (801) 631-3885 Fax: (801) 585-5414 Email: [EMAIL PROTECTED] Web: http://ruready.net/oren == - 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: module attribute for exception ?
Sorry - I className shouldn't have been in there: exception key=error.Exception scope=request handler=net.ruready.struts.common.exception.MailExceptionHandler type=java.lang.Exception path=/switchMod.do?prefix=/erroramp;page=/system.do set-property key=module value=/users/ /exception Niall On 3/23/07, Niall Pemberton [EMAIL PROTECTED] wrote: On 3/23/07, Oren Livne [EMAIL PROTECTED] wrote: P.S. is there an equivalent attribute to module for global and/or local exception attributes? Right now I have: exception key=error.Exception scope=request handler=net.ruready.struts.common.exception.MailExceptionHandler type=java.lang.Exception path=/switchMod.do?prefix=/erroramp;page=/system.do / I want to have module=/error and path=/system.do instead. Could I use a global-forward declaration instead of the action path used above? (e.g. alias a global forward called systemError to use module=/error and path=/system.do and then write path=systemError) Unfortunately module was never added for exception handler and the default implementation just creates an ActionForward from the path. You could however create your own custom Exception Handler and configure it with a module property public class MyExceptionHandler extends ExceptionHandler { public ActionForward execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException { ActionForward af = super.execute(ex, ae, mapping, formInstance, request, response); af.setModule(ae.getProperty(module)); return af; } } You then configure the exception using the set-property to specify the module (note there are two forms to set-property - either using property or key - in this example you need to use key): exception className=mypackage.MyExceptionConfig key=error.Exception scope=request handler=net.ruready.struts.common.exception.MailExceptionHandler type=java.lang.Exception path=/switchMod.do?prefix=/erroramp;page=/system.do set-property key=module value=/users/ /exception Niall Thanks Oren Oren Livne wrote: Dear Niall: Thanks so much .You are a life saver. It works. Just one note -- the syntax that works is: forward module=/user name=userHome path=/home.do redirect=true / Here the module must start with a /, and the path is relative to the module's URL. Thanks! Oren - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- == Oren Livne, Ph.D. Research Assistant Professor of Mathematics RUReady Software Architect Academic Outreach and Continuing Education 1901 East South Campus Dr., Room 2197-D University of Utah, Salt Lake City, UT 84112-9399 Tel : (801) 581-6831 Cell: (801) 631-3885 Fax: (801) 585-5414 Email: [EMAIL PROTECTED] Web: http://ruready.net/oren == - 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 question Struts 1.2.9
On 3/21/07, Dilip Ladhani [EMAIL PROTECTED] wrote: I have gotten the validator to work in may of my projects, but I am stuck on this one and was wondering if someone can help. I have a MessageResources.properties under WEB-INF/classes which contains all the messages. In my struts-config I have the following line message-resources key=messages parameter=MessageResources / Here is my validation.xml form name=/showConfirmCompletedCourses field property=selectedCategory depends=required arg key=label.Category/ /field field property=startDate depends=required,date arg key=label.StartDate/ var var-namedatePattern/var-name var-valueMM/dd//var-value /var /field /form I also tried putting arg bundle=messages key=label.Category/ I always get an exception when I validate. I call the form.validate from my action class, I always get the following exception If you're not using the default bundle then you need to specify the bundle for all the messages as well - so you would have to add msg elements for both the required and date validator in the above example (with the bundle attribute specified). Niall 2007-03-21 12:41:36,437] [location - org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:578)] Unhandled exception thrown during validation: No message resources found for bundle: org.apache.struts.action.MESSAGE java.lang.NullPointerException: No message resources found for bundle: org.apache.struts.action.MESSAGE at org.apache.struts.validator.Resources.getMessageResources(Resources.java:140) at org.apache.struts.validator.Resources.getActionMessage(Resources.java:349) at org.apache.struts.validator.FieldChecks.validateRequired(FieldChecks.java:94) 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:585) thanks - 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 question Struts 1.2.9
On 3/21/07, Dilip Ladhani [EMAIL PROTECTED] wrote: Thanks for the reply. However, after doing that I get the error Unhandled exception thrown during validation: No message resources found for bundle: messages java.lang.NullPointerException: No message resources found for bundle: messages OK after making it the default - did you remove the bundle=messages from your validation.xml? Also take a look at the bundles example in the validator part of the struts-examples webapp shipped with Struts 1.2.9 Niall Also, on various jsps, I would have to, I would have to remove bundle=messages, for eg bean:message bundle=messages key=heading.viewHistory / This I can do, however, I still get the above error On 3/21/07, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: make your message resource as the defautl one, dont put any key just add the entry message-resources parameter=MessageResources / in struts-config and see., Thanks Regards, Nuwan. - Original Message - From: Dilip Ladhani [EMAIL PROTECTED] To: user@struts.apache.org Sent: Wednesday, March 21, 2007 4:48 PM Subject: Validator question Struts 1.2.9 I have gotten the validator to work in may of my projects, but I am stuck on this one and was wondering if someone can help. I have a MessageResources.properties under WEB-INF/classes which contains all the messages. In my struts-config I have the following line message-resources key=messages parameter=MessageResources / Here is my validation.xml form name=/showConfirmCompletedCourses field property=selectedCategory depends=required arg key=label.Category/ /field field property=startDate depends=required,date arg key=label.StartDate/ var var-namedatePattern/var-name var-valueMM/dd//var-value /var /field /form I also tried putting arg bundle=messages key=label.Category/ I always get an exception when I validate. I call the form.validate from my action class, I always get the following exception 2007-03-21 12:41:36,437] [location - org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:578)] Unhandled exception thrown during validation: No message resources found for bundle: org.apache.struts.action.MESSAGE java.lang.NullPointerException: No message resources found for bundle: org.apache.struts.action.MESSAGE at org.apache.struts.validator.Resources.getMessageResources(Resources.java:140) at org.apache.struts.validator.Resources.getActionMessage(Resources.java:349) at org.apache.struts.validator.FieldChecks.validateRequired(FieldChecks.java:94) 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:585) thanks - 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]
[s1] Struts / Netbeans Hands On Lab
Theres a Hands on Lab for Struts (1.2.9) / Netbeans by Sang Shin availbale here: http://www.javapassion.com/handsonlabs/strutsbasics/ Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s1] handle exception in processPopulate?
On 3/13/07, Paul Benedict [EMAIL PROTECTED] wrote: Strachan, Paul wrote: I resolved this myself by simply overriding the set(String, Object) method in my form, to ignore certain request parameter names that are not of type String in my LazyValidatorForm. If you feel strongly about this, please create a JIRA issue for possible enhancement. You may have a good idea worth investigating :) Part of the problem with the population is that most of the code is burried in static RequestUtils methods - making providing different behaviours difficult. I did some work for Struts 1.3 to refactor that back into the Commands - with the BeanUtils populate being called from the Command rather than a static request utils method. I think that would be a first step for solutions to these kind of issues https://issues.apache.org/struts/browse/STR-2772 Although that issue talks about multipart handling - it also introduces a populate() method in AbstractPopulateActionForm that calls BeanUtils populate() directly Niall Niall Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaValidatorForm with java.util.Date
On 3/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Why does sql.Date work? Because BeanUtils (at the moment) comes with a registered converter for jav.sql.Date - but not for java.util.Date. If you want it to handle String--java.util.Date you need to register a Converter for it: Converter dateConverter = new MyDateConverter(); ConvertUtils.register(dateConverter, java.util.Date.class); Your date converter will need to implement the following interface: http://tinyurl.com/2h459j The section 4.3.1 you refer to below tells you which types are supported out of the box. Niall And the apache-site states that it's actually possible to use for instance java.util.ArrayList. How do you do that? http://struts.apache.org/1.3.5/userGuide/building_controller.html, see section 4.3.1. -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 14:06 To: Struts Users Mailing List Subject: Re: DynaValidatorForm with java.util.Date The fields of action forms, including DynaValidatorForms are populated from request parameters, and these values are all in String variables. I suggest using a String variable for the dyna validator form field as well, and just parsing it to get the java.util.Date equivalent when you use it in your Action classes. Hubert On 3/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: And the 3rd mail. Is it possible to use an object that's different from java.lang.* as type for the dynavalidatorform? I think that's what causing the issue here. If it's not possible, then I'm in deep :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 10:26 To: user@struts.apache.org Subject: RE: DynaValidatorForm with java.util.Date Ok, I did some tests and debugging and this is the result: The errormsg is Cannot assign value of type 'java.lang.String' to property 'txtFieldName' of type 'java.util.Date'. I fill that field with following code: modifyForm.set(txtFieldName,new Date()); So the object I'm assigning to that field is a Date-object, but for some reason it is converted to a String. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 9:40 To: user@struts.apache.org Subject: DynaValidatorForm with java.util.Date Hi I have a form in which a Date is displayed, using fmt. It's static text, so no user input is required. The problem is the following. When the validation of that form fails, you return to that form. Actually, it should return to that form, but you're redirected to the error page. This is the error: 2448020 12 03 09:29 [http-8080-Processor24] ERROR org.apache.struts.util.RequestUtils - javax.servlet.ServletException: BeanUtils.populate javax.servlet.ServletException: BeanUtils.populate The form bean exists of a field, which is hidden, of the type java.util.Date. This is filled by the action, with the correct date. When I look at the source of the page, the date is actually filled in, so that's not the problem. I assume there's a problem with assigning the java.util.Date-type to a field in a DynaValidatorForm, but I'm not sure that's what causing the problem. There's also no validation on that field. Struts-config: form-bean name=ModifyUserForm type=org.apache.struts.validator.DynaValidatorForm form-property name=txtTokenStatus type=java.util.Date / /form-bean Does anybody know how to have a Date-field in your form, in a way you can assign it to a textfield and make sure you can also pass it to fmt:formatDate. Tia Grtz Bjorn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you 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]
Re: DynaValidatorForm with java.util.Date
On 3/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Where do I register such a convertor? Simply add this code to my Action or do I have to add this somewhere else? I've figured out what my problem was, but now sth else pops up. I have a field with type java.util.ArrayList. When I enter the form, the precedent Action fills the form. On screen, the ArrayList is correctly processed. Now, when I submit the form, all those values are gone. I added html:hidden property=txtFieldForArrayList / to my JSP, but it turns out that was the problem for the previous error. When I remove that field from my JSP, everything works correctly for the first time, but the second time I enter the page, this ArrayList is gone. What am I doing wrong here? Is the ArrayList gone or empty? Presumably just empty - since DynaActionForm's should re-create the list even in request scope. You could change the form to be session scope - or you need to add some lazy list type behaviour http://wiki.apache.org/struts/StrutsCatalogLazyList http://wiki.apache.org/struts/LazyList If you use one of the lazy ActionForm flavours it does this for you: http://struts.apache.org/1.x/userGuide/building_controller.html#lazy_action_form_classes Niall -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 14:49 To: Struts Users Mailing List Subject: Re: DynaValidatorForm with java.util.Date On 3/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Why does sql.Date work? Because BeanUtils (at the moment) comes with a registered converter for jav.sql.Date - but not for java.util.Date. If you want it to handle String--java.util.Date you need to register a Converter for it: Converter dateConverter = new MyDateConverter(); ConvertUtils.register(dateConverter, java.util.Date.class); Your date converter will need to implement the following interface: http://tinyurl.com/2h459j The section 4.3.1 you refer to below tells you which types are supported out of the box. Niall And the apache-site states that it's actually possible to use for instance java.util.ArrayList. How do you do that? http://struts.apache.org/1.3.5/userGuide/building_controller.html, see section 4.3.1. -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 14:06 To: Struts Users Mailing List Subject: Re: DynaValidatorForm with java.util.Date The fields of action forms, including DynaValidatorForms are populated from request parameters, and these values are all in String variables. I suggest using a String variable for the dyna validator form field as well, and just parsing it to get the java.util.Date equivalent when you use it in your Action classes. Hubert On 3/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: And the 3rd mail. Is it possible to use an object that's different from java.lang.* as type for the dynavalidatorform? I think that's what causing the issue here. If it's not possible, then I'm in deep :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 10:26 To: user@struts.apache.org Subject: RE: DynaValidatorForm with java.util.Date Ok, I did some tests and debugging and this is the result: The errormsg is Cannot assign value of type 'java.lang.String' to property 'txtFieldName' of type 'java.util.Date'. I fill that field with following code: modifyForm.set(txtFieldName,new Date()); So the object I'm assigning to that field is a Date-object, but for some reason it is converted to a String. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: maandag 12 maart 2007 9:40 To: user@struts.apache.org Subject: DynaValidatorForm with java.util.Date Hi I have a form in which a Date is displayed, using fmt. It's static text, so no user input is required. The problem is the following. When the validation of that form fails, you return to that form. Actually, it should return to that form, but you're redirected to the error page. This is the error: 2448020 12 03 09:29 [http-8080-Processor24] ERROR org.apache.struts.util.RequestUtils - javax.servlet.ServletException: BeanUtils.populate javax.servlet.ServletException: BeanUtils.populate The form bean exists of a field, which is hidden, of the type java.util.Date. This is filled by the action, with the correct date. When I look at the source of the page, the date is actually filled in, so that's not the problem. I assume there's a problem with assigning the java.util.Date-type to a field in a DynaValidatorForm, but I'm not sure that's what causing the problem. There's also no validation on that field. Struts-config: form-bean name=ModifyUserForm type=org.apache.struts.validator.DynaValidatorForm form-property name=txtTokenStatus type=java.util.Date / /form-bean Does anybody know how to have
Re: Upgrading to struts 1.3.5, nested tags are broken
On 3/7/07, Lance Semmens [EMAIL PROTECTED] wrote: We are in the process of upgrading to struts 1.3.5, I have followed the upgrade guide at http://wiki.apache.org/struts/StrutsUpgradeNotes12to13. Most of the nested tags now seem to be broken. For example: nested:form action=/someAction nested:iterate property=records id=record type=example.com.Record nested:write property=investor.name / /nested:iterate /nested:form The following exception is thrown: javax.servlet.jsp.JspException: No getter method for property: investor.name of bean: someForm at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:903) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:230) at org.apache.struts.taglib.nested.bean.NestedWriteTag.doStartTag(NestedWriteTag.java:60) It seems as if nested:write / is going to the nested:form / to get investor.name instead of record in nested:iterate / as I would expect. If I change my nested:write / tags to nested:writeNesting / it fixes them. I have looked at the code and writeNesting uses NestedPropertyHelper.getAdjustedProperty() whereas write uses NestedPropertyHelper.setNestedProperties(). nested:define / is broken too, looking at the similarities in all of the nested tags I get the they're all broken in this way. I'm not that familiar with the nested tags - are you saying that you have pages that used these tags and worked in Struts 1.2.x and they no longer do so when upgrading to Struts 1.3.5? Niall Cheers, Lance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form not found for locale en
What version of Struts are you using? From memory I think this was fixed in more recent versions. Niall P.S. Always a good policy to state the version you're talking about On 3/7/07, MC Moisei [EMAIL PROTECTED] wrote: Hello, How do I get rid of the following anying message beside setting the logger to ERROR ? org.apache.commons.validator.ValidatorResources.getForm(ValidatorResources.java:448) - Form 'detailsForm' not found for locale 'en' Thanks, MC - 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: Form not found for locale en
P.S. Also the Commons Validator version? On 3/7/07, Niall Pemberton [EMAIL PROTECTED] wrote: What version of Struts are you using? From memory I think this was fixed in more recent versions. Niall P.S. Always a good policy to state the version you're talking about On 3/7/07, MC Moisei [EMAIL PROTECTED] wrote: Hello, How do I get rid of the following anying message beside setting the logger to ERROR ? org.apache.commons.validator.ValidatorResources.getForm(ValidatorResources.java:448) - Form 'detailsForm' not found for locale 'en' Thanks, MC - 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: [s1] Cancel request parameters and attributes
On 3/6/07, Christopher Schultz [EMAIL PROTECTED] wrote: Niall, Niall Pemberton wrote: You pretty much have it - the point at which the value submtted by the tag is converted to Globals.CANCEL_KEY is in the RequestProcessor's processPopulate() method. I don't see that code, though. See line 800 here: http://tinyurl.com/yqfok2 Having said that, Struts 1.3.5 uses the new ComposableRequestProcessor which replaces all that RequestProcessor functionality with a set of Commands and its taken care of in the Command AbstractPopulateActionForm in the handleCancel() method. I have upgraded to 1.3.5, so I'll check out the handleCancel method. http://tinyurl.com/yt7uky I'm still not sure what the best way to do this is, though. In the interim, I have created a dummyForm that contains no fields and no validation. I use this to force proper cancel handling, because I feel like it is less hacky than overriding Action.isCancelled to check for the JSP-specific parameter name. Any thoughts on that? I haven't looked at doing this, but writing a Command which sets the cancel indicator in the event of there being no ActionForm should be reasonably easy. Niall Thanks, - -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s1] Cancel request parameters and attributes
Chris, You pretty much have it - the point at which the value submtted by the tag is converted to Globals.CANCEL_KEY is in the RequestProcessor's processPopulate() method. Having said that, Struts 1.3.5 uses the new ComposableRequestProcessor which replaces all that RequestProcessor functionality with a set of Commands and its taken care of in the Command AbstractPopulateActionForm in the handleCancel() method. Also I think theres an open Jira ticket for this - but I can't seem to locate it ATM. Niall On 3/5/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 All, [Reposted, as I didn't get a response for 2 months :(] I have two actions in my code that I want to be able to cancel out-of, but neither of them is exciting enough to warrant a form bean and a trip through the validator. I have found that Action.isCancelled does not work when this is the case. A simple hackaround is to do this in my action code: if(super.isCancelled(request) || null != request.getParameter(org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY)) { // handle cancellation } This week, I'm upgrading to struts-1.3.5, which has the taglib JAR separate from the core JAR, which means that I need to drag the taglib JAR along with my upgrade, and I'd prefer not to do so (ignore the fact that I need that JAR file for velocity-tools to work ;) . I figured it's time for me to get to the bottom of this problem, and I'm finding myself getting quite confused reading through the code. First, anyone who looks will note that the name of the cancel button used by the struts form tag library (and the FormTool from velocity-tools's struts tools) get the name org.apache.struts.taglib.html.CANCEL, which is the string value of org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY. So far, so good. Now, to find out how Aciton.isCancelled works. It's pretty simple: it checks for a request attribute: protected boolean isCancelled(HttpServletRequest request) { return (request.getAttribute(Globals.CANCEL_KEY) != null); } The string value for Globals.CANCEL_KEY is org.apache.struts.action.CANCEL, which doesn't match up with that used by the tag libaray. No big deal... it probably gets detected somewhere in the request processor, right? Well, I checked. The RequestProcessor only mentions cancel in the processPopulate method, which delegates some processing to RequestUtils.populate and then checks the request parameters for Globals.CANCEL_KEY (or Globals.CANCEL_KEY_X for image submissions). No luck there, so let's look at RequestUtils.populate. RequestUtils.populate only sets properties on the ActionForm, and doesn't mess with the request. I can't seem to find the place where (under regular circumstances) the request parameter ...taglib.html.CANCEL gets converted into the request attribute Globals.CANCEL. Can someone help me understand how this works? I'd like to do the right thing, here, and I need to understand how struts handles this stuff during form submission so I can get it working when there is no form. Any enlightenment would be appreciated. - -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ApplicationResource.properties file not be read?
It should work - is this exactly how you have things configured - because theres a slight difference in names below - one has an s on the end. Niall On 3/5/07, Peter L. Berghold [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi folks, I've asked this question before, didn't get an answer but I had moved on to other things but I'm back tackling this burp. I have a message resource file that is stored under WEBROOT/WEB-INF/classes/org/bcdc/struts/ApplicationResource.properties I am referencing that file in my struts-config.xml file as such: message-resources parameter=org.bcdc.struts.ApplicationResources / Yet, wherever I'm referencing these message resources the entries seem to be being ignored. Most of where I'm using these resources are in the validation infrastructure. Any thoughts as to where to begin? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator validWhen
On 2/28/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thank you for your reply. Why is it only server-side ? Because no-one has written the equivalent functionality in JavaScript. Validwhen uses antlr to evaluate expressions on the server side - replicating its functionality in JavaScript would be probably be difficult. I think if you were looking to provide that kind of validation for both client and server side then it would be easier to start afresh and not use antlr. Niall [1] http://www.antlr.org/ Regards, Selon Niall Pemberton [EMAIL PROTECTED]: No its server-side only. Niall On 2/27/07, jmpdev [EMAIL PROTECTED] wrote: Hi, I would like to know if it is possible to call validWhen on the client side? I didn't find validWhen.js is it possible to find it somewhere? Thanks, Regards, Jean-Marie. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator validWhen
No its server-side only. Niall On 2/27/07, jmpdev [EMAIL PROTECTED] wrote: Hi, I would like to know if it is possible to call validWhen on the client side? I didn't find validWhen.js is it possible to find it somewhere? Thanks, Regards, Jean-Marie. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sample code for LazyActionForm needed
On 2/23/07, Vikash Manoranjan [EMAIL PROTECTED] wrote: Hi, i want to use LazyActionForm in my program. Kindly provide me with complete sample code like how to use it. http://www.niallp.pwp.blueyonder.co.uk/lazyactionform.html Niall Thanks and Regards, Vikash Manoranjan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Xml utilities
On 2/22/07, Zhang, Larry (L.) [EMAIL PROTECTED] wrote: I am trying to develop some classes used for XML parsing or generating purposes. But I think it is difficult to abstract to write a common utility since each XML document is different, and to parse that document, we should have a different parser. So the question is what utility class will look like so that it abstract some common methods/usage so that all the team members can use the utility class. If you can point me some example, that should be great. http://jakarta.apache.org/commons/digester/ Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: chainConfig importance
On 2/23/07, yuubouna [EMAIL PROTECTED] wrote: Migrating from sruts 1.2.4 to struts 1.3.5 according to http://wiki.apache.org/struts/StrutsUpgradeNotes12to13 StrutsUpgradeNotes12to13 in order for me to use the tiles I must set the chainConfig in web.xml. my questions are: 1. Even If I don`t set the chainConfig in web.xml my application using tiles runs fine, I just changed the Tiles DTD to 1.3.0 and I am using the ff tiles taglib %@ taglib prefix=tiles uri=http://struts.apache.org/tags-tiles% %@ taglib prefix=tiles-el uri=http://struts.apache.org/tags-tiles-el% Struts 1.3.x introduced the new ComposableRequestProcessor (based on Commons Chain) - which is the default unless you have specified the processorClass in a controller element. If tiles is still working then my guess you still have the following defined in your struts-config.xml (and you're not actually using the new ComposableRequestProcessor): controller processorClass=org.apache.struts.tiles.TilesRequestProcessor / You need to remove that entry and add the following to your web.xml init-param param-namechainConfig/param-name param-valueorg/apache/struts/tiles/chain-config.xml/param-value /init-param All this is on the upgrade page though: http://wiki.apache.org/struts/StrutsUpgradeNotes12to13 2. What can I do with chainConfig? I heard about the commands? how can I set up command? Look at the chain configs shipped with struts (they're in the jars). Niall Thanks, yuubouna - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem undeploying struts application
On 2/23/07, Juan Espinosa [EMAIL PROTECTED] wrote: Hi to all… Im having problems with the undeploy of an struts application im using tomcat 5.5.4, when i undeploy the application some jars get locked and i cant delete it…. I search in web and i found the context properties antiResourceLocking and antiJarLocking but it seems that they dont work. Is it related to this: https://issues.apache.org/jira/browse/DIGESTER-29 Niall Any idea of a solutions Regards Juan Espinosa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem undeploying struts application
Its a possible cause is the best I can say. Try replacing the Commons Digester jar with the 1.8 version. Can't remember if that is enough to fix that bug, or if it needs associated changes in Struts/Tiles/Validator/Chain - I'll look into it when I get time. Niall On 2/23/07, Juan Espinosa [EMAIL PROTECTED] wrote: I read the bug but i didnt understand very well I must to replace commons-digester for a new one ?? Is commondigester causing the problem ?? Juan -Mensaje original- De: Niall Pemberton [mailto:[EMAIL PROTECTED] Enviado el: viernes, 23 de febrero de 2007 11:00 Para: Struts Users Mailing List Asunto: Re: Problem undeploying struts application On 2/23/07, Juan Espinosa [EMAIL PROTECTED] wrote: Hi to all… Im having problems with the undeploy of an struts application im using tomcat 5.5.4, when i undeploy the application some jars get locked and i cant delete it…. I search in web and i found the context properties antiResourceLocking and antiJarLocking but it seems that they dont work. Is it related to this: https://issues.apache.org/jira/browse/DIGESTER-29 Niall Any idea of a solutions Regards Juan Espinosa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem undeploying struts application
OK so you are using Struts2? I had assumed Struts1. Have no idea about Struts2 - better to state the version in your mail in future. Niall On 2/23/07, Juan Espinosa [EMAIL PROTECTED] wrote: I do the changes but still the struts2core jar is locked... I change the jar commons-digester, i put the 1.8 version i also put a file named context.xml with the properties: Context reloadable=true antiJARLocking=true antiResourceLocking=true/ Any other sugestion to avoid this situation Juan -Mensaje original- De: Niall Pemberton [mailto:[EMAIL PROTECTED] Enviado el: viernes, 23 de febrero de 2007 11:28 Para: Struts Users Mailing List Asunto: Re: Problem undeploying struts application Its a possible cause is the best I can say. Try replacing the Commons Digester jar with the 1.8 version. Can't remember if that is enough to fix that bug, or if it needs associated changes in Struts/Tiles/Validator/Chain - I'll look into it when I get time. Niall On 2/23/07, Juan Espinosa [EMAIL PROTECTED] wrote: I read the bug but i didnt understand very well I must to replace commons-digester for a new one ?? Is commondigester causing the problem ?? Juan -Mensaje original- De: Niall Pemberton [mailto:[EMAIL PROTECTED] Enviado el: viernes, 23 de febrero de 2007 11:00 Para: Struts Users Mailing List Asunto: Re: Problem undeploying struts application On 2/23/07, Juan Espinosa [EMAIL PROTECTED] wrote: Hi to all… Im having problems with the undeploy of an struts application im using tomcat 5.5.4, when i undeploy the application some jars get locked and i cant delete it…. I search in web and i found the context properties antiResourceLocking and antiJarLocking but it seems that they dont work. Is it related to this: https://issues.apache.org/jira/browse/DIGESTER-29 Niall Any idea of a solutions Regards Juan Espinosa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.18.3/698 - Release Date: 23/02/2007 4:39 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.18.3/698 - Release Date: 23/02/2007 4:39 - 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: Postback forms not working with my tiles configuration
Struts 1.3.x introduced the ComposaleRequestProcessor based on Commons Chain - Post Back forms were only implemented as a Command used by the ComposaleRequestProcessor and not in the original RequestProcessor/TilesRequestProcessor flavours. You are specifying using the TilesRequestProcessor in your struts-config.xml (using the processorClass in the controller element). You need to remove that and specify the tiles chain config instead. Take a look at the 1.2 -- 1.3 upgrade notes on how to do this: http://wiki.apache.org/struts/StrutsUpgradeNotes12to13 Niall On 2/16/07, Smyth, Colm [EMAIL PROTECTED] wrote: Hi All, I'm having problems using Postback forms with my tiles configuration. I am using the html-form.jsp from the examples as my postback form. This is working fine when run from within the examples jar however it fail with the shown below error when placed inside my own struts-config. I have seen a related issue in the Struts JIRA https://issues.apache.org/struts/browse/STR-2935 and have applied the changes to my chain-config.xml Here are the relevant entries in the struts-config form-bean name=testbean type=com.TestBean/ action path=/html-form forward=/pages/jsp/html-form.jsp name=testbean scope=session validate=false/ controller inputForward=true nocache=true processorClass=org.apache.struts.tiles.TilesRequestProcessor bufferSize=4096 / plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml/ set-property property=moduleAware value=true / set-property property=definitions-parser-validate value=true / /plug-in And in the web.xml I start struts with the following servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namechainConfig/param-name param-valuepath to altered chain config/param-value /init-param load-on-startup2/load-on-startup /servlet Could anybody help me out here? Best regards, Colm org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:292) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:998) org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:371) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:548) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) com.paddypower.ams.servlet.filter.LocaleFilter.doFilter(LocaleFilter.java:108) com.paddypower.ams.utils.HibernateFilter.doFilter(HibernateFilter.java:25) com.paddypower.ams.portal.filter.SessionFilter.doFilter(SessionFilter.java:78) root cause java.lang.NullPointerException org.apache.struts.taglib.TagUtils.getActionMappingName(TagUtils.java:571) org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:773) org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:417) org.apache.jsp.pages.jsp.html_002dform_jsp._jspx_meth_html_form_0(html_002dform_jsp.java:260) org.apache.jsp.pages.jsp.html_002dform_jsp._jspService(html_002dform_jsp.java:168) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:292) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:998) org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:371)
Re: Struts taglib HTML 4.01 compliance
RewriteTag - see http://tinyurl.com/yueget FormTag - used in a post - why you would need to append query parameters? LinkTag - should encode the ampersand - can you confirm this and if its not being encoded please post a snip of your JSP showing you usage. Niall On 2/7/07, Liam Brady [EMAIL PROTECTED] wrote: I am using Struts taglib version 1.3.5, but I notice for LinkTag, FormTag, ReWriteTag the parameters in the querystring are being appended with the ampersand unencoded - this is leading to a validation error for HTML 4.01 for example : I have hreftest.jsp?param1=3param2=4 Instead I believe it should be hreftest.jsp?param1=3amp;param2=4 Can somebody tell me if this is correct behaviour? in the taglib documentation there does not seem to be any parameter for encoding - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validating list backed struts form
Specify the property in your form which returns the list of addresses using the indexedListProperty element in your validation.xml - property is then the property of a bean in that list. Something like: form name=Customer field property=city indexedListProperty=addressList depends=required ... /field field property=state indexedListProperty=addressList depends=required ... /field /form Niall On 2/8/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Hi, I am trying to validate a form which has an arraylist of Address objects. I would like some pointers on this or any references etc. Harsh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: type validwhen validation
On 2/9/07, Nathan Coast [EMAIL PROTECTED] wrote: Hi, I have two fields in a form. I believe the validwhen rule executes a specific rule (e.g. required) on field a based upon the value of field b. The situation I have is that I need to execute different validations on field a determined by the value of field b. Yes - theres a validwhen example page in the struts-examples webapp in the binary distro (see the validation module). Is this possible client side with the latest validator framework (1.3.1)? or will I have to implement this functionality in the validate method of the form (server side)? validwhen is server side only. Its also a custom Struts validator - not part of Commons Validator so in that respect the version of Commons Validator is not relevant. Niall cheers Nathan - 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: Validating list backed struts form
On 2/9/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Just tried it out and it does not work. My code look like this: I am using indexted='true' in my JSP file so an element looks like: html:text name=element property=addressLine1 size=20 value= maxlength=35 indexed=true/ The rendered JSP looks like: input type=text name=element[0].addressLine1 maxlength=35 size=20 value=Addr one Usually you would use this within a logic:iterate tag - something like the following where you have a getAddressList() property that returns your list: logic:iterate id=addressList name=form property=addressList html:text name=addressList property=addressLine1/ /logic:iterate By using an id on the iterate tag thats the same as your list property name it then generates the following kind of thing... input type=text name=addressList[0].addressLine1 ... input type=text name=addressList[2].addressLine1 ... My validation XML looks like: form name=AddressForm field property=addressLine1 indexedListProperty=element depends=required msg name=required key=label.error.address.required/ /field /form form name=AddressForm field property=addressLine1 indexedListProperty=addressList depends=required /form Niall Also, keeping in mind that I have 10 address fields which are required only if the fields are visible (it is a show hide kind of thing using JavaScript), is this even a good way to go in my case. Or should I just go ahead and build a custom validator. Harsh. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, February 09, 2007 4:35 AM To: Struts Users Mailing List Subject: Re: Validating list backed struts form Specify the property in your form which returns the list of addresses using the indexedListProperty element in your validation.xml - property is then the property of a bean in that list. Something like: form name=Customer field property=city indexedListProperty=addressList depends=required ... /field field property=state indexedListProperty=addressList depends=required ... /field /form Niall On 2/8/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Hi, I am trying to validate a form which has an arraylist of Address objects. I would like some pointers on this or any references etc. Harsh. - 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: Validating list backed struts form
On 2/9/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Thanks for the tip. I will try this out now. Another question though, is it also possible to attach error messages for each property depending on which property it is. An example would be: form name=Customer field property=city indexedListProperty=addressList depends=required arg0 key=orderform.quantity.label[somethingHere]/ /field /form Basically I want to have the error messages say, City 1 is required or City is required etc. Theres nothing in Struts to do this - but I have an extension that can, availbale here: http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html#indexed Niall I hope I was clear enough in my example. Harsh. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, February 09, 2007 4:35 AM To: Struts Users Mailing List Subject: Re: Validating list backed struts form Specify the property in your form which returns the list of addresses using the indexedListProperty element in your validation.xml - property is then the property of a bean in that list. Something like: form name=Customer field property=city indexedListProperty=addressList depends=required ... /field field property=state indexedListProperty=addressList depends=required ... /field /form Niall On 2/8/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Hi, I am trying to validate a form which has an arraylist of Address objects. I would like some pointers on this or any references etc. Harsh. - 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: type validwhen validation
On 2/9/07, Nathan Coast [EMAIL PROTECTED] wrote: thanks Niall, I've had a look at the examples and I'm not sure they demonstrate what I need. The examples all seem to be simple boolean expressions e.g. field property=address1 depends=validwhen arg key=validWhenForm.address1 / var var-nametest/var-name var-value( (*this* != null) or ( (address2 == null) and ( (city == null) and (zip == null) )))/var-value /var /field I have a select (fieldB) that determines the type of fieldA. So the validation to operate on fieldA depends on the value of fieldB. field property=fieldA depends=validwhen,required arg key=form.fieldA / var var-nametest/var-name var-value ((fieldB == 'java.lang.Integer') validateInteger(fieldA)) || ((fieldB == 'java.lang.Float') validateFloat(fieldA)) || ((fieldB == 'java.util.Date') validateDate(fieldA)) etc /var /field The above looks like JavaScript - because validwhen is server side only. Either way validwhen doesn't cater for doing different types of validation (e.g. integer, float etc) depending on a value. is this possible? I'm thinking not, so a custom validation method is probably what I need. Looks like it Niall cheers Nathan Niall Pemberton wrote: On 2/9/07, Nathan Coast [EMAIL PROTECTED] wrote: Hi, I have two fields in a form. I believe the validwhen rule executes a specific rule (e.g. required) on field a based upon the value of field b. The situation I have is that I need to execute different validations on field a determined by the value of field b. Yes - theres a validwhen example page in the struts-examples webapp in the binary distro (see the validation module). Is this possible client side with the latest validator framework (1.3.1)? or will I have to implement this functionality in the validate method of the form (server side)? validwhen is server side only. Its also a custom Struts validator - not part of Commons Validator so in that respect the version of Commons Validator is not relevant. Niall cheers Nathan - 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: validation help
I don't think you can do this without either a custom validator or as Jim suggests, implementing it in the validate method of your form. Niall On 2/9/07, Jim Reynolds [EMAIL PROTECTED] wrote: It appears you are probably using the ValidatorForm or ValidatorActionForm in 1.x? Just a thought ... could you just implement the validate method in the Action form and handle it with logic? I did some looking, and see that you can validate two fields against each other, but I couldn't find anywhere to do if/else logic in the validation.xml file. Possibly the Struts cookbook may have an example, but I don't have that book here. Maybe someone else on the list may have that. On 2/9/07, fea jabi [EMAIL PROTECTED] wrote: can someone help me with this please. thanks. From: fea jabi [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: validation help Date: Thu, 08 Feb 2007 10:01:01 -0500 Have 2 radio buttons of ID and Name and an input field to enter criteria. When the ID is selected the criteria the user entered should be numeric. Should display the user with the appropriate message that only int value is allowed. When the Name is selected the criteria the user entered should be alphanumeric. Should display appropriate message that only alphanumeric values are allowed. Tried the below it works great for the second option. Not sure how can I join the two conditions. formset form name=search field property=criteria depends=mask msg name=mask key=error.alphanumeric/ arg0 name=mask key=lbl.criteria / var var-namemask/var-name var-value${alpha_numeric}/var-value /var /field /form /formset You help is appreciated. Thanks. _ Laugh, share and connect with Windows Live Messenger http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=hmtagline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Turn searches into helpful donations. Make your search count. http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donationFORM=WLMTAG - 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: Validating list backed struts form
On 2/9/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Thanks for all the tips Niall. Its working to the point that is possible using Struts. Unfortunately, that does not solve my problem. And I cannot use your extension as we have this thing about registered jars here at work. I understand - although it is ASF licensed so you could just grab the source code into your project and do with it whatever you want. Niall I guess a custom validator it is then. Harsh. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, February 09, 2007 9:46 AM To: Struts Users Mailing List Subject: Re: Validating list backed struts form On 2/9/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Thanks for the tip. I will try this out now. Another question though, is it also possible to attach error messages for each property depending on which property it is. An example would be: form name=Customer field property=city indexedListProperty=addressList depends=required arg0 key=orderform.quantity.label[somethingHere]/ /field /form Basically I want to have the error messages say, City 1 is required or City is required etc. Theres nothing in Struts to do this - but I have an extension that can, availbale here: http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html#index ed Niall I hope I was clear enough in my example. Harsh. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, February 09, 2007 4:35 AM To: Struts Users Mailing List Subject: Re: Validating list backed struts form Specify the property in your form which returns the list of addresses using the indexedListProperty element in your validation.xml - property is then the property of a bean in that list. Something like: form name=Customer field property=city indexedListProperty=addressList depends=required ... /field field property=state indexedListProperty=addressList depends=required ... /field /form Niall On 2/8/07, Chaudhary, Harsh [EMAIL PROTECTED] wrote: Hi, I am trying to validate a form which has an arraylist of Address objects. I would like some pointers on this or any references etc. Harsh. - 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: type validwhen validation
On 2/9/07, Nathan Coast [EMAIL PROTECTED] wrote: Hi Niall, thanks again for the quick response. I've been looking at the struts and validator source and have a couple of ideas for a solution to my problem. 1) just create an appropriate validator and execute it. Simpler but doesn't 'feel' as good. IntegerValidator validator = IntegerValidator.getInstance(); Integer fooInteger = validator.validate(fooString, #,##0.00, Locale.GERMAN); if (fooInteger == null) { // error...not a valid Integer return; } 2) get the existing validator for the form and add the appropriate validator, so all of the form validations are executed i.e. from the config and additional validations. Validator validator = Resources.initValidator(validationKey, this, application, request, errors, page); *pseudocode* validator.add(fooBarValidator,..,...,..) validator.validate(); this feels better as the existing framework is responsible for executing all validations, assembling cumulative errors and creating localised messages. I'm just not sure it's possible to add validations. I think I may have to clone form validators so that adding validations to the validator doesn't affect subsequent validations on forms with the same name. As you say option 1 is simple and I guess it depends whether this is a one off or you need to re-use it in more than one place? Assuming the later - you would need to clone since changing the configuration for a set of form validation rules will affect them all. You would also need to set up any custom messages (msg and arg elements) unless a generic message (no label) would do for all. IMO it would be more straight forward to write a custom validator that delegates to the others public static Object validateConditional ( Object bean, ValidatorAction va, Field field, ActionMessages errors, Validator validator, HttpServletRequest request) { if (??? Short ???) { return FieldChecks.validateShort(bean, va, field, errors, validator, request); } else if (??? Integer???) { return FieldChecks.validateInteger(bean, va, field, errors, validator, request); } else if (??? Double???) { return FieldChecks.validateDouble(bean, va, field, errors, validator, request); } else if (??? Date???) { return FieldChecks.validateDate(bean, va, field, errors, validator, request); } else if ... } } That way you could configure messages/arguments in you validation.xml as usual: field property=foo depends=conditional msg name=short key=foo.short.error msg name=integer key=foo.integer.error msg name=double key=foo.double.error msg name=date key=foo.date.error arg0 key=Foo Label resource=false varvar-namedatePatternvar-namevar-valuedd/MM/var-value/var /field Need to remember to configure your conditional validator: validator name=conditional classname=myPackage.MyValidations method=validateConditional methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest depends= msg=default,msg/ Not something I've done though, so just shooting from the hip. Niall any chance you can point me in the right direction before I waste 2 days trying something impossible :) cheers Nathan Niall Pemberton wrote: On 2/9/07, Nathan Coast [EMAIL PROTECTED] wrote: thanks Niall, I've had a look at the examples and I'm not sure they demonstrate what I need. The examples all seem to be simple boolean expressions e.g. field property=address1 depends=validwhen arg key=validWhenForm.address1 / var var-nametest/var-name var-value( (*this* != null) or ( (address2 == null) and ( (city == null) and (zip == null) )))/var-value /var /field I have a select (fieldB) that determines the type of fieldA. So the validation to operate on fieldA depends on the value of fieldB. field property=fieldA depends=validwhen,required arg key=form.fieldA / var var-nametest/var-name var-value ((fieldB == 'java.lang.Integer') validateInteger(fieldA)) || ((fieldB == 'java.lang.Float') validateFloat(fieldA)) || ((fieldB == 'java.util.Date') validateDate(fieldA)) etc /var /field The above looks like JavaScript - because validwhen is server side only. Either way validwhen doesn't cater for doing different types
Re: [JAVA] creating instance of the class
On 2/9/07, temp temp [EMAIL PROTECTED] wrote: I want to create instance of a class using object.getClass().new Instance() but this object constructor needs another object so how can I do this ? Suppose I have a class DefaultMetaInfoHandler default=new DefaultMetaInfo(test); Can I create instance of this class using default.getClass().newInstance() You can't - you have to get hold of the constructor that has the single argument and invoked it. So using your example - a constructor that takes a single String parameter: Class clazz = DefaultMetaInfo.class; Classs[] paramTypes = new Class[] {String.class}; // Get the constructor Constructor ctor = clazz.getConstructor(paramTypes); // Create a new instance Object[] args = new Object[] {test}; DefaultMetaInfoHandler default = (DefaultMetaInfoHandler)ctor.newInstance(args) BeanUtils has convenience methods to do this - including one for a constructor that takes a single argument: http://tinyurl.com/2hgkrm So using BeanUtils al you need to do is: DefaultMetaInfoHandler default = (DefaultMetaInfoHandler) ConstructorUtils.invokeConstructor(DefaultMetaInfo.class, test); Niall If I have to create how ? Thanks Miro - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3.5 and URL Validation
On 1/30/07, Dave Newton [EMAIL PROTECTED] wrote: --- [EMAIL PROTECTED] wrote: Is there anything else that I need to do for URL validation besides declaring in validation.xml? You need to provide more information. ActionForm class, how you're mapping from action = validation (bean name or action name), does any *other* validation on the same page work, etc. Also are you expecting the client side validation to work for this? There is no client URL validation - only sever side. Niall P.S. The struts-examples webapp shipped with 1.3.5 has a type validator form that includes a URL validated field. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.1 security hole?
On 1/9/07, Bruno Melloni [EMAIL PROTECTED] wrote: Yes, I know this is embarassing, but my company still uses Struts 1.1... because of a RAD6 dependency. Somebody just mentioned that there is a security hole in Struts 1.1. When I searched for it, I did find a reference to it in a pre-1.3 discussion, but no details. It seemed to be a vulnerability to a DOS attack. So, the question is: Did the security hole exist? If it did, was it fixed in 1.1 or only in the more recent versions of Struts? There were two Struts 1.2.x releases which fixed security holes (1.2.8 and 1.2.9) - we didn't look at 1.1 so they may or not exist there (my guess is that they probably do). Details and links to the issues are in the release notes for 1.2.8 and 1.2.9 http://struts.apache.org/1.2.9/userGuide/release-notes.html http://struts.apache.org/1.2.9/userGuide/release-notes-1.2.8.html Details of the 1.2.8 issue are here: http://wiki.apache.org/struts/StrutsXssVulnerability Relevant Jira Issue tickets for the 1.2.9 release (we moved from Bugziall to Jira since those releases) are here: https://issues.apache.org/struts/browse/STR-2742 https://issues.apache.org/struts/browse/STR-2765 https://issues.apache.org/struts/browse/STR-2781 Niall Bruno - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action name vs. attribute
On 1/4/07, Edward Song [EMAIL PROTECTED] wrote: Hi all, STRUTS 1.2 Got a quick question on the Action name and attribute properties name - The name of the form bean associated with this action. This value must be the name attribute from one of the form-bean elements. This attribute is optional and has no value. attribute - The name of the request-or session-scope attribute under which the form bean for this action can be accessed. A value is allowed here only if there is a form bean specified in the name attribute. This attribute is optional and has no default value. If both this attribute and the name attribute contain a value, this attribute will take precedence. I have a generic form bean (SearchObjectForm), that I'd like to reuse amongst many actions, along with its validation. form-bean name=SearchObjectForm type=org.apache.struts.validator.DynaValidatorForm !-- properties left out for email -- /form-bean For the form bean above...I have these two actions defined. (Defs are simplified for illustration) action path=/admin/SearchUsers type=com.SearchUsers scope=session attribute=SearchUsersForm name=SearchObjectForm validate=true input=/WEB-INF/jsps/searchUsers.jsp forward name=success path=/WEB-INF/jsps/pages/admin/searchUsers.jsp/ /action action path=/admin/SearchSubs type=com.SearchSubs scope=session attribute=SearchSubsForm name=SearchObjectForm validate=true input=/WEB-INF/jsps/searchSubs.jsp forward name=success path=/WEB-INF/jsps/pages/admin/searchSubs.jsp/ /action Now when I execute these actions, the validation that is called uses the validation key SearchUsersForm or SearchSubsForm, and upon not finding those form beans, actually does not validate anything. My expectations were to have it use the name property of the action to access the form bean and necessary validation, and then use the attribute to store the Form Bean within the request or session. Thereby, reusing the form bean defintion and validation and having the ability to access the form with the attribute name, within the action. However, as this is not the case, I set the validation key to the form name and call validate in the action (Not what I want to do). Is there another way to reuse the form bean defintion and its validation, and have Struts automatically store the form into the request or session using the attribute field? Any guidance, on how to more effectively approach this problem would be appreciated Thanks in advance. One solution would be to create your own DynaValidatorForm implementation and override the getValidationKey() method to use the name rather than attribute. Personally I haven't actually ever used the attribute configuration option and so name == attribute is always true for me so whether there are other side effects I'm not sure - but give it a go and see if it works for you: public class MyDynaValidatorForm extends DynaValidatorForm { public String getValidationKey(ActionMapping mapping, HttpServletRequest request) { return mapping.getName(); } } Another solution would be to upgrade to the latest Validator version (1.3.1) - from Validator 1.2.0 onwards there is an extends attribute where rules can inherit. That way you could re-use rules for one form under a different name - which means you wouldn't have to duplicate them in you validation.xml, so you could have something like the following: form name=SearchObjectForm ... /form form name=SearchSubsForm extends=SearchObjectForm ... /form http://jakarta.apache.org/commons/validator/ http://wiki.apache.org/jakarta-commons/ValidatorVersion120 The only thing about upgrading to Validator 1.3.1 is that you would need to use the new DTD and the arg0-arg3 elements have been removed and would need replacing with arg elements. Otherwise Validator 1.3.1 is compatible with Struts 1.2.9 Niall Ed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: InvalidCancelException
Is tiles using an action to render the view - looks that way from the stack trace. Niall On 12/28/06, Hehl, Thomas [EMAIL PROTECTED] wrote: We just upgraded to struts 1.2.9 and started getting this message when I pressed the cancel button. I fixed it once before, but it's popped up on another screen. So I went through the docs again and did as they instructed, but the problem continues. Here's the problem code: action path=/deferTruth type=org.springframework.web.struts.DelegatingActionProxy name=DeferForm validate=true input=defer.start set-property property=cancellable value=true/ forward name=success path=defer.truth/ forward name=skip path=/do/deferProcess/ exception key=errors.cancel type=org.apache.struts.action.InvalidCancelException path=/do/workflowMgr?flowName=showStatus/ /action action path=/deferTruthProcess type=com.acs.gs.eJuror.web.actions.BaselineTruthProcessAction name=DeferForm validate=false set-property property=cancellable value=true/ forward name=success path=/do/deferProcess/ forward name=cancel path=/do/workflowMgr?flowName=showStatus/ exception key=errors.cancel type=org.apache.struts.action.InvalidCancelException path=/do/workflowMgr?flowName=showStatus/ /action /deferTruth displays the JSP from defer.truth that possesses the cancel button. The action for the form points to /deferTruthProcess. Does anyone know why this error persists? Thanks. org.apache.struts.action.InvalidCancelException org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.j ava:942) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10 85) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcesso r.java:263) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces sor.java:398) org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequ estProcessor.java:318) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10 85) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcesso r.java:263) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces sor.java:398) org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequ estProcessor.java:318) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) com.acs.gs.eJuror.web.servlet.SecurityFilter.doFilter(SecurityFilter.java:85 ) Thom Hehl Software Engineer, Juror Solutions * Office (859) 277-8800 x 144 * Cell (419) 788-0642 * [EMAIL PROTECTED] ACS, Inc. Government Solutions 1733 Harrodsburg Road Lexington, KY 40504-3617 This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and notify sender via e-mail at [EMAIL PROTECTED] or by telephone at 859-277-8800 ext. 144. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Version Question Pre 2.0
On 12/21/06, Jim Reynolds [EMAIL PROTECTED] wrote: Are there major differences between 1.24 and 1.29? I am having lots of validation problems, and problems with the SSLExt in the 1.29 when I am trying to migrate. I read the docs, but do not see any major changes that would cause this? Remember to upgrade the validator-rules.xml to the one shipped with Struts 1.2.9 - which is almost certainly the cause of the error you posted in another thread. Notes on upgrading are here - you need to look at all the changes since 1.2.4 http://wiki.apache.org/struts/StrutsUpgrade Niall Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic:messagesPresent ???
On 12/21/06, A. Lotfi [EMAIL PROTECTED] wrote: Hi, I am still confused about messagesPresent , I don't know why we use it , for example I found this example : You use it to render something if errors/messages are present. Look at the second example here: http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section2 Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator Framework 1.29
On 12/20/06, Jim Reynolds [EMAIL PROTECTED] wrote: Hello, I am having some issues with getting the messages from the validator framework from showing. Actually, I have some old code like this: logic:messagesPresent html:messages id=error font class=errorc:out value=${error}/br/font /html:messages /logic:messagesPresent that used to work, before upgrading to 1.29. I am getting this error: ccording to TLD or attribute directive in tag file, attribute value does not accept any expressions (I posted this earlier with no response). So its objecting to a run time expression in your c:out tag - thats JSTL not Struts or validator - but I don't think you need it anyway, can't you just use c:out value=error/ or bean:write name=errror/ Then I am reading through Struts in Action book and they show this type of error handling in the jsp page. logic:messagesPresent logic:messages id=error bean:write name=error / /validator:messages /validator:messagesPresent with a import of this tld. uri=/tags/struts-validator prefix=validator % Anyway, now I am confused and not sure which is the best approach to follow. Also, I cannot find the tld for struts-validator? I checked the struts jar for a tld, but did not find one, and I checked the commons-validator.jar and did not find it there. I don't mind using second one from book, but where is tld? There are no validator jsp tags in Struts or Commons Validator - so no TLD to go with it. Niall Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionMessages not displaying
Try changing to use the name attribute instead of property on the messagesPresent and messages tags: logic:messagesPresent message=true name=addTaskMessages html:messages name=addTaskMessages message=true id=addtasksuccess bean:write name=addtasksuccess/br/ /html:messages /logic:messagesPresent Niall On 12/19/06, Kranti [EMAIL PROTECTED] wrote: I am trying to get the action messages from action class as follows but not getting the message but record is inserted properly *in action class* if(isInserted==true){ ActionMessages addTaskMessages = new ActionMessages(); addTaskMessages.add(addtasksuccess, new ActionMessage( message.addtask.sucess)); saveMessages(httpservletrequest, addTaskMessages); } *in jsp* logic:messagesPresent message=true property=addTaskMessages html:messages property=addTaskMessages message=true id=addtasksuccess bean:write name=addtasksuccess/br/ /html:messages /logic:messagesPresent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Chains - 1.3.5
On 12/19/06, Joseph McGranaghan [EMAIL PROTECTED] wrote: Solved my problem: ActionContext ac = (ActionContext)context; ac.setForwardConfig(new ActionForward(/myaction.do)); If anyone has a cleaner, non-hardcoded my, I'm all ears! Can you not just do this as one action mapping and specify the forward on the action? action path=/myaction scope=request catalog=mycatalog command=mychain forward=tile.myaction /action Niall Thanks, Joe Joseph McGranaghan wrote: This should be simple, but for the life of me I can't get find the answer. All I want to do is have a chain execute and then go to an action forward Right now it goes through the chain and outputs a blank web page with no source code at all. struts-config: action path=/preprocess_myaction scope=request catalog=mycatalog command=mychain forward name=myaction path=/myaction.do / /action action path=/myaction forward=tile.myaction / chain-config: ?xml version=1.0 ? catalog name=mycatalog chain name=mychain command id=GetSomethingAndPutInRequest className=com.draegoonZ.GetSomethingAndPutInRequest / /chain /catalog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: read/display image from Database using struts
Alternatively you could use a download action: http://wiki.apache.org/struts/StrutsFileDownload Niall On 12/18/06, Dariusz Wojtas [EMAIL PROTECTED] wrote: Custom servlet which retrieves data from DB, writes it to the output stream. It should define correct headers first (mimeType, Expires, Date). Map it to some url like /images/* and you may pass identifiers by composing URLs like /images/myID.jpg Dariusz Wojtas On 12/18/06, Kranti [EMAIL PROTECTED] wrote: Hi, How should I read/display image from Database...which is stored interms of bytes in the Database. Please suggest me some way to render the image in JSP. - 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: ActionMessages
If you use the saveMessages() method in your Action (rather than saveErrors() method) then you need to use the message=true attribute in the jsp tags: logic:messagesPresent property=addTaskMessages message=true html:messages property=addTaskMessages message=true id=addtasksuccess bean:write name=addtasksuccess/br/ /html:messages /logic:messagesPresent Niall On 12/14/06, Kranti [EMAIL PROTECTED] wrote: thanks for the info i am trying the following In Action Class: ActionMessages addTaskMessages = new ActionMessages(); addTaskMessages.add(addtasksuccess, new ActionMessage( message.addtask.sucess)); saveMessages(request, addTaskMessages); IN JSP logic:messagesPresent property=addTaskMessages html:messages property=addTaskMessages id=addtasksuccess bean:write name=addtasksuccess/br/ /html:messages /logic:messagesPresent same for ActionErrors, On 12/14/06, nagesh.kumar [EMAIL PROTECTED] wrote: This will work u logic:messagesPresent table align=center border=0 tr td UL html:errors/ html:messages id=msg message=true li class=error_messagebean:write name=msg //li /html:messages /UL /td /tr /tablebr / /logic:messagesPresent Thanks Nagesh -Original Message- From: Kranti [mailto:[EMAIL PROTECTED] Sent: Thursday, December 14, 2006 11:03 AM To: Struts Users Mailing List Subject: ActionMessages hi, can anyone tell how * ActionMessages can be used in struts along with html:message tag * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]