Author: maksimkaszynski
Date: 2007-10-25 11:15:16 -0400 (Thu, 25 Oct 2007)
New Revision: 3541
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
Log:
http://jira.jboss.com/jira/browse/RF-999
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
===================================================================
---
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -22,16 +22,16 @@
package org.ajax4jsf.taglib.html.jsp;
import javax.el.ValueExpression;
-import javax.faces.application.Application;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.UIActionParameter;
import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+import org.richfaces.webapp.taglib.ValueBindingValueExpressionAdaptor;
/**
@@ -63,17 +63,18 @@
// value already implemented in UIComponentTagBase
private ValueExpression _name;
private ValueExpression _assignTo;
- private String _converter;
- private String _noEscape;
+ private ValueExpression _converter;
+ private ValueExpression _noEscape;
protected void setProperties(UIComponent component)
{
super.setProperties(component);
- setStringProperty(component, "name", _name.getExpressionString());
+ setStringProperty(component, "name", _name);
setBooleanProperty(component, "noEscape", _noEscape);
//Find parent UIComponentTag
- UIComponentTag componentTag =
UIComponentTag.getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase componentTag =
+ UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (componentTag == null)
{
throw new
IllegalArgumentException(Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR,
"ActionParameterTag"));
@@ -85,16 +86,19 @@
UIComponent parentComponent = componentTag.getComponentInstance();
if (parentComponent instanceof ActionSource)
{
- FacesContext facesContext = FacesContext.getCurrentInstance();
- Application application = facesContext.getApplication();
- if (_assignTo != null) {
- if
(!UIComponentTag.isValueReference(_assignTo.getExpressionString())) throw new
IllegalArgumentException(Messages.getMessage(Messages.NO_VALUE_REFERENCE_ERROR_2,
_assignTo));
+
+ if (_assignTo != null) {
+ if (_assignTo.isLiteralText()) throw new
IllegalArgumentException(Messages.getMessage(Messages.NO_VALUE_REFERENCE_ERROR_2,
_assignTo));
UIActionParameter al = (UIActionParameter)component;
-
al.setAssignToBinding(application.createValueBinding(_assignTo.getExpressionString()));
+ al.setAssignToBinding(new
ValueBindingValueExpressionAdaptor(_assignTo));
if (_converter != null)
{
- Converter converter = application.createConverter(_converter);
- al.setConverter(converter);
+ if (!_converter.isLiteralText()) {
+ component.setValueExpression("converter", _converter);
+ } else {
+ Converter conv =
FacesContext.getCurrentInstance().getApplication().createConverter(_converter.getExpressionString());
+ al.setConverter(conv);
+ }
}
((ActionSource)parentComponent).addActionListener(al);
}
@@ -111,7 +115,7 @@
/**
* @param converter The converter to set.
*/
- public void setConverter(String converter)
+ public void setConverter(ValueExpression converter)
{
this._converter = converter;
}
@@ -119,7 +123,7 @@
/**
* @param noEscape The noEscape to set.
*/
- public void setNoEscape(String noEscape)
+ public void setNoEscape(ValueExpression noEscape)
{
this._noEscape = noEscape;
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
===================================================================
---
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -21,11 +21,10 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.el.ReferenceSyntaxException;
-import javax.faces.el.ValueBinding;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;
@@ -34,6 +33,7 @@
import org.ajax4jsf.event.AjaxListener;
import org.ajax4jsf.event.AjaxListenerHelper;
import org.ajax4jsf.event.AjaxSource;
+import org.richfaces.webapp.taglib.ValueBindingValueExpressionAdaptor;
/**
@@ -51,9 +51,9 @@
/**
* class name for ajax events listener.
*/
- private String type = null;
+ private ValueExpression type = null;
- private String binding = null;
+ private ValueExpression binding = null;
/**
*
@@ -61,14 +61,14 @@
public AjaxListenerTag() {
}
- public void setType(String type) {
+ public void setType(ValueExpression type) {
this.type = type;
}
/**
* @param binding the binding to set
*/
- public void setBinding(String binding) {
+ public void setBinding(ValueExpression binding) {
this.binding = binding;
}
@@ -78,8 +78,8 @@
}
//Find parent UIComponentTag
- UIComponentTag componentTag = UIComponentTag
- .getParentUIComponentTag(pageContext);
+ UIComponentClassicTagBase componentTag =
+ UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (componentTag == null) {
throw new JspException(
Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR,
"AjaxListenerTag"));
@@ -91,28 +91,13 @@
if (component instanceof AjaxSource) {
AjaxListener listener;
if(null != binding){
- ValueBinding valueBinding;
- try {
- valueBinding =
FacesContext.getCurrentInstance().getApplication().createValueBinding(binding);
- } catch (ReferenceSyntaxException e) {
- throw new JspException(e);
- }
- listener = new AjaxListenerHelper(valueBinding);
+ listener = new AjaxListenerHelper(new
ValueBindingValueExpressionAdaptor(binding));
} else {
- String className;
- if (UIComponentTag.isValueReference(type)) {
- FacesContext facesContext = FacesContext
- .getCurrentInstance();
- ValueBinding valueBinding = facesContext.getApplication()
- .createValueBinding(type);
- className = (String) valueBinding.getValue(facesContext);
- } else {
- className = type;
- }
try {
+ String className = (String)
type.getValue(FacesContext.getCurrentInstance().getELContext());
listener = (AjaxListener) Class.forName(className).newInstance();
} catch (Exception e) {
- throw new
JspException(Messages.getMessage(Messages.INSTANTIATE_LISTENER_ERROR, className,
component.getId()), e);
+ throw new
JspException(Messages.getMessage(Messages.INSTANTIATE_LISTENER_ERROR, type,
component.getId()), e);
}
}
((AjaxSource) component).addAjaxListener(listener);
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxPageTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -21,6 +21,7 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import org.ajax4jsf.renderkit.html.AjaxPageRenderer;
@@ -35,8 +36,8 @@
*/
public class AjaxPageTag extends AjaxRegionTag {
- private String onload;
- private String onunload;
+ private ValueExpression onload;
+ private ValueExpression onunload;
/* (non-Javadoc)
* @see javax.faces.webapp.UIComponentTag#getRendererType()
@@ -63,25 +64,25 @@
/**
* @return Returns the onload.
*/
- public String getOnload() {
+ public ValueExpression getOnload() {
return onload;
}
/**
* @return Returns the onunload.
*/
- public String getOnunload() {
+ public ValueExpression getOnunload() {
return onunload;
}
/**
* @param onload The onload to set.
*/
- public void setOnload(String onload) {
+ public void setOnload(ValueExpression onload) {
this.onload = onload;
}
/**
* @param onunload The onunload to set.
*/
- public void setOnunload(String onunload) {
+ public void setOnunload(ValueExpression onunload) {
this.onunload = onunload;
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -21,15 +21,16 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
-import javax.faces.el.MethodBinding;
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.AjaxContainer;
import org.ajax4jsf.component.UIAjaxRegion;
-import org.ajax4jsf.event.AjaxListener;
import org.ajax4jsf.renderkit.html.AjaxRegionRenderer;
import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+import org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor;
/**
@@ -42,15 +43,15 @@
*/
public class AjaxRegionTag extends UIComponentTagBase {
- private String ajaxListener = null;
+ private MethodExpression ajaxListener = null;
- private String reRender = null;
+ private ValueExpression reRender = null;
- private String immediate = null;
+ private ValueExpression immediate = null;
- private String selfRendered = null;
+ private ValueExpression selfRendered = null;
- private String javascriptLocation = null;
+ private ValueExpression javascriptLocation = null;
/**
*
@@ -109,14 +110,10 @@
if (!(component instanceof AjaxContainer)) {
throw new
IllegalArgumentException(Messages.getMessage(Messages.NOT_AJAX_CONTAINER_ERROR,
component.getClientId(getFacesContext())));
}
- if (isValueReference(ajaxListener)) {
- MethodBinding mb = getFacesContext().getApplication()
- .createMethodBinding(ajaxListener,
- AjaxListener.AJAX_LISTENER_ARGS);
- ((AjaxContainer) component).setAjaxListener(mb);
- } else {
+ if (ajaxListener.isLiteralText()) {
getFacesContext().getExternalContext().log(Messages.getMessage(Messages.INVALID_EXPRESSION,
ajaxListener));
}
+ ((AjaxContainer) component).setAjaxListener(new
MethodBindingMethodExpressionAdaptor(ajaxListener));
}
}
@@ -125,7 +122,7 @@
* @param ajaxAreas
* The ajaxAreas to set.
*/
- public void setReRender(String ajaxAreas) {
+ public void setReRender(ValueExpression ajaxAreas) {
this.reRender = ajaxAreas;
}
@@ -133,7 +130,7 @@
* @param ajaxListener
* The ajaxListener to set.
*/
- public void setAjaxListener(String ajaxListener) {
+ public void setAjaxListener(MethodExpression ajaxListener) {
this.ajaxListener = ajaxListener;
}
@@ -141,14 +138,14 @@
* @param immediate
* The immediate to set.
*/
- public void setImmediate(String immediate) {
+ public void setImmediate(ValueExpression immediate) {
this.immediate = immediate;
}
/**
* @param selfRendered The selfRendered to set.
*/
- public void setSelfRendered(String selfRendered) {
+ public void setSelfRendered(ValueExpression selfRendered) {
this.selfRendered = selfRendered;
}
@@ -156,7 +153,7 @@
// return javascriptLocation;
// }
//
- public void setJavascriptLocation(String javascriptLocation) {
+ public void setJavascriptLocation(ValueExpression javascriptLocation) {
this.javascriptLocation = javascriptLocation;
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -21,6 +21,7 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import org.ajax4jsf.component.UIAjaxStatus;
@@ -38,37 +39,37 @@
public class AjaxStatusTag extends HtmlComponentTagBase
{
- private String _for = null;
+ private ValueExpression _for = null;
/**
* Text to output on start request
*/
- private String _startText = null;
+ private ValueExpression _startText = null;
/**
* Text to display on complete request
*/
- private String _stopText = null;
+ private ValueExpression _stopText = null;
/**
* Style for display on start request
*/
- private String _startStyle = null;
+ private ValueExpression _startStyle = null;
/**
* Style for displaying on complete
*/
- private String _stopStyle = null;
+ private ValueExpression _stopStyle = null;
/**
* Style class for display on request
*/
- private String _startStyleClass = null;
+ private ValueExpression _startStyleClass = null;
/**
* Style class for display on complete request
*/
- private String _stopStyleClass = null;
+ private ValueExpression _stopStyleClass = null;
/**
* Force id to render in Html as is
*/
- private String _forceId = null;
+ private ValueExpression _forceId = null;
/* (non-Javadoc)
* @see javax.faces.webapp.UIComponentTag#getComponentType()
*/
@@ -125,7 +126,7 @@
/**
* @param _for The _for to set.
*/
- public void setFor(String _for)
+ public void setFor(ValueExpression _for)
{
this._for = _for;
}
@@ -133,7 +134,7 @@
/**
* @param style The _startStyle to set.
*/
- public void setStartStyle(String style)
+ public void setStartStyle(ValueExpression style)
{
_startStyle = style;
}
@@ -141,7 +142,7 @@
/**
* @param styleClass The _startStyleClass to set.
*/
- public void setStartStyleClass(String styleClass)
+ public void setStartStyleClass(ValueExpression styleClass)
{
_startStyleClass = styleClass;
}
@@ -149,7 +150,7 @@
/**
* @param text The _startText to set.
*/
- public void setStartText(String text)
+ public void setStartText(ValueExpression text)
{
_startText = text;
}
@@ -157,7 +158,7 @@
/**
* @param stopText The stopText to set.
*/
- public void setStopText(String stopText)
+ public void setStopText(ValueExpression stopText)
{
this._stopText = stopText;
}
@@ -165,7 +166,7 @@
/**
* @param style The _stopStyle to set.
*/
- public void setStopStyle(String style)
+ public void setStopStyle(ValueExpression style)
{
_stopStyle = style;
}
@@ -173,7 +174,7 @@
/**
* @param styleClass The _stopStyleClass to set.
*/
- public void setStopStyleClass(String styleClass)
+ public void setStopStyleClass(ValueExpression styleClass)
{
_stopStyleClass = styleClass;
}
@@ -181,7 +182,7 @@
/**
* @param forceId The forceId to set.
*/
- public void setForceId(String forceId)
+ public void setForceId(ValueExpression forceId)
{
this._forceId = forceId;
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
===================================================================
---
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -21,8 +21,10 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
-import javax.faces.webapp.UIComponentTag;
+import javax.faces.webapp.UIComponentClassicTagBase;
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.UIAjaxSupport;
@@ -62,31 +64,31 @@
* Id ( in form of findComponent method param ) of JSF component,
* updated by this component ( parnt tag ) action.
*/
- private String reRender = null;
+ private ValueExpression reRender = null;
/**
* Generate script for given event ( onclick, onenter ... )
*/
- private String event = null;
+ private ValueExpression event = null;
/**
* Id of request status component.
*/
- private String status = null;
+ private ValueExpression status = null;
/**
* JavaScript function for call after request completed.
*/
- private String oncomplete = null ;
+ private ValueExpression oncomplete = null ;
- private String action = null;
- private String actionListener = null;
- private String limitToList = null;
- private String disableDefault = null;
- private String value = null;
- private String immediate = null;
- private String ajaxSingle = null;
+ private MethodExpression action = null;
+ private MethodExpression actionListener = null;
+ private ValueExpression limitToList = null;
+ private ValueExpression disableDefault = null;
+ private ValueExpression value = null;
+ private ValueExpression immediate = null;
+ private ValueExpression ajaxSingle = null;
@@ -94,7 +96,7 @@
/**
* @param type The type to set.
*/
- public void setDisableDefault(String ajaxType)
+ public void setDisableDefault(ValueExpression ajaxType)
{
this.disableDefault = ajaxType;
}
@@ -103,7 +105,7 @@
* @param reRender
* The targetId to set.
*/
- public void setReRender(String ajaxId) {
+ public void setReRender(ValueExpression ajaxId) {
this.reRender = ajaxId;
}
@@ -111,7 +113,7 @@
/**
* @param event The event to set.
*/
- public void setEvent(String event)
+ public void setEvent(ValueExpression event)
{
this.event = event;
}
@@ -119,7 +121,7 @@
/**
* @param oncomplete The oncomplete to set.
*/
- public void setOncomplete(String oncomplete)
+ public void setOncomplete(ValueExpression oncomplete)
{
this.oncomplete = oncomplete;
}
@@ -127,7 +129,7 @@
/**
* @param status The status to set.
*/
- public void setStatus(String status)
+ public void setStatus(ValueExpression status)
{
this.status = status;
}
@@ -135,7 +137,7 @@
/**
* @param limitToList The submitForm to set.
*/
- public void setLimitToList(String limitToList)
+ public void setLimitToList(ValueExpression limitToList)
{
this.limitToList = limitToList;
}
@@ -143,7 +145,7 @@
/**
* @param action The action to set.
*/
- public void setAction(String action)
+ public void setAction(MethodExpression action)
{
this.action = action;
}
@@ -151,7 +153,7 @@
/**
* @param actionListener The actionListener to set.
*/
- public void setActionListener(String actionListener)
+ public void setActionListener(MethodExpression actionListener)
{
this.actionListener = actionListener;
}
@@ -159,9 +161,9 @@
protected void setParentProperties(UIAjaxSupport uiComponent) {
//Find parent UIComponentTag
- UIComponentTag componentTag = null;
+ UIComponentClassicTagBase componentTag = null;
try {
- componentTag = UIComponentTag.getParentUIComponentTag(pageContext);
+ componentTag =
UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
if (componentTag == null) {
throw new IllegalArgumentException(
Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR,
"AjaxSupportTag"));
@@ -217,21 +219,21 @@
/**
* @param value The value to set.
*/
- public void setValue(String value) {
+ public void setValue(ValueExpression value) {
this.value = value;
}
/**
* @param immediate The immediate to set.
*/
- public void setImmediate(String immediate) {
+ public void setImmediate(ValueExpression immediate) {
this.immediate = immediate;
}
/**
* @param ajaxSingle The ajaxSingle to set.
*/
- public void setAjaxSingle(String ajaxSingle) {
+ public void setAjaxSingle(ValueExpression ajaxSingle) {
this.ajaxSingle = ajaxSingle;
}
@@ -256,12 +258,15 @@
setParentProperties((UIAjaxSupport) component);
}
+
private void setReRenderProperty(UIComponent component) {
if (reRender != null) {
- if (isValueReference(reRender)) {
+ if (reRender.isLiteralText()) {
setStringProperty(component, "reRender", reRender);
} else {
- ((UIAjaxSupport) component).setReRender(
AjaxRendererUtils.asSet(reRender));
+ //FIXME: Why do we evaluate reRender right now?
+ //Collection can change any time.
+ ((UIAjaxSupport) component).setReRender(
AjaxRendererUtils.asSet(reRender.getValue(getELContext())));
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -180,7 +180,7 @@
throw new FacesException(e);
}
} else {
- component.setValueExpression("value", this.viewId);
+ component.setValueExpression("viewId", this.viewId);
}
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2007-10-25
15:15:06 UTC (rev 3540)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/KeepAliveTag.java 2007-10-25
15:15:16 UTC (rev 3541)
@@ -21,9 +21,11 @@
package org.ajax4jsf.taglib.html.jsp;
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.application.Application;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.webapp.UIComponentTag;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;
@@ -44,19 +46,19 @@
private String beanName = null;
- private String ajaxOnly = null;
+ private ValueExpression ajaxOnly = null;
/**
* @return the ajaxOnly
*/
- public String getAjaxOnly() {
+ public ValueExpression getAjaxOnly() {
return ajaxOnly;
}
/**
* @param ajaxOnly the ajaxOnly to set
*/
- public void setAjaxOnly(String ajaxOnly) {
+ public void setAjaxOnly(ValueExpression ajaxOnly) {
this.ajaxOnly = ajaxOnly;
}
@@ -81,28 +83,34 @@
if (beanName == null) {
throw new
JspException(Messages.getMessage(Messages.NULL_TYPE_ATTRIBUTE_ERROR));
}
- if(UIComponentTag.isValueReference(beanName)){
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Application application = facesContext.getApplication();
+ ExpressionFactory factory = application.getExpressionFactory();
+ ELContext elContext = facesContext.getELContext();
+ ValueExpression beanNameEL =
+ factory.createValueExpression(elContext, beanName, String.class);
+ if(!beanNameEL.isLiteralText()){
throw new JspException(Messages.getMessage(Messages.NAME_MUST_BE_LITERAL));
}
boolean isAjaxOnly = false;
- FacesContext facesContext = FacesContext.getCurrentInstance();
if (null != ajaxOnly) {
- if (UIComponentTag.isValueReference(ajaxOnly))
+ if (ajaxOnly.isLiteralText())
{
- ValueBinding vb =
facesContext.getApplication().createValueBinding(ajaxOnly);
- isAjaxOnly = Boolean.TRUE.equals(vb.getValue(facesContext));
+ //TODO: More sophisticated way to convert boolean value (yes/no, 1/0,
on/off, etc.)
+ isAjaxOnly = Boolean.parseBoolean(ajaxOnly.getExpressionString());
}
else
{
- //TODO: More sophisticated way to convert boolean value (yes/no, 1/0,
on/off, etc.)
- isAjaxOnly = Boolean.parseBoolean(ajaxOnly);
+ isAjaxOnly = Boolean.TRUE.equals(ajaxOnly.getValue(elContext));
}
}
// Get bean instance from EL expression.
String beanExpression = "#{"+beanName+"}";
- ValueBinding valueBinding =
facesContext.getApplication().createValueBinding(beanExpression);
- Object bean = valueBinding.getValue(facesContext);
+ ValueExpression valueExpression =
+ factory.createValueExpression(elContext, beanExpression, Object.class);
+ Object bean = valueExpression.getValue(elContext);
// Put bean instance to ViewRoot.
String beanAttributeName =
isAjaxOnly?AjaxPhaseListener.AJAX_BEAN_PREFIX:AjaxPhaseListener.VIEW_BEAN_PREFIX+beanName;
facesContext.getViewRoot().getAttributes().put(beanAttributeName, bean);