You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/08/10 00:09:33 UTC
svn commit: r684363 - in /myfaces/commons/trunk/myfaces-commons-examples: ./
src/main/java/org/apache/myfaces/commons/servlet/
src/main/java/org/apache/myfaces/examples/validate/
src/main/resources/org/apache/myfaces/examples/resource/ src/main/webapp/...
Author: lu4242
Date: Sat Aug 9 15:09:31 2008
New Revision: 684363
URL: http://svn.apache.org/viewvc?rev=684363&view=rev
Log:
added SourceCodeServlet.java and test for mcc:convertEnum
Added:
myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/
myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java (with props)
myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java (with props)
myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java (with props)
myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp (with props)
Modified:
myfaces/commons/trunk/myfaces-commons-examples/pom.xml
myfaces/commons/trunk/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml
myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp
myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp
Modified: myfaces/commons/trunk/myfaces-commons-examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/pom.xml?rev=684363&r1=684362&r2=684363&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/pom.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/pom.xml Sat Aug 9 15:09:31 2008
@@ -59,6 +59,12 @@
</repositories>
<dependencies>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<scope>compile</scope>
Added: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java?rev=684363&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java (added)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java Sat Aug 9 15:09:31 2008
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.myfaces.commons.servlet;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+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.lastIndexOf(".source");
+
+ webPage = webPage.substring(0, chopPoint);
+
+ if(webPage.endsWith(".jsf"))
+ {
+ int jsfChopPoint = webPage.lastIndexOf(".jsf");
+
+ webPage = webPage.substring(0, jsfChopPoint);
+
+ webPage += ".jsp"; // replace jsf with jsp
+
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else if(webPage.endsWith(".jsp"))
+ {
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else if(webPage.endsWith(".jspx"))
+ {
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else if(webPage.endsWith(".xhtml"))
+ {
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else
+ {
+ int beginChopPoint = webPage.lastIndexOf("/");
+ int extensionChopPoint = webPage.lastIndexOf(".java");
+
+ webPage = webPage.substring(beginChopPoint+1,extensionChopPoint);
+
+ try
+ {
+
+ // get the actual file location of the requested resource; try it in classes first
+ String realPath = getServletConfig().getServletContext().getRealPath("/WEB-INF/classes/"+webPage.replace('.','/')+".java");
+
+ outputFile(res, realPath);
+ }
+ catch(Exception e)
+ {
+ //classes hasn't worked. How about src?
+ String realPath = getServletConfig().getServletContext().getRealPath("/WEB-INF/src/"+webPage.replace('.','/')+".java");
+
+ outputFile(res, realPath);
+ }
+
+ }
+ }
+
+ private void outputFile(HttpServletResponse res, String realPath)
+ throws IOException
+ {
+ // 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
+ }
+ }
+}
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java?rev=684363&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java (added)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java Sat Aug 9 15:09:31 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.myfaces.examples.validate;
+
+public enum EducationLevel
+{
+ NONE,
+ PRIMARY,
+ SECUNDARY,
+ UNIVERSITY,
+ MASTER,
+ DOCTOR
+}
\ No newline at end of file
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java?rev=684363&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java (added)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java Sat Aug 9 15:09:31 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.myfaces.examples.validate;
+
+public class ValidateEnum
+{
+
+ private EducationLevel level;
+
+ public EducationLevel getLevel()
+ {
+ return level;
+ }
+
+ public void setLevel(EducationLevel level)
+ {
+ this.level = level;
+ }
+
+}
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties?rev=684363&r1=684362&r2=684363&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties Sat Aug 9 15:09:31 2008
@@ -6,6 +6,7 @@
validate_email = Email
validate_credit = Credit Card
validate_url = Url
+validate_enum = Enumeration (NONE,PRIMARY,SECUNDARY,UNIVERSITY,MASTER,DOCTOR)
validate_regexp = Regular Expression(bat,cat,rat are valid values)
validate_isbn = ISBN
validate_base = Base value
@@ -14,4 +15,4 @@
validate_greaterthan = Validate Greater Than
validate_greaterthanequal = Validate Greater Than Equal
validate_lessthan = Validate Less Than
-validate_lessthanequal = Validate Less Than Equal
\ No newline at end of file
+validate_lessthanequal =Validate Less Than Equal
\ No newline at end of file
Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml?rev=684363&r1=684362&r2=684363&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml Sat Aug 9 15:09:31 2008
@@ -1,20 +1,21 @@
<?xml version="1.0"?>
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <managed-bean>
- <managed-bean-name>dataFieldHolder</managed-bean-name>
- <managed-bean-class>
- org.apache.myfaces.commons.examples.DataFieldHolder
- </managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
- <!-- validation -->
- <managed-bean>
- <managed-bean-name>validateForm</managed-bean-name>
- <managed-bean-class>
- org.apache.myfaces.examples.validate.ValidateForm
- </managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <managed-bean-name>dataFieldHolder</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.commons.examples.DataFieldHolder</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <!-- validation -->
+ <managed-bean>
+ <managed-bean-name>validateForm</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.validate.ValidateForm</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>validateEnum</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.validate.ValidateEnum</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml?rev=684363&r1=684362&r2=684363&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml Sat Aug 9 15:09:31 2008
@@ -1,75 +1,76 @@
<?xml version="1.0"?>
<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
-->
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
<description>MyProject web.xml</description>
<!--optional: context-param>
<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
- Attention: You do not need to put /WEB-INF/faces-config.xml in here.
+ (e.g. /WEB-INF/my-config.xml)
+ See JSF 1.0 PRD2, 10.3.2
+ Attention: You do not need to put /WEB-INF/faces-config.xml in here.
</description>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/examples-config.xml</param-value>
- </context-param-->
+ </context-param-->
<context-param>
- <description>State saving method: "client" or "server" (= default)
- See JSF Specification 2.5.3</description>
+ <description>State saving method: "client" or "server" (= default) See JSF Specification 2.5.3</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
- <description>Only applicable if state saving method is "server" (= default).
- Defines the amount (default = 20) of the latest views are stored in session.</description>
+ <description>
+ Only applicable if state saving method is "server" (= default). Defines the amount (default = 20) of the
+ latest views are stored in session.
+ </description>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>20</param-value>
</context-param>
<context-param>
- <description>Only applicable if state saving method is "server" (= default).
- If true (default) the state will be serialized to a byte stream before it
- is written to the session.
- If false the state will not be serialized to a byte stream.</description>
+ <description>
+ Only applicable if state saving method is "server" (= default). If true (default) the state will be
+ serialized to a byte stream before it is written to the session. If false the state will not be serialized
+ to a byte stream.
+ </description>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <description>Only applicable if state saving method is "server" (= default) and if
- org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default)
- If true (default) the serialized state will be compressed before it
- is written to the session. If false the state will not be compressed.</description>
+ <description>
+ Only applicable if state saving method is "server" (= default) and if
+ org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default) If true (default) the serialized state
+ will be compressed before it is written to the session. If false the state will not be compressed.
+ </description>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <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>
+ <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>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
@@ -78,55 +79,49 @@
<param-value>false</param-value>
</context-param>
<context-param>
- <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>
+ <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>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <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>
+ <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>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <description>Used for encrypting view state. Only relevant for client side
- state saving. See MyFaces wiki/web site documentation for instructions
- on how to configure an application for diffenent encryption strengths.
+ <description>
+ Used for encrypting view state. Only relevant for client side state saving. See MyFaces wiki/web site
+ documentation for instructions on how to configure an application for diffenent encryption strengths.
</description>
<param-name>org.apache.myfaces.SECRET</param-name>
<param-value>NzY1NDMyMTA=</param-value>
</context-param>
<context-param>
- <description>
- Validate managed beans, navigation rules and ensure that forms are not nested.
- </description>
+ <description>Validate managed beans, navigation rules and ensure that forms are not nested.</description>
<param-name>org.apache.myfaces.VALIDATE</param-name>
<param-value>true</param-value>
</context-param>
-
+
<context-param>
- <description>
- Treat readonly same as if disabled attribute was set for select elements.
- </description>
+ <description>Treat readonly same as if disabled attribute was set for select elements.</description>
<param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
<param-value>true</param-value>
- </context-param>
-
+ </context-param>
+
<context-param>
- <description>
- Define partial state saving as true/false.
- </description>
+ <description>Define partial state saving as true/false.</description>
<param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
<param-value>false</param-value>
- </context-param>
+ </context-param>
<!-- Faces Servlet -->
<servlet>
@@ -135,12 +130,22 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <servlet-name>SourceCodeServlet</servlet-name>
+ <servlet-class>org.apache.myfaces.commons.servlet.SourceCodeServlet</servlet-class>
+ </servlet>
+
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>SourceCodeServlet</servlet-name>
+ <url-pattern>*.source</url-pattern>
+ </servlet-mapping>
+
<!-- Welcome files -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Added: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp?rev=684363&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp (added)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp Sat Aug 9 15:09:31 2008
@@ -0,0 +1,78 @@
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/converters"
+ prefix="mcc"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/validators"
+ prefix="mcv"%>
+
+<html>
+
+<%@include file="inc/head.inc"%>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+//-->
+
+<body>
+
+<!--
+managed beans used:
+ validateForm
+-->
+
+<f:view>
+
+ <f:loadBundle
+ basename="org.apache.myfaces.examples.resource.example_messages"
+ var="example_messages" />
+
+ <h:panelGroup id="body">
+
+ <h:form id="form1">
+ <h:messages showDetail="false" showSummary="true" ></h:messages>
+ <h:panelGrid columns="3">
+
+ <h:outputLabel for="enum"
+ value="#{example_messages['validate_enum']}" />
+ <h:inputText id="enum" value="#{validateEnum.level}" required="true">
+ <mcc:convertEnum
+ targetClass="org.apache.myfaces.examples.validate.ValidateEnum" />
+ </h:inputText>
+ <h:message id="enumError" for="enum" styleClass="error" />
+
+ <h:panelGroup />
+ <h:commandButton id="validateButton"
+ value="#{example_messages['button_submit']}"
+ action="#{validateForm.submit}" />
+ <h:panelGroup />
+
+ </h:panelGrid>
+ </h:form>
+
+ </h:panelGroup>
+
+</f:view>
+
+<%@include file="inc/page_footer.jsp"%>
+
+</body>
+
+</html>
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/convertEnum.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp?rev=684363&r1=684362&r2=684363&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/home.jsp Sat Aug 9 15:09:31 2008
@@ -46,7 +46,13 @@
</h:outputLink>
<h:outputLink value="validateCSV.jsf">
<f:verbatim>ValidateCSV</f:verbatim>
- </h:outputLink>
+ </h:outputLink>
+ <h:outputLink value="validateUrl.jsf">
+ <f:verbatim>ValidateUrl</f:verbatim>
+ </h:outputLink>
+ <h:outputLink value="convertEnum.jsf">
+ <f:verbatim>ConvertEnum</f:verbatim>
+ </h:outputLink>
</h:panelGrid>
</h:form>
Modified: myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp?rev=684363&r1=684362&r2=684363&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp (original)
+++ myfaces/commons/trunk/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp Sat Aug 9 15:09:31 2008
@@ -2,3 +2,5 @@
<br/>
<a href="home.jsf">[HOME]</a>
+
+<a href="<%=request.getRequestURI()%>.source">[SOURCE]</a>