You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2005/08/18 23:57:06 UTC
svn commit: r233386 - in /myfaces: examples/trunk/sandbox/
examples/trunk/simple/src/java/org/apache/myfaces/examples/resource/
examples/trunk/simple/src/java/org/apache/myfaces/examples/validate/
forrest/trunk/content/xdocs/ forrest/trunk/content/xdoc...
Author: schof
Date: Thu Aug 18 14:57:01 2005
New Revision: 233386
URL: http://svn.apache.org/viewcvs?rev=233386&view=rev
Log:
Fixes MYFACES-372 (Patch by Fabian Frederick)
Added:
myfaces/examples/trunk/sandbox/validateUrl.jsp
myfaces/forrest/trunk/content/xdocs/tomahawk/validateUrl.xml
Modified:
myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/resource/example_messages.properties
myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/validate/ValidateForm.java
myfaces/forrest/trunk/content/xdocs/site.xml
Added: myfaces/examples/trunk/sandbox/validateUrl.jsp
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/sandbox/validateUrl.jsp?rev=233386&view=auto
==============================================================================
--- myfaces/examples/trunk/sandbox/validateUrl.jsp (added)
+++ myfaces/examples/trunk/sandbox/validateUrl.jsp Thu Aug 18 14:57:01 2005
@@ -0,0 +1,100 @@
+<%@ page import="java.math.BigDecimal,
+ java.util.Date"%>
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
+<html>
+
+<%@include file="inc/head.inc" %>
+
+<!--
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//-->
+
+<body>
+
+<!--
+managed beans used:
+ validateForm
+-->
+
+<f:view>
+
+ <f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var="example_messages"/>
+
+ <h:panelGroup id="body">
+
+ <h:form id="form1" name="validateForm">
+ <h:panelGrid columns="3">
+
+ <h:outputLabel for="email" value="#{example_messages['validate_email']}" />
+ <h:inputText id="email" value="#{validateForm.email}" required="true">
+ <f:validator validatorId="org.apache.myfaces.validator.Email"/>
+ </h:inputText>
+ <x:message id="emailError" for="email" styleClass="error" />
+
+ <h:outputLabel for="email2" value="#{example_messages['validate_email']}2" />
+ <h:inputText id="email2" value="#{validateForm.email2}" required="true">
+ <x:validateEmail />
+ </h:inputText>
+ <x:message id="emailError2" for="email2" styleClass="error" />
+
+ <h:outputLabel for="creditCardNumber" value="#{example_messages['validate_credit']}" />
+ <h:inputText id="creditCardNumber" value="#{validateForm.creditCardNumber}" required="true">
+ <x:validateCreditCard />
+ </h:inputText>
+ <x:message id="creditCardNumberError" for="creditCardNumber" styleClass="error" />
+
+ <h:outputLabel for="url" value="#{example_messages['validate_url']}" />
+ <h:inputText id="url" value="#{validateForm.url}" required="true">
+ <s:validateUrl id="org.apache.myfaces.validator.Url"/>
+ </h:inputText>
+ <x:message id="urlError" for="url" styleClass="error" />
+
+ <h:outputLabel for="regExprValue" value="#{example_messages['validate_regexp']}" />
+ <h:inputText id="regExprValue" value="#{validateForm.regExpr}" required="true">
+ <x:validateRegExpr pattern='\d{5}' />
+ </h:inputText>
+ <x:message id="regExprValueError" for="regExprValue" styleClass="error" />
+
+ <h:outputLabel for="equal" value="#{example_messages['validate_equal']}" />
+ <h:inputText id="equal" value="#{validateForm.equal}" required="true"/>
+ <x:message id="equalError" for="equal" styleClass="error" />
+
+ <h:outputLabel for="equal2" value="#{example_messages['validate_equal']}2" />
+ <h:inputText id="equal2" value="#{validateForm.equal2}" required="true">
+ <x:validateEqual for="equal" />
+ </h:inputText>
+ <x:message id="equal2Error" for="equal2" styleClass="error" />
+
+ <h:panelGroup/>
+ <h:commandButton id="validateButton" value="#{example_messages['button_submit']}" action="#{validateForm.submit}"/>
+ <h:panelGroup/>
+
+ </h:panelGrid>
+ </h:form>
+
+ </h:panelGroup>
+
+</f:view>
+
+<%@include file="inc/page_footer.jsp" %>
+
+</body>
+
+</html>
Modified: myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/resource/example_messages.properties
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/resource/example_messages.properties?rev=233386&r1=233385&r2=233386&view=diff
==============================================================================
--- myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/resource/example_messages.properties (original)
+++ myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/resource/example_messages.properties Thu Aug 18 14:57:01 2005
@@ -111,6 +111,7 @@
validate_email = Email
validate_credit = Credit Card
+validate_url = Url
validate_regexp = Regular Expression
validate_equal = Equal
@@ -172,4 +173,4 @@
crosstable_field_column=column label
crosstable_add_column=add a column
crosstable_remove_column=remove the column
-crosstable_save_values=save values
\ No newline at end of file
+crosstable_save_values=save values
Modified: myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/validate/ValidateForm.java
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/validate/ValidateForm.java?rev=233386&r1=233385&r2=233386&view=diff
==============================================================================
--- myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/validate/ValidateForm.java (original)
+++ myfaces/examples/trunk/simple/src/java/org/apache/myfaces/examples/validate/ValidateForm.java Thu Aug 18 14:57:01 2005
@@ -24,6 +24,7 @@
private String email = null;
private String email2 = null;
private String creditCardNumber = null;
+ private String url = null;
private String regExpr = null;
private String equal = null;
@@ -48,9 +49,14 @@
public String getCreditCardNumber() {
return creditCardNumber;
}
-
+ public String getUrl(){
+ return url;
+ }
public void setCreditCardNumber(String string) {
creditCardNumber = string;
+ }
+ public void setUrl(String string) {
+ url = string;
}
public String getEmail2() {
Modified: myfaces/forrest/trunk/content/xdocs/site.xml
URL: http://svn.apache.org/viewcvs/myfaces/forrest/trunk/content/xdocs/site.xml?rev=233386&r1=233385&r2=233386&view=diff
==============================================================================
--- myfaces/forrest/trunk/content/xdocs/site.xml (original)
+++ myfaces/forrest/trunk/content/xdocs/site.xml Thu Aug 18 14:57:01 2005
@@ -130,6 +130,7 @@
<validators href="tomahawk/" label="Validators" tab="tomahawk">
<validateCreditCard label="validateCreditCard" href="validateCreditCard.html"/>
+ <validateUrl label="validateUrl" href="validateUrl.html"/>
<validateEmail label="validateEmail" href="validateEmail.html"/>
<validateEqual label="validateEqual" href="validateEqual.html"/>
<validateRegExpr label="validateRegExpr" href="validateRegExpr.html"/>
Added: myfaces/forrest/trunk/content/xdocs/tomahawk/validateUrl.xml
URL: http://svn.apache.org/viewcvs/myfaces/forrest/trunk/content/xdocs/tomahawk/validateUrl.xml?rev=233386&view=auto
==============================================================================
--- myfaces/forrest/trunk/content/xdocs/tomahawk/validateUrl.xml (added)
+++ myfaces/forrest/trunk/content/xdocs/tomahawk/validateUrl.xml Thu Aug 18 14:57:01 2005
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+
+<!--
+This is a standard template meant to be used for the documentation of all custom
+components.
+-->
+<document>
+ <!-- component name -->
+ <header>
+ <!-- ex. JSCook Menu -->
+ <title>Validate an Url</title>
+ <!-- ex. <x:jsCookMenu> -->
+ <subtitle><x:validateUrl/></subtitle>
+ </header>
+ <body>
+ <!-- Description -->
+ <section>
+ <title>Description</title>
+ <p>
+ A validator for url
+ </p>
+ </section>
+ <!-- Screen Shot -->
+
+ <!-- API -->
+ <section>
+ <title>API</title>
+ <table>
+ <tr>
+ <td>since</td>
+ <td>1.0.10</td>
+ </tr>
+ <tr>
+ <td>author</td>
+ <td>FabF (based on email validator by Matthias Wessendorf)</td>
+ </tr>
+ <tr>
+ <td>validatorId</td>
+ <td>org.myfaces.validator.Url</td>
+ </tr>
+ <tr>
+ <td>component-class</td>
+ <td>org.apache.myfaces.custom.urlvalidator.UrlValidator</td>
+ </tr>
+ <tr>
+ <td>tag-class</td>
+ <td>org.apache.myfaces.custom.urlvalidator.ValidateUrlTag</td>
+ </tr>
+ </table>
+ </section>
+ <!-- Usage -->
+ <section>
+ <title>Usage</title>
+ <source>
+<h:inputText id="urlNumber"
+ value="#{validateForm.urlNumber}"
+ required="true">
+ <x:validateurl />
+</h:inputText>
+ </source>
+ </section>
+ <!-- Syntax -->
+ <section>
+ <title>Syntax</title>
+ <note label="<x:validateUrl/>">
+
+ </note>
+ </section>
+ <!-- Instructions -->
+ <section>
+ <title>Instructions</title>
+ <p>
+ ...
+ </p>
+ <p>See "examples/validate.jsp" for an example!</p>
+ </section>
+ </body>
+ <footer>
+ <legal>Java, J2EE, and JCP are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.<br />
+ © 2004 - 2005, Apache Software Foundation
+ </legal>
+ </footer>
+
+</document>