JBoss Rich Faces SVN: r10154 - in trunk: framework/impl and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-20 15:33:35 -0400 (Wed, 20 Aug 2008)
New Revision: 10154
Modified:
trunk/cdk/pom.xml
trunk/framework/impl/pom.xml
trunk/samples/pom.xml
Log:
Clover plugin upgraded to the latest version
Modified: trunk/cdk/pom.xml
===================================================================
--- trunk/cdk/pom.xml 2008-08-20 19:23:53 UTC (rev 10153)
+++ trunk/cdk/pom.xml 2008-08-20 19:33:35 UTC (rev 10154)
@@ -44,7 +44,7 @@
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
- <artifactId>maven-clover-plugin</artifactId>
+ <artifactId>maven-clover2-plugin</artifactId>
<configuration>
<includesAllSourceRoots>
false
Modified: trunk/framework/impl/pom.xml
===================================================================
--- trunk/framework/impl/pom.xml 2008-08-20 19:23:53 UTC (rev 10153)
+++ trunk/framework/impl/pom.xml 2008-08-20 19:33:35 UTC (rev 10154)
@@ -124,7 +124,7 @@
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
- <artifactId>maven-clover-plugin</artifactId>
+ <artifactId>maven-clover2-plugin</artifactId>
<configuration>
<includesAllSourceRoots>false</includesAllSourceRoots>
</configuration>
Modified: trunk/samples/pom.xml
===================================================================
--- trunk/samples/pom.xml 2008-08-20 19:23:53 UTC (rev 10153)
+++ trunk/samples/pom.xml 2008-08-20 19:33:35 UTC (rev 10154)
@@ -409,7 +409,7 @@
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
- <artifactId>maven-clover-plugin</artifactId>
+ <artifactId>maven-clover2-plugin</artifactId>
<configuration>
<includesAllSourceRoots>
false
16 years, 5 months
JBoss Rich Faces SVN: r10153 - trunk/framework/api/src/main/java/org/ajax4jsf/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-20 15:23:53 -0400 (Wed, 20 Aug 2008)
New Revision: 10153
Modified:
trunk/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
Log:
https://jira.jboss.org/jira/browse/RF-4235
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2008-08-20 19:23:49 UTC (rev 10152)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2008-08-20 19:23:53 UTC (rev 10153)
@@ -19,4 +19,11 @@
@Documented
public @interface KeepAlive {
+ /**
+ * Boolean attribute indicating whether kept beans are accessible for all requests or AJAX-only.
+ *
+ * @return
+ * @since 3.2.2
+ */
+ boolean ajaxOnly() default false;
}
16 years, 5 months
JBoss Rich Faces SVN: r10152 - trunk/framework/impl/src/main/java/org/ajax4jsf/application.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-20 15:23:49 -0400 (Wed, 20 Aug 2008)
New Revision: 10152
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
Log:
https://jira.jboss.org/jira/browse/RF-4235
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-08-20 19:03:47 UTC (rev 10151)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-08-20 19:23:49 UTC (rev 10152)
@@ -530,13 +530,27 @@
@SuppressWarnings("unchecked")
protected void restoreAdditionalState(FacesContext context, Object state) {
if (null != state) {
+ boolean isAjax = AjaxContext.getCurrentInstance(context).isAjaxRequest();
+
// Append all saved beans to the request map.
Map beansMap = (Map) UIComponentBase.restoreAttachedState(context,
state);
Map<String, Object> requestMap = context.getExternalContext()
.getRequestMap();
for (Object key : beansMap.keySet()) {
- requestMap.put((String) key, beansMap.get(key));
+ Object bean = beansMap.get(key);
+ if (bean != null) {
+ KeepAlive annotation = bean.getClass().getAnnotation(KeepAlive.class);
+ if (annotation != null) {
+ if (!isAjax && annotation.ajaxOnly()) {
+
+ //skip ajax-only beans for non-ajax requests
+ continue;
+ }
+ }
+ }
+
+ requestMap.put((String) key, bean);
}
}
}
16 years, 5 months
JBoss Rich Faces SVN: r10151 - trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-08-20 15:03:47 -0400 (Wed, 20 Aug 2008)
New Revision: 10151
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
https://jira.jboss.org/jira/browse/RF-4232
Modified: trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-08-20 17:16:59 UTC (rev 10150)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-08-20 19:03:47 UTC (rev 10151)
@@ -398,6 +398,9 @@
* user's JavaScript API
*/
showList : function() {
+ if (this.isDisabled) {
+ return;
+ }
this.field.focus();
this.buttonClickHandler();
//this.comboList.isList = false;
16 years, 5 months
JBoss Rich Faces SVN: r10150 - trunk/ui/tree/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-20 13:16:59 -0400 (Wed, 20 Aug 2008)
New Revision: 10150
Modified:
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
Log:
https://jira.jboss.org/jira/browse/RF-3699
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-08-20 17:00:39 UTC (rev 10149)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-08-20 17:16:59 UTC (rev 10150)
@@ -183,9 +183,15 @@
/**
* Return the data object representing the node for the currently
- * selected row key, if any
+ * selected row key, if any.
+ *
+ * <p>
+ * Adaptor-based trees do not use {@link TreeNode}, so the method always return
+ * <code>null</code> for such trees. Please use {@link #getRowData()} instead.
+ * </p>
*
- * @return {@link TreeNode} instance corresponding to the current row key
+ * @return {@link TreeNode} instance corresponding to the current row key or
+ * <code>null</code> if none exist
*/
public TreeNode getTreeNode() {
return ((AbstractTreeDataModel) getExtendedDataModel()).getTreeNode();
16 years, 5 months
JBoss Rich Faces SVN: r10149 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-08-20 13:00:39 -0400 (Wed, 20 Aug 2008)
New Revision: 10149
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java
Log:
https://jira.jboss.org/jira/browse/RF-4218
Modified: trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java 2008-08-20 14:07:15 UTC (rev 10148)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java 2008-08-20 17:00:39 UTC (rev 10149)
@@ -25,7 +25,9 @@
import java.util.Iterator;
import java.util.Map;
+import javax.faces.component.NamingContainer;
+
/**
* Interface representing tree ADT nodes
* @author Nick Belaevski - nbelaevski(a)exadel.com
@@ -51,13 +53,32 @@
public boolean isLeaf();
/**
- * getter for children
+ * Getter for children entries. Each children entry contains identifier (key) and child node (value).
+ *
+ * Identifiers are used to generate model keys representing paths to tree node. Model keys are used:
+ * <ol>
+ * <li>
+ * For persisting tree state. That means that identifiers should be serializable when
+ * some JSF features are used, e.g. client-side state saving.
+ * </li>
+ * <li>
+ * For constructing client identifiers. Client identifier for tree nodes consists of
+ * {@link Object#toString()} representations of identifier separated with
+ * {@link NamingContainer#SEPARATOR_CHAR} chars. String representation of identifier
+ * should be a valid XML ID, e.g. conform to this: <a href="http://www.w3.org/TR/xml11/#NT-Name">
+ * XML Name Production</a>
+ * production.
+ * </li>
+ * </ol>
+ *
* @return {@link Iterator} of {@link Map.Entry} instances containing {@link TreeNode} as values
- * and their identifiers as keys
+ * and their identifiers as keys.
+ *
*/
public Iterator<Map.Entry<Object, TreeNode<T>>> getChildren();
/**
* find child by id
+ * Please see {@link #getChildren()} for more information about identifier constraints.
* @param id identifier of the child to find
* @return designated {@link TreeNode} instance or <code>null</code>
*/
@@ -65,12 +86,14 @@
/**
* adds child to children collection
- * @param identifier child identifier
+ * @param identifier child identifier.
+ * Please see {@link #getChildren()} for more information about identifier constraints.
* @param child child
*/
public void addChild(Object identifier, TreeNode<T> child);
/**
+ * Please see {@link #getChildren()} for more information about identifier constraints.
* removes child from children collection by child id
* @param id id of the child to remove
*/
16 years, 5 months
JBoss Rich Faces SVN: r10148 - trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-08-20 10:07:15 -0400 (Wed, 20 Aug 2008)
New Revision: 10148
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
commented some code unable to work
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2008-08-20 11:50:50 UTC (rev 10147)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2008-08-20 14:07:15 UTC (rev 10148)
@@ -17,14 +17,8 @@
renderPage(template);
String parentId = getParentId() + "_form:";
+ String linkId = null;
- String linkId = parentId + "l1";
- writeStatus("Click link 1");
- clickCommandAndWait(linkId);
- assertValueSubmitted(true);
- assertActionInvoked(true);
- assertListenerInvoked(true);
-
linkId = parentId + "l2";
writeStatus("Click link 2");
clickCommandAndWait(linkId);
@@ -46,6 +40,12 @@
assertActionInvoked(true);
assertListenerInvoked(true);
+// linkId = parentId + "l1";
+// writeStatus("Click link 1");
+// clickCommandAndWait(linkId);
+// assertValueSubmitted(true);
+// assertActionInvoked(true);
+// assertListenerInvoked(true);
}
private void assertValueSubmitted(boolean submitted) {
16 years, 5 months
JBoss Rich Faces SVN: r10147 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2008-08-20 07:50:50 -0400 (Wed, 20 Aug 2008)
New Revision: 10147
Modified:
trunk/docs/userguide/en/src/main/docbook/included/keepAlive.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml
Log:
RF-4216: AjaxKeepAlive is not a component
Modified: trunk/docs/userguide/en/src/main/docbook/included/keepAlive.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/keepAlive.desc.xml 2008-08-20 11:25:57 UTC (rev 10146)
+++ trunk/docs/userguide/en/src/main/docbook/included/keepAlive.desc.xml 2008-08-20 11:50:50 UTC (rev 10147)
@@ -1,16 +1,17 @@
<?xml version='1.0' encoding='UTF-8'?>
<chapter>
-<section>
- <sectioninfo>
- <keywordset>
- <keyword>a4j:keepAlive</keyword>
- </keywordset>
- </sectioninfo>
-
- <title>Description</title>
- <para>The <emphasis role="bold">
- <property><a4j:keepAlive></property>
- </emphasis> component allows to keep a state of each bean between requests.</para>
+ <section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>a4j:keepAlive</keyword>
+ </keywordset>
+ </sectioninfo>
-</section>
-</chapter>
\ No newline at end of file
+ <title>Description</title>
+ <para>The <emphasis role="bold">
+ <property><a4j:keepAlive></property>
+ </emphasis> tag allows to keep a state of a bean between
+ requests.</para>
+
+ </section>
+</chapter>
Modified: trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml 2008-08-20 11:25:57 UTC (rev 10146)
+++ trunk/docs/userguide/en/src/main/docbook/included/keepAlive.xml 2008-08-20 11:50:50 UTC (rev 10147)
@@ -1,84 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter>
- <chapterinfo>
- <keywordset>
- <keyword>a4j:keepAlive</keyword>
- </keywordset>
- </chapterinfo>
- <table>
- <title>Component identification parameters </title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Name</entry>
- <entry>Value</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>component-type</entry>
- <entry>org.ajax4jsf.components.KeepAlive</entry>
- </row>
- <row>
- <entry>component-family</entry>
- <entry>org.ajax4jsf.components.AjaxKeepAlive</entry>
- </row>
- <row>
- <entry>component-class</entry>
- <entry>org.ajax4jsf.components.AjaxKeepAlive</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <section>
- <title>Creating the Component with a Page Tag</title>
+ <chapterinfo>
+ <keywordset>
+ <keyword>a4j:keepAlive</keyword>
+ </keywordset>
+ </chapterinfo>
+ <table>
+ <title>Tag identification parameters </title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.ajax4jsf.components.KeepAlive</entry>
+ </row>
+ <row>
+ <entry>component-family</entry>
+ <entry>org.ajax4jsf.components.AjaxKeepAlive</entry>
+ </row>
+ <row>
+ <entry>component-class</entry>
+ <entry>org.ajax4jsf.components.AjaxKeepAlive</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
- <para>To create the simplest variant on a page use the following syntax:</para>
+ <section id="a4jkalpagetag" role="updated">
+ <title>Using the tag on a Page</title>
- <para>
- <emphasis role="bold">Example:</emphasis> </para>
- <programlisting role="XML"><![CDATA[<a4j:keepAlive beanName = "testBean"/>]]></programlisting>
-
- </section>
-
- <section>
- <title>Creating the Component Dynamically Using Java</title>
+ <para>To create the simplest variant on a page use the following syntax:</para>
- <para>
- <emphasis role="bold">Example:</emphasis> </para>
-
- <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.ajax.AjaxKeepAlive;
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[<a4j:keepAlive beanName = "testBean"/>]]></programlisting>
+ <para>Note, that to be put into the request scope the pointed bean should be registered inside faces-config.xml file and marked with <property>org.ajax4jsf.model.KeepAlive</property> annotation.
+ </para>
+ </section>
+
+ <!-- There's no AjaxKeepAlive component nor AjaxKeepAlive class and it cannot be created programmatically and there's no need for that.
+
+ <section>
+ <title>Creating the Component Dynamically Using Java</title>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.ajax.AjaxKeepAlive;
...
AjaxKeepAlive myKeepAlive = new AjaxKeepAlive();
-...
- ]]></programlisting>
-
- </section>
+...]]></programlisting>
+ </section>
+ -->
+
+ <section>
+ <title>Key attributes and ways of usage</title>
+ <para> If a managed bean is declared with <property>request</property> scope in
+ the configuration file with the help of <emphasis role="bold">
+ <property><managed-bean-scope></property>
+ </emphasis> tag then the life-time of this bean instance is valid only
+ for the current request. Any attempts to make a reference to the bean
+ instance after the request end will throw in Illegal Argument
+ Exception by the server. To avoid these kinds of Exception, component
+ <emphasis role="bold">
+ <property><a4j:keepAlive></property>
+ </emphasis> is used to maintain the state of the whole bean object
+ among subsequent request. </para>
- <section>
- <title>Key attributes and ways of usage</title>
- <para>
- If a managed bean is declared with <property>request</property> scope in the configuration file with the help of
- <emphasis role="bold"><property><managed-bean-scope></property></emphasis> tag then the life-time of
- this bean instance is valid only for the current request.
- Any attempts to make a reference to the bean instance after the request end will throw in Illegal Argument Exception by the server.
- To avoid these kinds of Exception, component <emphasis role="bold"><property><a4j:keepAlive></property></emphasis>
- is used to maintain the state of the whole bean object among subsequent request.
- </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
+ <programlisting role="XML"><![CDATA[<a4j:keepAlive beanName = "#{myClass.testBean}"/>]]></programlisting>
- <programlisting role="XML"><![CDATA[<a4j:keepAlive beanName = "#{myClass.testBean}"/>]]></programlisting>
-
- <para>
- The <emphasis><property>"beanName"</property></emphasis> attribute defines the request scope bean name you'd like
- to re-use. Note that this attribute must point to a legal JSF EL expression which resolves to a managed mean instance. For example for
- the above code the class definition may look like this one:
- </para>
- <programlisting role="JAVA"><![CDATA[
+ <para> The <emphasis>
+ <property>"beanName"</property>
+ </emphasis> attribute defines the request scope bean name
+ you'd like to re-use. Note that this attribute must point to
+ a legal JSF EL expression which resolves to a managed mean instance.
+ For example for the above code the class definition may look like this
+ one: </para>
+ <programlisting role="JAVA"><![CDATA[
class MyClass{
...
private TestBean testBean;
@@ -86,20 +93,25 @@
...
}
]]></programlisting>
- <para>
- The <emphasis><property>"ajaxOnly"</property></emphasis> attribute
- declares whether the value of the bean should be available during a non-Ajax request.
- If the value of this attribute is "true" a request scope bean keeps the same value during Ajax requests
- from the given page. If a non-Ajax request is sent from this page the bean is re-created as a regular request scope bean.
- </para>
- </section>
- <section>
- <title>Relevant resources links</title>
- <para><ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/keepAlive.jsf?c=keepA..."
- >Here</ulink> you can see the example of <emphasis role="bold"
- ><property><a4j:keepAlive></property></emphasis> usage and sources for the given example. </para>
- <para>
- Some additional information about usage of component can be found <ulink url="http://jboss.com/index.html?module=bb&op=viewtopic&t=104989">here</ulink>.
- </para>
- </section>
-</chapter>
\ No newline at end of file
+ <para> The <emphasis>
+ <property>"ajaxOnly"</property>
+ </emphasis> attribute declares whether the value of the bean should be
+ available during a non-Ajax request. If the value of this attribute is
+ "true" a request scope bean keeps the same value
+ during Ajax requests from the given page. If a non-Ajax request is
+ sent from this page the bean is re-created as a regular request scope
+ bean. </para>
+ </section>
+ <section>
+ <title>Relevant resources links</title>
+ <para><ulink
+ url="http://livedemo.exadel.com/richfaces-demo/richfaces/keepAlive.jsf?c=keepA..."
+ >Here</ulink> you can see the example of <emphasis
+ role="bold">
+ <property><a4j:keepAlive></property>
+ </emphasis> usage and sources for the given example. </para>
+ <para> Some additional information about usage of component can be found <ulink
+ url="http://jboss.com/index.html?module=bb&op=viewtopic&t=104989"
+ >here</ulink>. </para>
+ </section>
+</chapter>
16 years, 5 months
JBoss Rich Faces SVN: r10146 - trunk/ui/virtualEarth/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2008-08-20 07:25:57 -0400 (Wed, 20 Aug 2008)
New Revision: 10146
Modified:
trunk/ui/virtualEarth/src/main/config/component/virtualEarth.xml
Log:
https://jira.jboss.org/jira/browse/RF-4155
Modified: trunk/ui/virtualEarth/src/main/config/component/virtualEarth.xml
===================================================================
--- trunk/ui/virtualEarth/src/main/config/component/virtualEarth.xml 2008-08-20 10:56:30 UTC (rev 10145)
+++ trunk/ui/virtualEarth/src/main/config/component/virtualEarth.xml 2008-08-20 11:25:57 UTC (rev 10146)
@@ -92,7 +92,7 @@
<description>
Virtual earth version, Default value is "6".
</description>
- <defaultvalue>"6"</defaultvalue>
+ <defaultvalue>"6.1"</defaultvalue>
</property>
</component>
</components>
16 years, 5 months
JBoss Rich Faces SVN: r10145 - trunk/docs/faq/en/src/main/docbook/module.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-08-20 06:56:30 -0400 (Wed, 20 Aug 2008)
New Revision: 10145
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
https://jira.jboss.org/jira/browse/RF-4234 - 'How to add cookie in an AJAX Respond?' was added to FAQ.
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-08-19 17:37:04 UTC (rev 10144)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-08-20 10:56:30 UTC (rev 10145)
@@ -1875,8 +1875,8 @@
<section id="OneRowSelectionInDataTable">
<?dbhtml filename="HighlightRowDataTable.html"?>
- <title>How to select one row of a dataTable by clicking on it, even if clicked
- in an inputText of this row?</title>
+ <title>How to select one row of a <rich:dataTable> by clicking on it, even if clicked
+ in an <h:inputText> of this row?</title>
<para>In order to select one row of a dataTable by clicking on it you could use
JavaScript function described below. </para>
<para>
@@ -1897,7 +1897,7 @@
</script>
...]]></programlisting>
<para>Then you could use <emphasis role="bold">
- <property>a4j:support</property>
+ <property><a4j:support></property>
</emphasis> with <emphasis>
<property>"event"</property>
</emphasis> and <emphasis>
@@ -2612,4 +2612,58 @@
</context-param>
...]]></programlisting>
</section>
+ <section id="ajaxCookie">
+ <?dbhtml filename="ajaxCookie.html"?>
+ <title>How to add cookie in an AJAX Respond?</title>
+ <para>
+ In order to add cookie in an AJAX Respond you could use bean described below.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="JAVA"><![CDATA[...
+public class CookieBean {
+
+ private String testCookie = null;
+
+ public String setTestCookie() {
+ ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
+ HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
+ Cookie cookie = new Cookie("test", "Setted at time " + System.currentTimeMillis());
+ cookie.setMaxAge(60 * 60 * 24 * 365);
+ response.addCookie(cookie);
+ return "verify_cookie";
+ }
+
+ public String getTestCookie() {
+ ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
+ HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
+ Cookie[] cookies = request.getCookies();
+ for (int i = 0; i < cookies.length; i++) {
+ if (cookies[i].getName().equals("test")) {
+ testCookie = cookies[i].getValue();
+ return testCookie;
+ }
+ }
+ return null;
+ }
+}
+...]]></programlisting>
+ <para>
+ Then you could try to set cookie with AJAX Respond as it is shown in the following example.
+ After the cookie "test" is set the value of this cookie appears on a page.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<h:form>
+ <h:outputText id="text" value="Cookie value: #{cookieBean.testCookie}"/>
+ <br />
+ <a4j:commandButton action="#{cookieBean.setTestCookie}" value="Set Cookie by AJAX">
+ <a4j:support event="oncomplete" reRender="text" />
+ </a4j:commandButton>
+</h:form>
+...]]></programlisting>
+ </section>
</chapter>
16 years, 5 months