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/18 20:50:39 UTC

cvs commit: jakarta-struts/web/example index.jsp logon.jsp mainMenu.jsp registration.jsp subscription.jsp

craigmcc    00/11/18 11:50:37

  Modified:    src/doc  struts-form.xml
               web/example index.jsp logon.jsp mainMenu.jsp
                        registration.jsp subscription.jsp
  Added:       src/share/org/apache/struts/taglib/form BaseTag.java
                        Constants.java LocalStrings.properties
  Log:
  Migrate the "base" tag from the main taglibs directory (Struts 0.5) to the
  "form" library (Struts 1.0).  Use it in the example application's pages.
  
  Also migrate the "LocalStrings.properties" and "Constants.java" files in
  preparation for modifying the existing form tags to use copies from the
  local directory.  That way, nothing will break when the deprecated 0.5
  tags and associated files are eventually removed.
  
  Revision  Changes    Path
  1.7       +19 -0     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- struts-form.xml	2000/11/09 23:34:16	1.6
  +++ struts-form.xml	2000/11/18 19:50:26	1.7
  @@ -23,6 +23,25 @@
     </p>
     </info>
   
  +        <tag>
  +          <name>base</name>
  +          <summary>Render an HTML &lt;base&gt; Element</summary>
  +          <tagclass>org.apache.struts.taglib.form.BaseTag</tagclass>
  +          <info>
  +          <p>Renders an HTML <code>&lt;base&gt;</code> element with an
  +          <code>href</code> attribute pointing to the absolute location of
  +          the enclosing JSP page.  This tag is valid only when nested inside
  +          an HTML <code>&lt;head&gt;</code> element.  There are no attributes
  +          associated with this tag.</p>
  +
  +          <p>This tag is useful because it allows you to use relative URL
  +          references in the page that are calculated based on the URL of the
  +          page itself, rather than the URL to which the most recent submit
  +          took place (which is where the browser would normally resolve
  +          relative references against).</p>
  +          </info>
  +        </tag>
  +
   	<tag>
   		
   		<name>button</name>
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/BaseTag.java
  
  Index: BaseTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/BaseTag.java,v 1.1 2000/11/18 19:50:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/18 19:50:29 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.struts.taglib.form;
  
  import java.io.IOException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  import org.apache.struts.action.Action;
  import org.apache.struts.util.MessageResources;
  
  /**
   * Renders an HTML <base> element with an href 
   * attribute pointing to the absolute location of the enclosing JSP page. This 
   * tag is only valid when nested inside a head tag body. The presence 
   * of this tag allows the browser to resolve relative URL's to images,
   * CSS stylesheets  and other resources in a manner independent of the URL
   * used to call the ActionServlet.  There are no attributes associated with
   * this tag.
   *
   * @author Luis Arias <lu...@elysia.com>
   * @version $Revision: 1.1 $ $Date: 2000/11/18 19:50:29 $
   */
  
  public class BaseTag extends TagSupport {
    
    /**
     * The message resources for this package.
     */
    protected static MessageResources messages =
       MessageResources.getMessageResources(Constants.Package + ".LocalStrings");
  
    /**
     * Process the start of this tag.
     *
     * @exception JspException if a JSP exception has occurred
     */
    public int doStartTag() throws JspException {
      HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
      StringBuffer buf = new StringBuffer("<base href=\""); 
      buf.append(request.getScheme());
      buf.append("://");
      buf.append(request.getServerName());
      buf.append(":");
      buf.append(request.getServerPort());
      buf.append(request.getRequestURI());
      buf.append("\">");
      JspWriter out = pageContext.getOut();
      try {
          out.write(buf.toString());
      }
      catch (IOException e) {
          pageContext.setAttribute(Action.EXCEPTION_KEY, e,
                                   PageContext.REQUEST_SCOPE);
          throw new JspException(messages.getMessage("common.io", e.toString()));
      }
      return EVAL_BODY_INCLUDE;
    }
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/Constants.java
  
  Index: Constants.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/Constants.java,v 1.1 2000/11/18 19:50:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/18 19:50:29 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.taglib.form;
  
  
  /**
   * Manifest constants for this package.
   */
  
  public class Constants {
  
  
      /**
       * The name of this package.
       */
      public static final String Package = "org.apache.struts.taglib.form";
  
  
      /**
       * The attribute key for the bean our form is related to.
       */
      public static final String BEAN_KEY = Package + ".BEAN";
  
  
      /**
       * The property under which a Cancel button press is reported.
       */
      public static final String CANCEL_PROPERTY = Package + ".CANCEL";
  
  
      /**
       * The attribute key for the form tag itself.
       */
      public static final String FORM_KEY = Package + ".FORM";
  
  
      /**
       * The attribute key for the select tag itself.
       */
      public static final String SELECT_KEY = Package + ".SELECT";
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  common.io=Encountered input/output error: {0}
  enumerateTag.enumeration=Cannot create enumeration for {0}
  formTag.create=Exception creating bean of class {0}: {1}
  forwardTag.forward=Error forwarding to page {0}: {1}
  forwardTag.lookup=Cannot find global forward named {0}
  forwardTag.redirect=Error redirecting to path {0}: {1}
  getter.access=Cannot access property {0} for bean under name {1}
  getter.bean=Cannot find bean under name {0}
  getter.method=No getter method available for property {0} for bean under name {1}
  getter.name=You must specify a name attribute if the property attribute is present
  getter.property=Property {0} returned a null value
  getter.result=Getter for property {0} threw exception: {1}
  includeTag.include=Error including page {0}: {1}
  includeTag.lookup=Cannot find global forward named {0}
  iterateTag.iterator=Cannot create iterator for {0}
  linkTag.destination=You must specify exactly one of 'forward' or 'href'
  linkTag.forward=Cannot locate global forwarding for {0}
  linkTag.forwards=Cannot locate forwards mapping table
  linkTag.type=Object must be of type Map
  linkTag.type1=Object must be of type Dictionary
  messageTag.message=Missing message for key {0}
  messageTag.resources=Missing resources attribute {0}
  optionTag.select=Option tag must be nested in a Select tag
  optionsTag.enumeration=Cannot create enumeration for {0}
  optionsTag.iterator=Cannot create iterator for {0}
  optionsTag.select=Options tag must be nested in a Select tag
  
  
  
  1.7       +1 -0      jakarta-struts/web/example/index.jsp
  
  Index: index.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/index.jsp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- index.jsp	2000/11/04 00:51:18	1.6
  +++ index.jsp	2000/11/18 19:50:31	1.7
  @@ -6,6 +6,7 @@
   <html>
   <head>
   <title><bean:message key="index.title"/></title>
  +<form:base/>
   </head>
   <body bgcolor="white">
   
  
  
  
  1.8       +1 -0      jakarta-struts/web/example/logon.jsp
  
  Index: logon.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/logon.jsp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- logon.jsp	2000/11/04 00:51:18	1.7
  +++ logon.jsp	2000/11/18 19:50:34	1.8
  @@ -6,6 +6,7 @@
   <html>
   <head>
   <title><bean:message key="logon.title"/></title>
  +<form:base/>
   </head>
   <body bgcolor="white">
   
  
  
  
  1.6       +1 -0      jakarta-struts/web/example/mainMenu.jsp
  
  Index: mainMenu.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/mainMenu.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mainMenu.jsp	2000/11/04 00:51:18	1.5
  +++ mainMenu.jsp	2000/11/18 19:50:34	1.6
  @@ -8,6 +8,7 @@
   <html>
   <head>
   <title><bean:message key="mainMenu.title"/></title>
  +<form:base/>
   </head>
   <body bgcolor="white">
   
  
  
  
  1.11      +1 -0      jakarta-struts/web/example/registration.jsp
  
  Index: registration.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/registration.jsp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- registration.jsp	2000/11/04 00:51:19	1.10
  +++ registration.jsp	2000/11/18 19:50:34	1.11
  @@ -18,6 +18,7 @@
               scope="request" value="Edit">
     <title><bean:message key="registration.title.edit"/></title>
   </logic:equal>
  +<form:base/>
   </head>
   <body bgcolor="white">
   
  
  
  
  1.16      +1 -0      jakarta-struts/web/example/subscription.jsp
  
  Index: subscription.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/subscription.jsp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- subscription.jsp	2000/11/04 00:51:19	1.15
  +++ subscription.jsp	2000/11/18 19:50:35	1.16
  @@ -27,6 +27,7 @@
               scope="request" value="Edit">
     <title><bean:message key="subscription.title.edit"/></title>
   </logic:equal>
  +<form:base/>
   </head>
   <body bgcolor="white">