Author: ilya_shaikovsky
Date: 2010-05-28 05:37:03 -0400 (Fri, 28 May 2010)
New Revision: 17343
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/param/
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/param/ParamBean.java
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/clientParam.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/param.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/skinChange.xhtml
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
Log:
https://jira.jboss.org/browse/RF-8294
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java 2010-05-28
09:12:41 UTC (rev 17342)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java 2010-05-28
09:37:03 UTC (rev 17343)
@@ -1,10 +1,10 @@
package org.richfaces.demo.common;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.RequestScoped;
@ManagedBean(name = "userBean")
-@SessionScoped
+@RequestScoped
public class UserBean {
private String name = "";
private String email = "";
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/param/ParamBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/param/ParamBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/param/ParamBean.java 2010-05-28
09:37:03 UTC (rev 17343)
@@ -0,0 +1,34 @@
+package org.richfaces.demo.param;
+
+import java.io.Serializable;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+
+@ManagedBean
+@RequestScoped
+public class ParamBean implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5704132574704883576L;
+ private String screenWidth;
+ private String screenHeight;
+
+ public String getScreenWidth() {
+ return screenWidth;
+ }
+
+ public void setScreenWidth(String screenWidth) {
+ this.screenWidth = screenWidth;
+ }
+
+ public String getScreenHeight() {
+ return screenHeight;
+ }
+
+ public void setScreenHeight(String screenHeight) {
+ this.screenHeight = screenHeight;
+ }
+}
Modified:
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-28
09:12:41 UTC (rev 17342)
+++
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-28
09:37:03 UTC (rev 17343)
@@ -72,6 +72,24 @@
</sample>
</samples>
</demo>
+ <demo new="true">
+ <id>param</id>
+ <name>a4j:param</name>
+ <samples>
+ <sample>
+ <id>param</id>
+ <name>Param Simple Usage</name>
+ </sample>
+ <sample>
+ <id>skinChange</id>
+ <name>Parameters for non-Ajax components</name>
+ </sample>
+ <sample>
+ <id>clientParam</id>
+ <name>Parameters from client side</name>
+ </sample>
+ </samples>
+ </demo>
</demos>
</group>
<group>
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/clientParam.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/clientParam.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/clientParam.xhtml 2010-05-28
09:37:03 UTC (rev 17343)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+ <p>It is possible to use javascript variable of custom function for the
'value' attribute.
+ In this case the 'noEscape' attribute should be set to true. When
noEscape="true", the
+ 'value' can contain any javascript expression or javascript function invocation
and the
+ result of them will be send to the server as a value of a4j:actionparam. The following
+ example demonstrates how to assign the backing bean with browser screen size
values.</p>
+ <h:form>
+ <a4j:commandButton value="Show Screen Size"
render="infoPanel">
+ <a4j:param name="w" value="screen.width"
+ assignTo="#{paramBean.screenWidth}" noEscape="true" />
+ <a4j:param name="h" value="screen.height"
+ assignTo="#{paramBean.screenHeight}" noEscape="true" />
+ </a4j:commandButton>
+ <br />
+ <rich:panel id="infoPanel">
+ <h:panelGrid columns="2" >
+ <h:outputText value="Width:" />
+ <h:outputText value="#{paramBean.screenWidth}" />
+ <h:outputText value="Height:" />
+ <h:outputText value="#{paramBean.screenHeight}" />
+ </h:panelGrid>
+ </rich:panel>
+ </h:form>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added: root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/param.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/param.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/param.xhtml 2010-05-28
09:37:03 UTC (rev 17343)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+<p>
+a4j:actionparam is a component which extends regular f:param with the possibility to
+assign the value to the property of the manager bean directly using the assignTo
attribute.
+Using this feature you can update model values without invoking even a single line of
java code on the
+ server side.</p>
+ <h:form>
+ <rich:panel>
+ <h:panelGrid columns="2">
+ <a4j:commandButton value="Set Name to Alex" render="rep">
+ <a4j:param name="username" value="Alex"
assignTo="#{userBean.name}" />
+ </a4j:commandButton>
+
+ <a4j:commandButton value="Set Name to John" render="rep">
+ <a4j:param name="username" value="John"
+ assignTo="#{userBean.name}" />
+ </a4j:commandButton>
+ </h:panelGrid>
+ </rich:panel>
+<br/>
+ <rich:panel>
+ <h:outputText id="rep" value="Selected Name:#{userBean.name}"
/>
+ </rich:panel>
+ </h:form>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/skinChange.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/skinChange.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/param/skinChange.xhtml 2010-05-28
09:37:03 UTC (rev 17343)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+ <p>You can use a4j:param not only with ajax components, but with non-ajax command
+ components and for GET navigation components also. In the following example, the used
skin of the demo is changed when
+ the whole page is refreshed with the regular h:link. </p>
+ <h:form>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Change Demo Appplication Skin To: " />
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:link value="DeepMarine" includeViewParams="true">
+ <a4j:param name="skin" value="deepMarine"
+ assignTo="#{skinBean.skin}" />
+ </h:link>
+
+ <h:link value="BlueSky" includeViewParams="true">
+ <a4j:param name="skin" value="blueSky"
assignTo="#{skinBean.skin}" />
+ </h:link>
+ </h:panelGrid>
+
+ </rich:panel>
+ </h:form>
+</ui:composition>
+
+</html>
\ No newline at end of file