1. opensymphony
  2. webwork

Commits

rgielen  committed 271f17e

Issue number: WW-1262
Obtained from:
Submitted by:
Reviewed by:
o Fixing reported errors
o more - though not complete - i18n for employee stuff

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@2538573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits 7923d62
  • Branches master

Comments (0)

Files changed (6)

File webapps/showcase/src/java/com/opensymphony/webwork/showcase/action/EmployeeAction-validation.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
+<validators>
+    <!-- Field-Validator Syntax -->
+    <field name="currentEmployee.empId">
+        <field-validator type="required">
+            <message key="employee.id.required"/>
+        </field-validator>
+    </field>
+    <field name="currentEmployee.lastName">
+        <field-validator type="requiredstring">
+            <param name="trim">true</param>
+            <message key="employee.lastName.required"/>
+        </field-validator>
+    </field>
+    <field name="currentEmployee.birthDate">
+        <field-validator type="required">
+            <message key="employee.birthDate.required"/>
+        </field-validator>
+    </field>
+</validators>

File webapps/showcase/src/java/com/opensymphony/webwork/showcase/action/EmployeeAction.properties

View file
  • Ignore whitespace
+employee=Employee
+employee.firstName=First Name
+employee.lastName=Last Name
+employee.description=Description
+
+employee.id.required=Last Name is required
+employee.lastName.required=Last Name is required
+employee.birthDate.required=Birthdate is required
+employee.backtolist=Back to Employee List

File webapps/showcase/src/java/com/opensymphony/webwork/showcase/action/EmployeeAction_de.properties

View file
  • Ignore whitespace
+employee=Mitarbeiter    
+employee.firstName=Vorname
+employee.lastName=Nachname
+employee.description=Beschreibung
+
+employee.id.required=ID mu� angegeben werden
+employee.lastName.required=Nachname wird ben�tigt
+employee.birthDate.required=Geburtsdatum wird ben�tigt
+employee.backtolist=Zur�ck zur Mitarbeiterliste

File webapps/showcase/src/webapp/WEB-INF/classes/xwork.xml

View file
  • Ignore whitespace
 
         <action name="list" class="com.opensymphony.webwork.showcase.action.EmployeeAction" method="list">
             <result>/empmanager/listEmployees.jsp</result>
+            <interceptor-ref name="basicStack"/>
         </action>
         <action name="edit" class="com.opensymphony.webwork.showcase.action.EmployeeAction">
             <result>/empmanager/editEmployee.jsp</result>
+            <interceptor-ref name="crudStack"><param name="validation.excludeMethods">execute</param></interceptor-ref>
         </action>
         <action name="save" class="com.opensymphony.webwork.showcase.action.EmployeeAction" method="save">
-            <result name="error">/empmanager/editEmployee.jsp</result>
+            <result name="input">/empmanager/editEmployee.jsp</result>
             <result type="redirect">edit.action?empId=${currentEmployee.empId}</result>
         </action>
         <action name="delete" class="com.opensymphony.webwork.showcase.action.EmployeeAction" method="delete">

File webapps/showcase/src/webapp/empmanager/editEmployee.jsp

View file
  • Ignore whitespace
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
 <ww:if test="currentEmployee!=null">
-    <ww:set name="title" value="'Edit Employee'"/>
+    <ww:text id="title" name="item.edit"><ww:param><ww:text name="employee"/></ww:param></ww:text>
 </ww:if>
 <ww:else>
-    <ww:set name="title" value="'Create Employee'"/>
+    <ww:text id="title" name="item.create"><ww:param><ww:text name="employee"/></ww:param></ww:text>
 </ww:else>
 <html>
 <head>
 <h1><ww:property value="#title"/></h1>
 
 <ww:action id="skillAction" namespace="/skill" name="list"/>
+
 <ww:form name="editForm" action="save">
     <ww:textfield label="Employee Id" name="currentEmployee.empId"/>
-    <ww:textfield label="First Name" name="currentEmployee.firstName"/>
-    <ww:textfield label="Last Name" name="currentEmployee.lastName"/>
+    <ww:textfield label="%{getText('employee.firstName')}" name="currentEmployee.firstName"/>
+    <ww:textfield label="%{getText('employee.lastName')}" name="currentEmployee.lastName"/>
     <ww:datepicker label="Birthdate" name="currentEmployee.birthDate"/>
     <ww:textfield label="Salary" name="currentEmployee.salary"/>
     <ww:checkbox fieldValue="true" label="Married" name="currentEmployee.married"/>
     <ww:password label="Password" name="currentEmployee.password"/>
     <ww:radio list="availableLevels" name="currentEmployee.level"/>
     <ww:textarea label="Comment" name="currentEmployee.comment" cols="50" rows="3"/>
-    <ww:submit value="Save"/>
+    <ww:submit value="%{getText('save')}" />
 </ww:form>
-<p><a href="<ww:url action="list"/>">Back to Employee List</a></p>
+<p><a href="<ww:url action="list"/>"><ww:text name="employee.backtolist"/></a></p>
 </body>
 </html>

File webapps/showcase/src/webapp/empmanager/editSkill.jsp

View file
  • Ignore whitespace
 </ww:if>
 <ww:else>
     <ww:set name="submitType" value="'create'"/>
-    <ww:text id="title" name="item.edit"><ww:param><ww:text name="skill"/></ww:param></ww:text>
+    <ww:text id="title" name="item.create"><ww:param><ww:text name="skill"/></ww:param></ww:text>
 </ww:else>
 <html>
 <head><title><ww:property value="#title"/></title></head>