You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/11/03 21:58:18 UTC

cvs commit: jakarta-struts/web/example/WEB-INF web.xml

craigmcc    00/11/03 12:58:17

  Modified:    src/doc  project.xml struts-bean.xml struts-form.xml
               web/example index.jsp logon.jsp registration.jsp
                        subscription.jsp
               web/example/WEB-INF web.xml
  Log:
  Adapt the JSP pages from the example application to the new form library
  tags (including cleaning up some typos in the struts-bean.xml source).
  There are still three old-style tags (errors, link, and message) being
  used, which will be resolved when these tags are assigned to one of the
  new libraries.
  
  Revision  Changes    Path
  1.9       +1 -1      jakarta-struts/src/doc/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/project.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- project.xml	2000/11/03 18:48:25	1.8
  +++ project.xml	2000/11/03 20:57:43	1.9
  @@ -14,7 +14,7 @@
       </menu>
   
       <menu name="New Tag Library Reference">
  -        <item name="Bean/Property Tags" href="struts-bean.html"/>
  +        <item name="Bean Tags"          href="struts-bean.html"/>
           <item name="Form Tags"          href="struts-form.html"/>
           <item name="Logic Tags"         href="struts-logic.html"/>
           <item name="Template Tags"      href="struts-template.html"/>
  
  
  
  1.6       +3 -3      jakarta-struts/src/doc/struts-bean.xml
  
  Index: struts-bean.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-bean.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- struts-bean.xml	2000/10/08 00:40:48	1.5
  +++ struts-bean.xml	2000/11/03 20:57:44	1.6
  @@ -3,7 +3,7 @@
   
   <properties>
     <author>Craig R. McClanahan</author>
  -  <title>The Struts Framework Project - Bean/Property Tags</title>
  +  <title>The Struts Framework Project - Bean Tags</title>
   </properties>
   
   <body>
  @@ -13,8 +13,8 @@
   
     <tlibversion>1.0</tlibversion>
     <jspversion>1.1</jspversion>
  -  <shortname>Struts Bean/Property Tags</shortname>
  -  <display-name>Bean and Property Definition Tags</display-name>
  +  <shortname>Struts Bean Tags</shortname>
  +  <display-name>Struts Bean Tags</display-name>
     <uri>http://jakarta.apache.org/struts/tags-bean-1.0</uri>
     <info>
     <p>This tag library contains tags useful in accessing beans and their
  
  
  
  1.2       +13 -62    jakarta-struts/src/doc/struts-form.xml
  
  Index: struts-form.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-form.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- struts-form.xml	2000/11/03 18:48:26	1.1
  +++ struts-form.xml	2000/11/03 20:57:45	1.2
  @@ -1960,16 +1960,6 @@
   		</attribute>	
   		
   		<attribute>
  -			<name>property</name>
  -			<required>true</required>
  -			<rtexprvalue>false</rtexprvalue>
  -			<info>
  -				Name of the request parameter that will be included with this
  -				submission, set to the specified value. 
  -			</info>
  -		</attribute>
  -		
  -		<attribute>
   			<name>style</name>
   			<required>false</required>
   			<rtexprvalue>false</rtexprvalue>
  @@ -2004,7 +1994,7 @@
   		<summary>
   			Render A Select Element
   		</summary>
  -		<tagclass>org.apache.struts.taglib.form.ResetTag</tagclass>
  +		<tagclass>org.apache.struts.taglib.form.SelectTag</tagclass>
   		<bodycontent>JSP</bodycontent>
   		<info>
   			Custom tag that represents an HTML select element, associated with a
  @@ -2022,17 +2012,18 @@
   				element.
   			</info>
   		</attribute>
  -		
  -		<attribute>
  -			<name>accesskey</name>
  -			<required>false</required>
  -			<rtexprvalue>false</rtexprvalue>
  -			<info>
  -				Whether or not multiple selections be allowed.  Any non-null
  -				value will trigger rendering this.
  -			</info>
  -		</attribute>
   		
  +                <attribute>
  +                        <name>multiple</name>
  +                        <required>false</required>
  +                        <rtexprvalue>false</rtexprvalue>
  +                        <info>
  +                                If set to any arbitrary value, the rendered
  +                                select element will support
  +                                multiple selections.
  +                        </info>
  +                </attribute>
  +
   		<attribute>
   			<name>name</name>
   			<required>false</required>
  @@ -2043,16 +2034,6 @@
   			</info>
   		</attribute>
   		
  -				<attribute>
  -			<name>accesskey</name>
  -			<required>false</required>
  -			<rtexprvalue>false</rtexprvalue>
  -			<info>
  -				The keyboard character used to move focus immediately to this
  -				element.
  -			</info>
  -		</attribute>
  -		
   		<attribute>
   			<name>onblur</name>
   			<required>false</required>
  @@ -2264,36 +2245,6 @@
   		</attribute>
   		
   		<attribute>
  -			<name>accesskey</name>
  -			<required>false</required>
  -			<rtexprvalue>false</rtexprvalue>
  -			<info>
  -				Whether or not multiple selections be allowed.  Any non-null
  -				value will trigger rendering this.
  -			</info>
  -		</attribute>
  -		
  -		<attribute>
  -			<name>name</name>
  -			<required>false</required>
  -			<rtexprvalue>false</rtexprvalue>
  -			<info>
  -				The fully-qualified java class name of the bean containing the
  -				underlying property.
  -			</info>
  -		</attribute>
  -		
  -				<attribute>
  -			<name>accesskey</name>
  -			<required>false</required>
  -			<rtexprvalue>false</rtexprvalue>
  -			<info>
  -				The keyboard character used to move focus immediately to this
  -				element.
  -			</info>
  -		</attribute>
  -		
  -		<attribute>
   			<name>onblur</name>
   			<required>false</required>
   			<rtexprvalue>false</rtexprvalue>
  @@ -2427,7 +2378,7 @@
   		
   		<attribute>
   			<name>property</name>
  -			<required>true</required>
  +			<required>false</required>
   			<rtexprvalue>false</rtexprvalue>
   			<info>
   				Name of the request parameter that will be included with this
  
  
  
  1.5       +5 -5      jakarta-struts/web/example/index.jsp
  
  Index: index.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/index.jsp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- index.jsp	2000/08/01 20:04:03	1.4
  +++ index.jsp	2000/11/03 20:57:54	1.5
  @@ -1,5 +1,6 @@
   <%@ page language="java" %>
   <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
  +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
   
   <html>
   <head>
  @@ -7,21 +8,20 @@
   </head>
   <body bgcolor="white">
   
  -<struts:ifAttributeMissing name="database" scope="application">
  +<logic:notPresent name="database" scope="application">
     <font color="red">
       ERROR:  User database not loaded -- check servlet container logs
       for error messages.
     </font>
     <hr>
  -</struts:ifAttributeMissing>
  +</logic:notPresent>
   
  -<struts:ifAttributeMissing name="org.apache.struts.action.MESSAGE"
  - scope="application">
  +<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
     <font color="red">
       ERROR:  Application resources not loaded -- check servlet container
       logs for error messages.
     </font>
  -</struts:ifAttributeMissing>
  +</logic:notPresent>
   
   <h3><struts:message key="index.heading"/></h3>
   <ul>
  
  
  
  1.6       +8 -7      jakarta-struts/web/example/logon.jsp
  
  Index: logon.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/logon.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- logon.jsp	2000/10/16 05:02:38	1.5
  +++ logon.jsp	2000/11/03 20:57:56	1.6
  @@ -1,5 +1,6 @@
   <%@ page language="java" %>
   <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
  +<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
   
   <html>
   <head>
  @@ -9,8 +10,8 @@
   
   <struts:errors/>
   
  -<struts:form action="logon.do" name="logonForm" focus="username"
  -               scope="request" type="org.apache.struts.example.LogonForm">
  +<form:form action="logon.do" name="logonForm" focus="username"
  +           scope="request" type="org.apache.struts.example.LogonForm">
   <table border="0" width="100%">
   
     <tr>
  @@ -18,7 +19,7 @@
         <struts:message key="prompt.username"/>
       </th>
       <td align="left">
  -      <struts:text property="username" size="16" maxlength="16"/>
  +      <form:text property="username" size="16" maxlength="16"/>
       </td>
     </tr>
   
  @@ -27,22 +28,22 @@
         <struts:message key="prompt.password"/>
       </th>
       <td align="left">
  -      <struts:password property="password" size="16" maxlength="16"/>
  +      <form:password property="password" size="16" maxlength="16"/>
       </td>
     </tr>
   
     <tr>
       <td align="right">
  -      <struts:submit property="submit" value="Submit"/>
  +      <form:submit property="submit" value="Submit"/>
       </td>
       <td align="left">
  -      <struts:reset/>
  +      <form:reset/>
       </td>
     </tr>
   
   </table>
   
  -</struts:form>
  +</form:form>
   
   </body>
   </html>
  
  
  
  1.9       +43 -39    jakarta-struts/web/example/registration.jsp
  
  Index: registration.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/registration.jsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- registration.jsp	2000/10/16 05:02:38	1.8
  +++ registration.jsp	2000/11/03 20:57:57	1.9
  @@ -1,6 +1,9 @@
   <%@ page language="java" %>
   <%@ taglib uri="/WEB-INF/app.tld"    prefix="app" %>
   <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
  +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  +<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
  +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
   <struts:ifPropertyEquals name="registrationForm" scope="request"
                            property="action" value="Edit">
     <app:checkLogon/>
  @@ -8,22 +11,22 @@
   
   <html>
   <head>
  -<struts:ifPropertyEquals name="registrationForm" scope="request"
  -                         property="action" value="Create">
  +<logic:equal name="registrationForm" property="action"
  +            scope="request" value="Create">
     <title><struts:message key="registration.title.create"/></title>
  -</struts:ifPropertyEquals>
  -<struts:ifPropertyEquals name="registrationForm" scope="request"
  -                         property="action" value="Edit">
  +</logic:equal>
  +<logic:equal name="registrationForm" property="action"
  +            scope="request" value="Edit">
     <title><struts:message key="registration.title.edit"/></title>
  -</struts:ifPropertyEquals>
  +</logic:equal>
   </head>
   <body bgcolor="white">
   
   <struts:errors/>
   
  -<struts:form action="saveRegistration.do" name="registrationForm"
  -             scope="request" type="org.apache.struts.example.RegistrationForm">
  -<struts:hidden property="action"/>
  +<form:form action="saveRegistration.do" name="registrationForm"
  +            scope="request" type="org.apache.struts.example.RegistrationForm">
  +<form:hidden property="action"/>
   <table border="0" width="100%">
   
     <tr>
  @@ -31,15 +34,16 @@
         <struts:message key="prompt.username"/>
       </th>
       <td align="left">
  -      <struts:ifPropertyEquals name="registrationForm" scope="request"
  -                               property="action" value="Create">
  -        <struts:text property="username" size="16" maxlength="16"/>
  -      </struts:ifPropertyEquals>
  -      <struts:ifPropertyEquals name="registrationForm" scope="request"
  -                               property="action" value="Edit">
  -        <struts:property property="username"/>
  -	<struts:hidden property="username"/>
  -      </struts:ifPropertyEquals>
  +      <logic:equal name="registrationForm" property="action"
  +                  scope="request" value="Create">
  +        <form:text property="username" size="16" maxlength="16"/>
  +      </logic:equal>
  +      <logic:equal name="registrationForm" property="action"
  +                  scope="request" value="Edit">
  +        <bean:write name="registrationForm" property="username"
  +                   scope="request" filter="true"/>
  +	<form:hidden property="username"/>
  +      </logic:equal>
       </td>
     </tr>
   
  @@ -48,7 +52,7 @@
         <struts:message key="prompt.password"/>
       </th>
       <td align="left">
  -      <struts:password property="password" size="16" maxlength="16"/>
  +      <form:password property="password" size="16" maxlength="16"/>
       </td>
     </tr>
   
  @@ -57,7 +61,7 @@
         <struts:message key="prompt.password2"/>
       </th>
       <td align="left">
  -      <struts:password property="password2" size="16" maxlength="16"/>
  +      <form:password property="password2" size="16" maxlength="16"/>
       </td>
     </tr>
   
  @@ -66,7 +70,7 @@
         <struts:message key="prompt.fullName"/>
       </th>
       <td align="left">
  -      <struts:text property="fullName" size="50"/>
  +      <form:text property="fullName" size="50"/>
       </td>
     </tr>
   
  @@ -75,7 +79,7 @@
         <struts:message key="prompt.fromAddress"/>
       </th>
       <td align="left">
  -      <struts:text property="fromAddress" size="50"/>
  +      <form:text property="fromAddress" size="50"/>
       </td>
     </tr>
   
  @@ -84,32 +88,32 @@
         <struts:message key="prompt.replyToAddress"/>
       </th>
       <td align="left">
  -      <struts:text property="replyToAddress" size="50"/>
  +      <form:text property="replyToAddress" size="50"/>
       </td>
     </tr>
   
     <tr>
       <td align="right">
  -      <struts:submit>
  +      <form:submit>
           <struts:message key="button.save"/>
  -      </struts:submit>
  +      </form:submit>
       </td>
       <td align="left">
  -      <struts:reset>
  +      <form:reset>
           <struts:message key="button.reset"/>
  -      </struts:reset>
  +      </form:reset>
         &nbsp;
  -      <struts:cancel>
  +      <form:cancel>
           <struts:message key="button.cancel"/>
  -      </struts:cancel>
  +      </form:cancel>
       </td>
     </tr>
   
   </table>
  -</struts:form>
  +</form:form>
   
  -<struts:ifPropertyEquals name="registrationForm" scope="request"
  -                         property="action" value="Edit">
  +<logic:equal name="registrationForm" property="action"
  +            scope="request" value="Edit">
   
   <div align="center">
   <h3><struts:message key="heading.subscriptions"/></h3>
  @@ -135,19 +139,19 @@
       </th>
     </tr>
   
  -<struts:enumerate id="subscription" name="user" property="subscriptions">
  +<logic:iterate id="subscription" name="user" property="subscriptions">
     <tr>
       <td align="left">
  -      <struts:htmlProperty name="subscription" property="host"/>
  +      <bean:write name="subscription" property="host" filter="true"/>
       </td>
       <td align="left">
  -      <struts:htmlProperty name="subscription" property="username"/>
  +      <bean:write name="subscription" property="username" filter="true"/>
       </td>
       <td align="center">
  -      <struts:htmlProperty name="subscription" property="type"/>
  +      <bean:write name="subscription" property="type" filter="true"/>
       </td>
       <td align="center">
  -      <struts:htmlProperty name="subscription" property="autoConnect"/>
  +      <bean:write name="subscription" property="autoConnect"/>
       </td>
       <td align="center">
         <app:linkSubscription href="editSubscription.do?action=Delete">
  @@ -158,7 +162,7 @@
         </app:linkSubscription>
       </td>
     </tr>
  -</struts:enumerate>
  +</logic:iterate>
   
   </table>
   
  @@ -166,7 +170,7 @@
     <struts:message key="registration.addSubscription"/>
   </app:linkUser>
   
  -</struts:ifPropertyEquals>
  +</logic:equal>
   
   </body>
   </html>
  
  
  
  1.14      +50 -38    jakarta-struts/web/example/subscription.jsp
  
  Index: subscription.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/subscription.jsp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- subscription.jsp	2000/10/16 05:02:39	1.13
  +++ subscription.jsp	2000/11/03 20:57:59	1.14
  @@ -1,6 +1,9 @@
   <%@ page language="java" %>
   <%@ taglib uri="/WEB-INF/app.tld"    prefix="app" %>
   <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
  +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  +<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
  +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
   <app:checkLogon/>
   
   <%-- In real life, these would be loaded from a database --%>
  @@ -13,28 +16,28 @@
   
   <html>
   <head>
  -<struts:ifPropertyEquals name="subscriptionForm" scope="request"
  -                         property="action" value="Create">
  +<logic:equal name="subscriptionForm" property="action"
  +            scope="request" value="Create">
     <title><struts:message key="subscription.title.create"/></title>
  -</struts:ifPropertyEquals>
  -<struts:ifPropertyEquals name="subscriptionForm" scope="request"
  -                         property="action" value="Delete">
  +</logic:equal>
  +<logic:equal name="subscriptionForm" property="action"
  +            scope="request" value="Delete">
     <title><struts:message key="subscription.title.delete"/></title>
  -</struts:ifPropertyEquals>
  -<struts:ifPropertyEquals name="subscriptionForm" scope="request"
  -                         property="action" value="Edit">
  +</logic:equal>
  +<logic:equal name="subscriptionForm" property="action"
  +            scope="request" value="Edit">
     <title><struts:message key="subscription.title.edit"/></title>
  -</struts:ifPropertyEquals>
  +</logic:equal>
   </head>
   <body bgcolor="white">
   
   <struts:errors/>
   
  -<struts:form action="saveSubscription.do" name="subscriptionForm"
  -              focus="host"
  -              scope="request"
  -               type="org.apache.struts.example.SubscriptionForm">
  -<struts:hidden property="action"/>
  +<form:form action="saveSubscription.do" name="subscriptionForm"
  +            focus="host"
  +            scope="request"
  +             type="org.apache.struts.example.SubscriptionForm">
  +<form:hidden property="action"/>
   <table border="0" width="100%">
   
     <tr>
  @@ -42,7 +45,7 @@
         <struts:message key="prompt.username"/>
       </th>
       <td align="left">
  -        <struts:htmlProperty name="user" property="username"/>
  +        <bean:write name="user" property="username" filter="true"/>
       </td>
     </tr>
   
  @@ -51,7 +54,7 @@
         <struts:message key="prompt.mailHostname"/>
       </th>
       <td align="left">
  -      <struts:textarea property="host" cols="50" rows="1"/>
  +      <form:textarea property="host" cols="50" rows="1"/>
       </td>
     </tr>
   
  @@ -60,7 +63,7 @@
         <struts:message key="prompt.mailUsername"/>
       </th>
       <td align="left">
  -      <struts:text property="username" size="50"/>
  +      <form:text property="username" size="50"/>
       </td>
     </tr>
   
  @@ -69,7 +72,7 @@
         <struts:message key="prompt.mailPassword"/>
       </th>
       <td align="left">
  -      <struts:password property="password" size="50"/>
  +      <form:password property="password" size="50"/>
       </td>
     </tr>
   
  @@ -78,10 +81,10 @@
         <struts:message key="prompt.mailServerType"/>
       </th>
       <td align="left">
  -      <struts:select property="type">
  -        <struts:options name="serverTypeValues"
  -                   labelName="serverTypeLabels"/>
  -      </struts:select>
  +      <form:select property="type">
  +        <form:options name="serverTypeValues"
  +                 labelName="serverTypeLabels"/>
  +      </form:select>
       </td>
     </tr>
   
  @@ -90,39 +93,48 @@
         <struts:message key="prompt.autoConnect"/>
       </th>
       <td align="left">
  -      <struts:checkbox property="autoConnect"/>
  +      <form:checkbox property="autoConnect"/>
       </td>
     </tr>
   
     <tr>
       <td align="right">
  -      <struts:ifParameterNotEquals name="action" value="Delete">
  -        <struts:submit>
  +      <logic:equal name="subscriptionForm" property="action"
  +                  scope="request" value="Create">
  +        <form:submit>
             <struts:message key="button.save"/>
  -        </struts:submit>
  -      </struts:ifParameterNotEquals>
  -      <struts:ifParameterEquals name="action" value="Delete">
  -        <struts:submit>
  +        </form:submit>
  +      </logic:equal>
  +      <logic:equal name="subscriptionForm" property="action"
  +                  scope="request" value="Delete">
  +        <form:submit>
             <struts:message key="button.confirm"/>
  -        </struts:submit>
  -      </struts:ifParameterEquals>
  +        </form:submit>
  +      </logic:equal>
  +      <logic:equal name="subscriptionForm" property="action"
  +                  scope="request" value="Edit">
  +        <form:submit>
  +          <struts:message key="button.save"/>
  +        </form:submit>
  +      </logic:equal>
       </td>
       <td align="left">
  -      <struts:ifParameterNotEquals name="action" value="Delete">
  -        <struts:reset>
  +      <logic:notEqual name="subscriptionForm" property="action"
  +                     scope="request" value="Delete">
  +        <form:reset>
             <struts:message key="button.reset"/>
  -        </struts:reset>
  -      </struts:ifParameterNotEquals>
  +        </form:reset>
  +      </logic:notEqual>
         &nbsp;
  -      <struts:cancel>
  +      <form:cancel>
           <struts:message key="button.cancel"/>
  -      </struts:cancel>
  +      </form:cancel>
       </td>
     </tr>
   
   </table>
   
  -</struts:form>
  +</form:form>
   
   </body>
   </html>
  
  
  
  1.8       +15 -1     jakarta-struts/web/example/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/web.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- web.xml	2000/09/20 04:13:01	1.7
  +++ web.xml	2000/11/03 20:58:13	1.8
  @@ -65,11 +65,25 @@
       <taglib-location>/WEB-INF/app.tld</taglib-location>
     </taglib>
   
  -  <!-- Struts Tag Library Descriptor -->
  +  <!-- Struts Tag Library Descriptors -->
     <taglib>
       <taglib-uri>/WEB-INF/struts.tld</taglib-uri>
       <taglib-location>/WEB-INF/struts.tld</taglib-location>
     </taglib>
   
  +  <taglib>
  +    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
  +    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  +  </taglib>
  +
  +  <taglib>
  +    <taglib-uri>/WEB-INF/struts-form.tld</taglib-uri>
  +    <taglib-location>/WEB-INF/struts-form.tld</taglib-location>
  +  </taglib>
  +
  +  <taglib>
  +    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
  +    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  +  </taglib>
   
   </web-app>