cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John L. Webber" <>
Subject Re: XSP Validation XSP-formval
Date Fri, 20 Feb 2004 08:01:02 GMT

You're better off using a DateFormat object to parse the request 
parameter instead of the deprecated new Date(String). Then you can catch 
a ParseException and take action based on this. You can instantiate a 
SimpleDateFormat object using a pattern matching the input you expect.

If the XSP is an action, you can use xsp-action:set-success and 
xsp-action:set-failure to communicate the result to the sitemap.


Anna Bikkina wrote:

>I have another question using XSP form validation. I used XSP-formval using 
>the descriptor file and it worked.
> Now there are some other validations that I have to do and display errors 
>other than what I can do with the descriptor file. Like I have to check the 
>startdate and enddate entered by user and display error if startdate is after 
>the enddate and things like that.  I created a xsp logic tag and did the 
>necessary validations but I am getting error while running the xsp file
>error is :
>org.apache.cocoon.ProcessingException: Failed to execute pipeline.: 
>java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Exception 
>in ServerPagesGenerator.generate(): java.lang.IllegalArgumentException
>the xsp:logic paragraph that I add looks like this 
>           			if(notnew) {
>           				System.out.println("entering into not new");
>           				Date sd = new Date(request.getParameter("startdate"));
>           				Date ed = new Date(request.getParameter("enddate"));
>           				if(sd==null)
>           					sd= new Date();
>           				if(ed==null)
>           					ed=new Date();
>           				if(sd.after(new Date())){
>							System.out.println("Start date is greater than today");
>           					<font color="red">
>         						<xsp:text>* Startdate invalid. Date greater than today</
>			   				</font>
>			   				bad=true;
>			   			} 
>           				else if(ed.after(new Date())){
>           					<font color="red">
>         						<xsp:text>* Enddate invalid. Date greater than today</xsp:text>
>			   				</font>
>			   				bad=true;
>           				}           		         				
>           			}
>           		</xsp:logic>
>Is there a way I can check errors in the input other than the formvalidation 
>method. I understand that I can write multiple action classes for each of the 
>error I can represent but from there how can I come back to the same file 
>with the error messages.
 Jentro Technologies GmbH
 John L. Webber, Software Development
 Rosenheimer Str. 145e	    81671 M√ľnchen
 Tel. +49 89 189 169 80 
 Fax  +49 89 189 169 99

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message