myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject cvs commit: incubator-myfaces/webapps/simple forceId.jsp
Date Sat, 19 Mar 2005 13:13:38 GMT
matzew      2005/03/19 05:13:38

  Modified:    webapps/simple/inc page_footer.jsp
               webapps/src/org/apache/myfaces/examples/tree TreeBacker.java
               webapps/src/org/apache/myfaces/examples/forceid
                        ForceIdBean.java
               conf     web.xml
               webapps/simple forceId.jsp
  Added:       webapps/src/org/apache/myfaces/examples/servlet
                        SourceCodeServlet.java
               webapps/simple/WEB-INF/classes commons-logging.properties
                        log4j.properties
               webapps/simple/WEB-INF web.xml
  Log:
  simple webapp and SOURCE_SERVLET by Sean Schofield
  
  Revision  Changes    Path
  1.2       +3 -1      incubator-myfaces/webapps/simple/inc/page_footer.jsp
  
  Index: page_footer.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/simple/inc/page_footer.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- page_footer.jsp	12 Mar 2005 11:40:07 -0000	1.1
  +++ page_footer.jsp	19 Mar 2005 13:13:38 -0000	1.2
  @@ -1,4 +1,6 @@
   <br/>
   <br/>
   
  -<a href="home.jsf>[HOME]</a>
  +<a href="home.jsf">[HOME]</a>
  +&nbsp;
  +<a href="<%=request.getRequestURI()%>.source">[SOURCE]</a>
  
  
  
  1.2       +1 -7      incubator-myfaces/webapps/src/org/apache/myfaces/examples/tree/TreeBacker.java
  
  Index: TreeBacker.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/src/org/apache/myfaces/examples/tree/TreeBacker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TreeBacker.java	12 Mar 2005 11:40:07 -0000	1.1
  +++ TreeBacker.java	19 Mar 2005 13:13:38 -0000	1.2
  @@ -17,7 +17,6 @@
   
   import org.apache.myfaces.custom.tree2.TreeNode;
   import org.apache.myfaces.custom.tree2.TreeNodeBase;
  -import java.util.List;
   
   /**
    * Backer bean for use in example.  Basically makes a TreeNode available.
  @@ -164,8 +163,3 @@
   
       }
   }
  -
  -
  -
  -
  -
  
  
  
  1.1                  incubator-myfaces/webapps/src/org/apache/myfaces/examples/servlet/SourceCodeServlet.java
  
  Index: SourceCodeServlet.java
  ===================================================================
  package org.apache.myfaces.examples.servlet;
  
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  
  public class SourceCodeServlet extends HttpServlet 
  {
      public void doGet(HttpServletRequest req, HttpServletResponse res)
          throws IOException, ServletException
      {
          String webPage = req.getServletPath();
          
          // remove the '*.source' suffix that maps to this servlet
          int chopPoint = webPage.indexOf(".source");
          
          webPage = webPage.substring(0, chopPoint - 1);
          webPage += "p"; // replace jsf with jsp
          
          // get the actual file location of the requested resource
          String realPath = getServletConfig().getServletContext().getRealPath(webPage);
          System.out.println("realPath: " + realPath);
  
          // output an HTML page
          res.setContentType("text/plain");
  
          // print some html
          ServletOutputStream out = res.getOutputStream();
  
          // print the file
          InputStream in = null;
          try 
          {
              in = new BufferedInputStream(new FileInputStream(realPath));
              int ch;
              while ((ch = in.read()) !=-1) 
              {
                  out.print((char)ch);
              }
          }
          finally {
              if (in != null) in.close();  // very important
          }
      }
  }
  
  
  
  1.2       +24 -0     incubator-myfaces/webapps/src/org/apache/myfaces/examples/forceid/ForceIdBean.java
  
  Index: ForceIdBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/src/org/apache/myfaces/examples/forceid/ForceIdBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ForceIdBean.java	12 Mar 2005 11:40:07 -0000	1.1
  +++ ForceIdBean.java	19 Mar 2005 13:13:38 -0000	1.2
  @@ -15,6 +15,9 @@
    */
   package org.apache.myfaces.examples.forceid;
   
  +import javax.faces.component.UISelectItem;
  +import java.util.ArrayList;
  +
   /**
    * @author <a href="mailto:matzew@apache.org">Matthias Weßendorf</a> 
    */
  @@ -22,11 +25,17 @@
       
       private String valueOne, valueTwo;
       private User users[];
  +    private ArrayList choices = new ArrayList();
  +    private String currentChoice;
       
       public ForceIdBean(){
           users = new User[2];
           users[0] = new User("MyFaces","secrect");
           users[1] = new User("Tomcat","secrect");
  +        
  +        choices.add("foo");
  +        choices.add("bar");
  +        choices.add("buzz");
       }
   
       public String getValueOne() {
  @@ -47,4 +56,19 @@
       public void setUsers(User[] users) {
           this.users = users;
       }
  +    
  +    public ArrayList getChoices()
  +    {
  +        return choices;
  +    }
  +    
  +    public void setCurrentChoice(String currentChoice)
  +    {
  +        this.currentChoice = currentChoice;
  +    }
  +    
  +    public String getCurrentChoice()
  +    {
  +        return currentChoice;
  +    }
   }
  
  
  
  1.1                  incubator-myfaces/webapps/simple/WEB-INF/classes/commons-logging.properties
  
  Index: commons-logging.properties
  ===================================================================
  #org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
  org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
  
  
  
  1.1                  incubator-myfaces/webapps/simple/WEB-INF/classes/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  #for debugging log4j itself
  log4j.debug=false
  
  #Logger-Priorities:
  #DEBUG lowest, prints all messages
  #INFO  prints all messages with FATAL, ERROR, WARN or INFO priority
  #WARN  prints all messages with FATAL, ERROR or WARN priority
  #ERROR prints all messages with FATAL or ERROR priority
  #FATAL highest, prints only FATAL messages
  
  # root logger
  log4j.rootLogger=INFO, A1
  log4j.appender.A1=org.apache.log4j.ConsoleAppender
  log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
  
  # myfaces logger
  log4j.logger.org.apache.myfaces=INFO
  log4j.logger.org.apache.myfaces.config=INFO
  log4j.logger.org.apache.myfaces.application=INFO
  log4j.logger.org.apache.myfaces.application.jsp=INFO
  log4j.logger.org.apache.myfaces.lifecycle=INFO
  log4j.logger.org.apache.myfaces.taglib=INFO
  log4j.logger.org.apache.myfaces.util.DebugUtils=INFO
  log4j.logger.org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl=WARN
  log4j.logger.org.apache.myfaces.renderkit.html.HtmlRenderKitImpl=WARN
  log4j.logger.org.apache.myfaces.component.html.util.AddResource=WARN
  
  
  
  1.1                  incubator-myfaces/webapps/simple/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.
  -->
  
  <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
  
  <web-app>
  
      <context-param>
          <param-name>javax.faces.CONFIG_FILES</param-name>
          <param-value>
              /WEB-INF/examples-config.xml
          </param-value>
          <description>
              Comma separated list of URIs of (additional) faces config files.
              (e.g. /WEB-INF/my-config.xml)
              See JSF 1.0 PRD2, 10.3.2
          </description>
      </context-param>
  
      <context-param>
          <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
          <param-value>server</param-value>
          <description>
              State saving method: "client" or "server" (= default)
              See JSF Specification 2.5.2
          </description>
      </context-param>
  
      <context-param>
          <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
          <param-value>true</param-value>
          <description>
              This parameter tells MyFaces if javascript code should be allowed in the
              rendered HTML output.
              If javascript is allowed, command_link anchors will have javascript code
              that submits the corresponding form.
              If javascript is not allowed, the state saving info and nested parameters
              will be added as url parameters.
              Default: "true"
          </description>
      </context-param>
      
      <context-param>
          <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
          <param-value>false</param-value>
          <description>
              This parameter tells MyFaces if javascript code should be allowed in the
              rendered HTML output.
              If javascript is allowed, command_link anchors will have javascript code
              that submits the corresponding form.
              If javascript is not allowed, the state saving info and nested parameters
              will be added as url parameters.
              Default: "false"
  
              Setting this param to true should be combined with STATE_SAVING_METHOD "server"
for
              best results.
  
              This is an EXPERIMENTAL feature. You also have to enable the detector filter/filter
mapping below to get
              JavaScript detection working.
          </description>
      </context-param>
  
      <context-param>
          <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
          <param-value>true</param-value>
          <description>
              If true, rendered HTML code will be formatted, so that it is "human readable".
              i.e. additional line separators and whitespace will be written, that do not
              influence the HTML code.
              Default: "true"
          </description>
      </context-param>
  
      <context-param>
          <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
          <param-value>true</param-value>
          <description>
              If true, a javascript function will be rendered that is able to restore the
              former vertical scroll on every request. Convenient feature if you have pages
              with long lists and you do not want the browser page to always jump to the top
              if you trigger a link or button action that stays on the same page.
              Default: "false"
          </description>
      </context-param>
  
  
      <!-- WelcomeFile Filter -->
      <!--
      <filter>
          <filter-name>WelcomeFile Filter</filter-name>
          <filter-class>org.apache.myfaces.webapp.filter.WelcomeFileFilter</filter-class>
          <description>
              Due to the manner in which the JSP / servlet lifecycle
              functions, it is not currently possible to specify default
              welcome files for a web application and map them to the
              MyFacesServlet.  Normally they will be mapped to the
              default servlet for the JSP container.  To offset this
              shortcoming, we utilize a servlet Filter which examines
              the URI of all incoming requests.
          </description>
      </filter>
      -->
  
      <!-- JavaScriptDetector Filter -->
  <!--    <filter>-->
  <!--        <filter-name>javascriptDetector</filter-name>-->
  <!--        <filter-class>org.apache.myfaces.webapp.filter.JavaScriptDetectorFilter</filter-class>-->
  <!--    </filter>-->
  
  
      <!-- Extensions Filter -->
      <filter>
          <filter-name>extensionsFilter</filter-name>
          <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
          <init-param>
              <param-name>uploadMaxFileSize</param-name>
              <param-value>100m</param-value>
              <description>Set the size limit for uploaded files.
                  Format: 10 - 10 bytes
                          10k - 10 KB
                          10m - 10 MB
                          1g - 1 GB
              </description>
          </init-param>
          <init-param>
              <param-name>uploadThresholdSize</param-name>
              <param-value>100k</param-value>
              <description>Set the threshold size - files
                      below this limit are stored in memory, files above
                      this limit are stored on disk.
  
                  Format: 10 - 10 bytes
                          10k - 10 KB
                          10m - 10 MB
                          1g - 1 GB
              </description>
          </init-param>
  <!--        <init-param>
              <param-name>uploadRepositoryPath</param-name>
              <param-value>/temp</param-value>
              <description>Set the path where the intermediary files will be stored.
              </description>
          </init-param>-->
      </filter>
  
  
      <!-- Filter Mappings -->
  
      <!-- see MyFaces Filter above for a description -->
      <!--
      <filter-mapping>
          <filter-name>WelcomeFile Filter</filter-name>
          <url-pattern>/*</url-pattern>
      </filter-mapping>
      -->
  
  <!--    <filter-mapping>-->
  <!--        <filter-name>javascriptDetector</filter-name>-->
  <!--        <url-pattern>/_javascriptDetector_</url-pattern>-->
  <!--    </filter-mapping>-->
  
  
      <filter-mapping>
          <filter-name>extensionsFilter</filter-name>
          <url-pattern>*.jsf</url-pattern>
      </filter-mapping>
      <filter-mapping>
          <filter-name>extensionsFilter</filter-name>
          <url-pattern>/faces/*</url-pattern>
      </filter-mapping>
  
  
  
      <!-- Listener, that does all the startup work (configuration, init). -->
      <listener>
          <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      </listener>
  
  
      <!-- Faces Servlet -->
      <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
      </servlet>
  
  
      <!-- Faces Servlet Mapping -->
  
      <!-- virtual path mapping -->
      <!--
      <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>
      -->
  
      <!-- extension mapping -->
      <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
  
      <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
  
      <!-- source code servlet (will not work with JSF virtual path mapping) -->
      <servlet>
          <servlet-name>SourceCodeServlet</servlet-name>
          <servlet-class>org.apache.myfaces.examples.servlet.SourceCodeServlet</servlet-class>
      </servlet>
  
      <servlet-mapping>
          <servlet-name>SourceCodeServlet</servlet-name>
          <url-pattern>*.source</url-pattern>
      </servlet-mapping>
  
      <!-- Welcome files -->
  
      <welcome-file-list>
          <welcome-file>index.jsf</welcome-file>
          <welcome-file>index.jsp</welcome-file>
          <welcome-file>index.html</welcome-file>
      </welcome-file-list>
  
  
  </web-app>
  
  
  
  1.30      +15 -0     incubator-myfaces/conf/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/conf/web.xml,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- web.xml	2 Dec 2004 01:56:04 -0000	1.29
  +++ web.xml	19 Mar 2005 13:13:38 -0000	1.30
  @@ -218,6 +218,21 @@
           <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
   
  +    <servlet-mapping>
  +        <servlet-name>Faces Servlet</servlet-name>
  +        <url-pattern>*.jsf</url-pattern>
  +    </servlet-mapping>
  +
  +    <!-- source code servlet (will not work with JSF virtual path mapping) -->
  +    <servlet>
  +        <servlet-name>SourceCodeServlet</servlet-name>
  +        <servlet-class>org.apache.myfaces.examples.servlet.SourceCodeServlet</servlet-class>
  +    </servlet>
  +
  +    <servlet-mapping>
  +        <servlet-name>SourceCodeServlet</servlet-name>
  +        <url-pattern>*.source</url-pattern>
  +    </servlet-mapping>
   
       <!-- Welcome files -->
   
  
  
  
  1.2       +41 -0     incubator-myfaces/webapps/simple/forceId.jsp
  
  Index: forceId.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/simple/forceId.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- forceId.jsp	12 Mar 2005 11:40:00 -0000	1.1
  +++ forceId.jsp	19 Mar 2005 13:13:38 -0000	1.2
  @@ -65,6 +65,47 @@
                   <x:commandButton id="button" forceId="true" value="Update" action="#{user.update}"/>
               </h:column>
           </h:dataTable>
  +
  +        <br/>
  +
  +        Table data <b>without</b> forceId/forceIdIndex
  +        <br/>
  +        <h:dataTable value="#{forceIdBean.choices}" var="choice">
  +            <h:column>
  +                <h:inputText id="widget" value="#{choice}"/>
  +            </h:column>
  +        </h:dataTable>
  +
  +        <br/>
  +        Table data <b>with</b> forceId/forceIdIndex
  +        <br/>        
  +        <x:dataTable value="#{forceIdBean.choices}" var="choice">
  +            <h:column>
  +                <x:inputText id="widget" value="#{choice}" forceId="true" forceIdIndex="true"/>
  +            </h:column>            
  +        </x:dataTable>        
  +        
  +        <br/>
  +<%-- doesn't work yet (see MYFACES-91) 
  +
  +        <b>Radio buttons without forceId/forceIdIndex</b>
  +        <br/>
  +                
  +        <h:selectOneRadio id="something" value="#{forceIdBean.currentChoice}">
  +            <f:selectItem itemValue="0" itemLabel="foo"/>
  +            <f:selectItem itemValue="1" itemLabel="bar"/>
  +            <f:selectItem itemValue="2" itemLabel="buzz"/>            
  +        </h:selectOneRadio>
  +        
  +        <b>Radio buttons with forceId/forceIdIndex</b>
  +        <br/>
  +        
  +        <x:selectOneRadio id="something" forceId="true" forceIdIndex="true" value="#{forceIdBean.currentChoice}">
  +            <f:selectItem itemValue="0" itemLabel="foo"/>
  +            <f:selectItem itemValue="1" itemLabel="bar"/>
  +            <f:selectItem itemValue="2" itemLabel="buzz"/>            
  +        </x:selectOneRadio>        
  +--%>        
       </h:form>
   
   </f:view>
  
  
  

Mime
View raw message