You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2004/01/08 17:21:13 UTC
cvs commit: jakarta-struts/web/examples/validator type.jsp registration.jsp multiRegistration2.jsp multiRegistration1.jsp jsType.jsp jsRegistration.jsp index.jsp
husted 2004/01/08 08:21:13
Added: web/examples/validator type.jsp registration.jsp
multiRegistration2.jsp multiRegistration1.jsp
jsType.jsp jsRegistration.jsp index.jsp
Log:
Place web assets for validator module under examples.
Revision Changes Path
1.1 jakarta-struts/web/examples/validator/type.jsp
Index: type.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib uri="/tags/struts-bean" prefix="bean" %><%@ taglib uri="/tags/struts-html" prefix="html" %><%@ taglib uri="/tags/struts-logic" prefix="logic" %><%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<html:html>
<head>
<title>
<bean:message key="typeForm.title" />
</title>
<html:base />
</head>
<body bgcolor="white">
<logic:messagesPresent>
<bean:message key="errors.header" />
<ul>
<html:messages id="error" property="byte">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="short">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="integer">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="long">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="float">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="floatRange">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="double">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="date">
<li>
<bean:write name="error" />
</li>
</html:messages>
<html:messages id="error" property="creditCard">
<li>
<bean:write name="error" />
</li>
</html:messages>
</ul>
<hr />
</logic:messagesPresent>
<html:form action="type-submit">
<html:hidden property="action" />
<table border="0">
<tr>
<th align="left">
<bean:message key="typeForm.byte.displayname" />
</th>
<td align="left">
<html:text property="byte" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.short.displayname" />
</th>
<td align="left">
<html:text property="short" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.integer.displayname" />
</th>
<td align="left">
<html:text property="integer" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.long.displayname" />
</th>
<td align="left">
<html:text property="long" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.float.displayname" />
</th>
<td align="left">
<html:text property="float" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.floatRange.displayname" />
</th>
<td align="left">
<html:text property="floatRange" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.double.displayname" />
</th>
<td align="left">
<html:text property="double" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.date.displayname" />
</th>
<td align="left">
<html:text property="date" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.creditCard.displayname" />
</th>
<td align="left">
<html:text property="creditCard" size="16" maxlength="16" />(e.g. 4111111111111111, 5500000000000004)</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.nested" />
</th>
<td align="left"> </td>
</tr>
<nested:iterate property="nameList">
<tr>
<th align="left"> </th>
<td align="left">
<nested:messagesPresent property="value">
<br />
<ul>
<nested:messages id="error" property="value">
<li>
<bean:write name="error" />
</li>
</nested:messages>
</ul>
</nested:messagesPresent>
<nested:text property="value" size="15" maxlength="15" />
</td>
</tr>
</nested:iterate>
<tr>
<td>
<html:submit property="submit">
<bean:message key="button.save" />
</html:submit> 
<html:reset>
<bean:message key="button.reset" />
</html:reset> 
<html:cancel>
<bean:message key="button.cancel" />
</html:cancel></td>
</tr>
</table>
</html:form>
</body>
</html:html>
1.1 jakarta-struts/web/examples/validator/registration.jsp
Index: registration.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<title><bean:message key="registrationForm.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:messagesPresent>
<bean:message key="errors.header"/>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul><hr />
</logic:messagesPresent>
<html:form action="registration-submit">
<html:hidden property="action"/>
<table border="0" width="100%">
<tr>
<th align="left">
<bean:message key="registrationForm.firstname.displayname"/>
</th>
<td align="left">
<html:text property="firstName" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.lastname.displayname"/>
</th>
<td align="left">
<html:text property="lastName" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.addr.displayname"/>
</th>
<td align="left">
<html:textarea property="addr" cols="40" rows="5"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.city.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.city" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.stateprov.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.stateProv" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.zippostal.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.zipPostal[1]" size="25" maxlength="25"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.phone.displayname"/>
</th>
<td align="left">
<html:text property="phone" size="20" maxlength="20"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.email.displayname"/>
</th>
<td align="left">
<html:text property="email" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<td>
<html:submit property="submit">
<bean:message key="button.save"/>
</html:submit>
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
<html:cancel>
<bean:message key="button.cancel"/>
</html:cancel>
</td>
</tr>
</table>
</html:form>
</body>
</html:html>
1.1 jakarta-struts/web/examples/validator/multiRegistration2.jsp
Index: multiRegistration2.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<title><bean:message key="registrationForm.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:messagesPresent>
<bean:message key="errors.header"/>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul><hr />
</logic:messagesPresent>
<html:form action="multiRegistration-submit" onsubmit="return validateMultiRegistrationForm(this);">
<html:hidden property="action"/>
<html:hidden property="page" value="2"/>
<html:hidden property="firstName"/>
<html:hidden property="lastName"/>
<html:hidden property="addr"/>
<html:hidden property="cityStateZip.city"/>
<table border="0" width="100%">
<tr>
<th align="left">
<bean:message key="registrationForm.stateprov.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.stateProv" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.zippostal.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.zipPostal[1]" size="25" maxlength="25"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.phone.displayname"/>
</th>
<td align="left">
<html:text property="phone" size="20" maxlength="20"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.email.displayname"/>
</th>
<td align="left">
<html:text property="email" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<td>
<html:submit property="submit" onclick="bCancel=false;">
<bean:message key="button.save"/>
</html:submit>
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
<html:cancel onclick="bCancel=true;">
<bean:message key="button.cancel"/>
</html:cancel>
</td>
</tr>
</table>
</html:form>
<html:javascript formName="multiRegistrationForm" page="2"/>
</body>
</html:html>
1.1 jakarta-struts/web/examples/validator/multiRegistration1.jsp
Index: multiRegistration1.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<title><bean:message key="registrationForm.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:messagesPresent>
<bean:message key="errors.header"/>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul><hr />
</logic:messagesPresent>
<html:form action="multiRegistration-submit" onsubmit="return validateMultiRegistrationForm(this);">
<html:hidden property="action"/>
<html:hidden property="page" value="1"/>
<table border="0" width="100%">
<tr>
<th align="left">
<bean:message key="registrationForm.firstname.displayname"/>
</th>
<td align="left">
<html:text property="firstName" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.lastname.displayname"/>
</th>
<td align="left">
<html:text property="lastName" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.addr.displayname"/>
</th>
<td align="left">
<html:textarea property="addr" cols="40" rows="5"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.city.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.city" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<td>
<html:submit property="submit" onclick="bCancel=false;">
<bean:message key="button.save"/>
</html:submit>
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
<html:cancel onclick="bCancel=true;">
<bean:message key="button.cancel"/>
</html:cancel>
</td>
</tr>
</table>
</html:form>
<html:javascript formName="multiRegistrationForm" page="1"/>
</body>
</html:html>
1.1 jakarta-struts/web/examples/validator/jsType.jsp
Index: jsType.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" %><%@ taglib uri="/tags/struts-bean" prefix="bean" %><%@ taglib uri="/tags/struts-html" prefix="html" %><%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<title>
<bean:message key="typeForm.title" />
</title>
<html:base />
</head>
<body>
<logic:messagesPresent>
<bean:message key="errors.header" />
<ul>
<html:messages id="error">
<li>
<bean:write name="error" />
</li>
</html:messages>
</ul>
<hr />
</logic:messagesPresent>
<html:form action="jsType-submit" onsubmit="return validateJsTypeForm(this);">
<html:hidden property="action" />
<table border="0">
<tr>
<th align="left">
<bean:message key="typeForm.byte.displayname" />
</th>
<td align="left">
<html:text property="byte" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.short.displayname" />
</th>
<td align="left">
<html:text property="short" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.integer.displayname" />
</th>
<td align="left">
<html:text property="integer" size="15" maxlength="15" />
</td>
</tr><%--
<tr>
<th align="left">
<bean:message key="typeForm.long.displayname"/>
</th>
<td align="left">
<html:text property="long" size="15" maxlength="15"/>
</td>
</tr>
--%>
<tr>
<th align="left">
<bean:message key="typeForm.float.displayname" />
</th>
<td align="left">
<html:text property="float" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.floatRange.displayname" />
</th>
<td align="left">
<html:text property="floatRange" size="15" maxlength="15" />
</td>
</tr><%--
<tr>
<th align="left">
<bean:message key="typeForm.double.displayname"/>
</th>
<td align="left">
<html:text property="double" size="15" maxlength="15"/>
</td>
</tr>
--%>
<tr>
<th align="left">
<bean:message key="typeForm.date.displayname" />
</th>
<td align="left">
<html:text property="date" size="15" maxlength="15" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.creditCard.displayname" />
</th>
<td align="left">
<html:text property="creditCard" size="16" maxlength="16" />(e.g. 4111111111111111, 5500000000000004)</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.option.satisfaction" />:</th>
<td align="left">
<html:select property="satisfaction">
<html:option value="" key="typeForm.option.select.one" />
<html:options collection="satisfactionList" property="value" labelProperty="label" />
</html:select>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.option.os.list" />:</th>
<td align="left">
<html:select property="osList" multiple="true">
<html:option value="" key="typeForm.option.select.many" />
<html:options collection="osTypes" property="value" labelProperty="label" />
</html:select>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.radio.overall.satisfaction" />:</th>
<td align="left">
<logic:iterate id="satBean" name="satisfactionList" type="org.apache.struts.util.LabelValueBean">
<html:radio property="overallSatisfaction" value="<%=satBean.getValue()%>">
<%=satBean.getLabel()%>
</html:radio>
</logic:iterate>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.checkbox.wouldrecommend" />:</th>
<td align="left">
<html:checkbox property="wouldRecommend" />
</td>
</tr>
<tr>
<th align="left">
<bean:message key="typeForm.checkbox.used.languages" />:</th>
<td align="left">
<logic:iterate id="langBean" indexId="usedIndex" name="languageTypes" type="org.apache.struts.util.LabelValueBean">
<html:multibox property="usedLanguages" value="<%=langBean.getValue()%>" /><%=langBean.getLabel()%>
</logic:iterate>
</td>
</tr>
<tr>
<td>
<html:submit property="submit" onclick="bCancel=false;">
<bean:message key="button.save" />
</html:submit> 
<html:reset>
<bean:message key="button.reset" />
</html:reset> 
<html:cancel onclick="bCancel=true;">
<bean:message key="button.cancel" />
</html:cancel></td>
</tr>
</table>
</html:form>
<html:javascript formName="jsTypeForm" dynamicJavascript="true" staticJavascript="true" />
</body>
</html:html>
1.1 jakarta-struts/web/examples/validator/jsRegistration.jsp
Index: jsRegistration.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<title><bean:message key="registrationForm.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:messagesPresent>
<bean:message key="errors.header"/>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul><hr>
</logic:messagesPresent>
<html:form action="registration-submit" onsubmit="return validateRegistrationForm(this);">
<html:hidden property="action"/>
<table border="0" width="100%">
<tr>
<th align="left">
<bean:message key="registrationForm.firstname.displayname"/>
</th>
<td align="left">
<html:text property="firstName" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.lastname.displayname"/>
</th>
<td align="left">
<html:text property="lastName" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.addr.displayname"/>
</th>
<td align="left">
<html:textarea property="addr" cols="40" rows="5"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.city.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.city" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.stateprov.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.stateProv" size="60" maxlength="60"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.zippostal.displayname"/>
</th>
<td align="left">
<html:text property="cityStateZip.zipPostal[1]" size="25" maxlength="25"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.phone.displayname"/>
</th>
<td align="left">
<html:text property="phone" size="20" maxlength="20"/>
</td>
</tr>
<tr>
<th align="left">
<bean:message key="registrationForm.email.displayname"/>
</th>
<td align="left">
<html:text property="email" size="60" maxlength="60"/>
</td>
</tr>
<tr colspan="1">
<td>
<html:submit property="submit" onclick="bCancel=false;">
<bean:message key="button.save"/>
</html:submit>
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
<html:cancel onclick="bCancel=true;">
<bean:message key="button.cancel"/>
</html:cancel>
</td>
</tr>
</table>
</html:form>
<%--
Referencing the registrationForm since they are identical
so I don't need a separate validation.xml listing just for this form.
--%>
<html:javascript formName="registrationForm"/>
</body>
</html:html>
1.1 jakarta-struts/web/examples/validator/index.jsp
Index: index.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.struts.validator.ValidatorPlugIn" session="true" %>
<%@ page import="org.apache.struts.Globals" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<logic:notPresent name="<%= Globals.MESSAGES_KEY %>" >
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>
<%-- :TODO: Need code to do this with moudles
<logic:notPresent name="<%= ValidatorPlugIn.VALIDATOR_KEY %>" >
<font color="red">
ERROR: Validator resources not loaded -- check Commons Logging
logs for error messages.
</font>
</logic:notPresent>
--%>
<h3><bean:message key="registrationForm.title"/></h3>
<ul>
<li><html:link action="/registration"><bean:message key="registrationForm.title"/></html:link></li>
<!-- :TODO: Should have a non-JaveScript message-by-field example -->
<li>
<html:link action="/jsRegistration"><bean:message key="jsRegistrationForm.title"/></html:link> -
<bean:message key="jsRegistrationForm.description"/>
</li>
<li>
<html:link action="/multiRegistration"><bean:message key="multiRegistrationForm.title"/></html:link> -
<bean:message key="multiRegistrationForm.description"/>
</li>
</ul>
<p> </p>
<h3><bean:message key="typeForm.title"/></h3>
<ul>
<li>
<html:link action="/type"><bean:message key="typeForm.title"/></html:link> -
<bean:message key="typeForm.description"/>
</li>
<li>
<html:link action="/editJsType"><bean:message key="jsTypeForm.title"/></html:link> -
<bean:message key="jsTypeForm.description"/>
</li>
</ul>
<p> </p>
<h3>Change Language | Changez Le Langage</h3>
<ul>
<li><html:link action="/locale?language=en">English | Anglais</html:link></li>
<li>
<html:link action="/locale?language=fr">French | Francais</html:link> -
<bean:message key="localeForm.fr"/>
</li>
<li>
<html:link action="/locale?language=fr&country=CA">French Canadian | Francais Canadien</html:link> -
<bean:message key="localeForm.frCA"/>
</li>
<li>
<html:link action="/locale?language=ja" useLocalEncoding="true">Japanese | Japonais</html:link> -
<bean:message key="localeForm.ja"/>
</li>
</ul>
<p> </p>
<html:img page="/struts-power.gif" altKey="index.powered"/>
</body>
</html:html>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org