You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2008/11/06 10:50:47 UTC

svn commit: r711814 - in /myfaces/extensions/validator/branches/jsf_1.1/examples: ./ hello_jpa/ hello_world/src/main/java/org/apache/myfaces/blank/ hello_world/src/main/java/org/apache/myfaces/blank/domain/ hello_world/src/main/webapp/

Author: gpetracek
Date: Thu Nov  6 01:50:41 2008
New Revision: 711814

URL: http://svn.apache.org/viewvc?rev=711814&view=rev
Log:
merged examples

Added:
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
Removed:
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_jpa/
Modified:
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/page2.jsp
    myfaces/extensions/validator/branches/jsf_1.1/examples/pom.xml

Modified: myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java?rev=711814&r1=711813&r2=711814&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java Thu Nov  6 01:50:41 2008
@@ -18,7 +18,7 @@
  */
 package org.apache.myfaces.blank;
 
-import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+import org.apache.myfaces.blank.domain.Person;
 
 /**
  * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
@@ -26,10 +26,7 @@
  */
 public class HelloWorldController
 {
-
-    //properties
-    @Required
-    private String name;
+    private Person person = new Person();
 
     /**
      * default empty constructor
@@ -38,17 +35,6 @@
     {
     }
 
-    //-------------------getter & setter
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
     /**
      * Method that is backed to a submit button of a form.
      */
@@ -57,4 +43,14 @@
         //do real logic, return a string which will be used for the navigation system of JSF
         return "success";
     }
-}
+
+    public Person getPerson()
+    {
+        return person;
+    }
+
+    public void setPerson(Person person)
+    {
+        this.person = person;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java?rev=711814&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java Thu Nov  6 01:50:41 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.myfaces.blank.domain;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+import javax.persistence.Column;
+
+public class Person
+{
+    //hello world demo
+    @Required
+    private String firstName;
+
+    //demo for jpa based validation support
+    @Column(nullable = false, length = 10 /*...*/)
+    private String lastName;
+
+    public String getFirstName()
+    {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName)
+    {
+        this.firstName = firstName;
+    }
+
+    public String getLastName()
+    {
+        return lastName;
+    }
+
+    public void setLastName(String lastName)
+    {
+        this.lastName = lastName;
+    }
+}

Modified: myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp?rev=711814&r1=711813&r2=711814&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp Thu Nov  6 01:50:41 2008
@@ -8,9 +8,13 @@
         <f:view>
             <h:form id="mainForm">
               <h:panelGrid columns="3">
-                <h:outputLabel for="name" value="Please enter your name" />
-                <h:inputText id="name" value="#{helloWorld.name}"/>
-                <h:message for="name" showSummary="true" showDetail="false"/>
+                <h:outputLabel for="first_name" value="First name:"/>
+                <h:inputText id="first_name" value="#{helloWorld.person.firstName}"/>
+                <h:message for="first_name" showSummary="true" showDetail="false"/>
+
+                <h:outputLabel for="last_name" value="Last name:"/>
+                <h:inputText id="last_name" value="#{helloWorld.person.lastName}"/>
+                <h:message for="last_name" showSummary="true" showDetail="false"/>
 
                 <h:commandButton value="Press me" action="#{helloWorld.send}"/>
                 <h:panelGroup/>

Modified: myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/page2.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/page2.jsp?rev=711814&r1=711813&r2=711814&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/page2.jsp (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/page2.jsp Thu Nov  6 01:50:41 2008
@@ -7,7 +7,7 @@
     <body>
         <f:view>
             <h:form id="mainForm">
-                <h2><h:outputText value="Hello #{helloWorld.name}. We hope you enjoy Apache MyFaces"/></h2>
+                <h2><h:outputText value="Hello #{helloWorld.person.firstName} #{helloWorld.person.lastName}. We hope you enjoy Apache MyFaces Extensions Validator!"/></h2>
                 <h:commandLink action="back">
                     <h:outputText value="Home"/>
                 </h:commandLink>

Modified: myfaces/extensions/validator/branches/jsf_1.1/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/pom.xml?rev=711814&r1=711813&r2=711814&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/pom.xml (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/pom.xml Thu Nov  6 01:50:41 2008
@@ -52,7 +52,6 @@
 
     <modules>
         <module>hello_world</module>
-        <module>hello_jpa</module>
         <module>feature-set_01</module>
     </modules>