Validator classes and validator-rules.xml
I'm getting an odd exception: 2004-03-08 11:19:41,405 ERROR [org.apache.commons.validator.Validator] reflection: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest) java.lang.NoSuchMethodException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest) at java.lang.Class.getMethod(Class.java:978) at org.apache.commons.validator.Validator.executeValidationMethod(Validator.java:501) at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:424) at org.apache.commons.validator.Validator.validateField(Validator.java:669) at org.apache.commons.validator.Validator.validate(Validator.java:745) at org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:150) The parameter list shown in the NoSuchMethodException appears to match the validator-rules.xml file: validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest msg=errors.required/ apart from the fourth parameter (ActionMessages vs ActionErrors) but this is probably OK since ActionErrors is a subclass of ActionMessages. This parameter list also matches the javadoc. NB: This is the Nightly Build binary download !!! I can't recall why - just that I had a bug in the stable build that was fixed in the nightly's. However - I've just changed from the old nightly to 20040306 (20040307 seems to be 163 bytes long) to test - and the same problem with validation occurs. Any hints anyone? -- Chris Searle [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Migration of a servlet that uses pathinfo to struts
We have a old servlet that is used to expose a set of directories (with various checks for access etc). This is based on the use of request.getPathInfo() and the servlet has a servlet mapping of /files/* http://server/app/files/path/to/file returns a path info of /files/path/to/file Now - the app is being migrated to the struts framework - and I'm not sure how best to approach this. I have tried creating a struts action with a path=files/* and this is working for: http://server/app/do/files/filename.ext Pathinfo read from the request in the action execute method contains /files/filename.ext However http://server/app/do/files/path/filename.ext returns a 500 error and 2003-11-17 10:57:59,447 ERROR [org.apache.struts.action.RequestProcessor] Invalid path /files/path/ was requested in the log. I know that I can switch over to using a request parameter but I'd like to avoid that if possible. Is this possible? I did try some searching in the archives - but I guess I'm not good at phrasing the search string - so - any links to a previous answer would also be great. Many thanks. -- Chris Searle - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Migration of a servlet that uses pathinfo to struts
F. == Firat TIRYAKI [EMAIL PROTECTED] writes: F. I think you should manage this situation in the web.xml, don't F. include it in struts action servlet, just run it stand alone. This is of course possible. The only problem is that if the servlet is provided a directory then it should produce a page with file and sub-dir links in it. I had hoped that it would be possible to use the same tiles files for this as the rest of the system - and these require that we go thru a customized action servlet (set's up a user based menu tile amongst other things). Regards -- Chris Searle - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts-el and messages
OK, Had the problem with using the html:messages with struts-el from the 1.1RC1 build (NullPointerException) - so I've just upgraded to 1.1 (thought I'd already done so). Now - I get no exception - but I get no message either. The servlet code: ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(message.login.failed)); saveErrors(request, errors); forward=mapping.findForward(loginfailed); And in the jsp (note - this is using tiles - so the rest of the tags (html etc) are not in this file: %@ taglib uri=/struts-html-el.tld prefix=html% %@ taglib uri=/struts-logic-el.tld prefix=logic% %@ taglib uri=/c.tld prefix=c% logic:messagesPresent html:messages id=error p class=errorc:out value=${error}//p /html:messages /logic:messagesPresent I am getting sent to the loginfailed mapping - but the message is not displayed - no p class=error tags in the HTML at all. It must be something stupid on my part - this looks to me to be the same as examples out on the net and in the docs. Any hints welcome :-) -- Chris Searle [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts-el and messages
Chris == Chris Searle [EMAIL PROTECTED] writes: Had the problem with using the html:messages with struts-el from the 1.1RC1 build (NullPointerException) - so I've just upgraded to 1.1 (thought I'd already done so). Now - I get no exception - but I get no message either. Got it. The forward was set redirect=true so of course the messages disappeared. However - we do have a couple of (odd) places where a redirect is desired but keeping the messages - is this possible? Can they be propagated over a redirect by use of session or similar? -- Chris Searle [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts-el and messages
Steve == Steve Raeburn [EMAIL PROTECTED] writes: The nightly build has a method that allows you to store messages in the session. They are automatically removed after being displayed. Action: protected void saveMessages(HttpSession session, ActionMessages messages) Looks interesting (thinking about it - yes - we only need messages and not errors after a redirect). Just downloaded the nightly and installed it. ActionMessages messages = new ActionMessages(); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(message.login.succeeded)); saveMessages(session, messages); Compiles and runs OK. And the message code JSP: logic:messagesPresent message=true html:messages id=message message=true p class=messagec:out value=${messsge}//p /html:messages /logic:messagesPresent Nothing displays. Does this have to change to use the session messges object? So - summary: 1) Errors are working (request scope) 2) Messages are not working (session scope) with the nightly dated 16.10.2003. -- Chris Searle [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts-el and messages
Chris == Chris Searle [EMAIL PROTECTED] writes: And the message code JSP: logic:messagesPresent message=true html:messages id=message message=true p class=messagec:out value=${messsge}//p /html:messages /logic:messagesPresent Nothing displays. Sent that a bit too fast. Think that : c:out value=${messsge}/ would benefit by being: c:out value=${message}/ :-) -- Chris Searle [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]