[
http://issues.apache.org/jira/browse/MYFACES-125?page=comments#action_60601 ]
Mathias Broekelmann commented on MYFACES-125:
---------------------------------------------
thanks for the fast reply.
I�ve tried the toUpperCase button with my modifcations and did not got an
exception. Of course removing the entry from aliasTest2 will produce a
NullPointerException at AliasHolder.toUpperCase() since no null checking is
done at this place. But that is not the point.
I removed the calls makeAlias() and removeAlias() because nested components
which fires FacesEvents will remove the alias... so the alias is not available
any more after the first event is fired. Try testing it with two nested input
fields. You will get a message from the variable resolver which could not find
the aliased value after the first event is fired.
As far as I understand the jsf spec the method queueEvent just puts an event
into the queue which is broadcasted after the phase by calling
broadcast(FacesEvent).
I�ve modified AliasHolder and aliasBean.jsp to reproduce the warn message from
the variable resolver:
Index: AliasHolder.java
===================================================================
RCS file:
/home/cvspublic/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/aliasexample/AliasHolder.java,v
retrieving revision 1.2
diff -u -r1.2 AliasHolder.java
--- AliasHolder.java 23 Nov 2004 04:46:40 -0000 1.2
+++ AliasHolder.java 10 Mar 2005 16:46:38 -0000
@@ -25,19 +25,29 @@
public class AliasHolder {
private static final Log log = LogFactory.getLog(AliasHolder.class);
- private String name="default name";
+ private String name1="default name1";
+ private String name2="default name2";
- public String getName() {
- return name;
+ public String getName2() {
+ return name2;
}
- public void setName(String name) {
- log.debug("set name="+name);
- this.name = name;
+ public void setName2(String name) {
+ log.debug("set name2="+name);
+ this.name2 = name;
}
- public String toUpperCase(){
- name = name.toUpperCase();
+ public String getName1() {
+ return name1;
+ }
+
+ public void setName1(String name) {
+ log.debug("set name1="+name);
+ this.name1 = name;
+ }
+
+ public String toUpperCase(){
+ name2 = name2.toUpperCase();
log.debug("toUpperCase command executed");
return null;
}
Index: aliasBean.jsp
===================================================================
RCS file: /home/cvspublic/incubator-myfaces/webapps/examples/web/aliasBean.jsp,v
retrieving revision 1.5
diff -u -r1.5 aliasBean.jsp
--- aliasBean.jsp 27 Jan 2005 01:59:45 -0000 1.5
+++ aliasBean.jsp 10 Mar 2005 16:52:35 -0000
@@ -66,24 +66,26 @@
</f:verbatim>
<h:form>
-
<f:verbatim><h2>aliasTest1</h2></f:verbatim>
- <x:aliasBean alias="#{holder}"
value="#{aliasTest1}" >
- <f:subview
id="simulatedIncludedSubform1">
- <%-- The next tags
could be inserted by an %@ include or jsp:include --%>
- <h:outputLabel
for="name" value="Name :"/>
- <h:inputText id="name" value="#{holder.name}"/>
- </f:subview>
- </x:aliasBean>
-
-
<f:verbatim><h2>aliasTest2</h2></f:verbatim>
- <x:aliasBean alias="#{holder}"
value="#{aliasTest2}" >
- <f:subview
id="simulatedIncludedSubform2">
- <%-- The next tags
could be inserted by an %@ include or jsp:include --%>
- <h:outputLabel
for="name" value="Name :"/>
- <h:inputText id="name" value="#{holder.name}"/>
- <h:commandButton
value="toUpperCase" action="#{holder.toUpperCase}"/>
- </f:subview>
- </x:aliasBean>
+ <f:verbatim><h2>aliasTest1</h2></f:verbatim>
+ <x:aliasBean alias="#{holder}" value="#{aliasTest1}" >
+ <f:subview id="simulatedIncludedSubform1">
+ <%-- The next tags could be inserted by an %@ include or
jsp:include --%>
+ <h:outputLabel for="name" value="Name :"/>
+ <h:inputText id="name" value="#{holder.name1}"/>
+ </f:subview>
+ </x:aliasBean>
+
+ <f:verbatim><h2>aliasTest2</h2></f:verbatim>
+ <x:aliasBean alias="#{holder}" value="#{aliasTest2}" >
+ <f:subview id="simulatedIncludedSubform2">
+ <%-- The next tags could be inserted by an %@ include or
jsp:include --%>
+ <h:outputLabel for="name1" value="Name1 :"/>
+ <h:inputText id="name1" value="#{holder.name1}"/>
+ <h:outputLabel for="name2" value="Name2 :"/>
+ <h:inputText id="name2" value="#{holder.name2}"/>
+ <h:commandButton value="toUpperCase"
action="#{holder.toUpperCase}"/>
+ </f:subview>
+ </x:aliasBean>
<f:verbatim><h2>aliasTest with fixed
string</h2></f:verbatim>
<x:aliasBean alias="#{holder}"
value="myFixedString" >
> processDecodes in AliasBean not implemented
> -------------------------------------------
>
> Key: MYFACES-125
> URL: http://issues.apache.org/jira/browse/MYFACES-125
> Project: MyFaces
> Type: Bug
> Versions: Nightly Build
> Reporter: Mathias Broekelmann
> Fix For: Nightly Build
>
> This bug prevents nested components which need the aliased value in the
> decode phase to work right.
> I�ve a fix for that:
> Index: AliasBean.java
> ===================================================================
> RCS file:
> /home/cvspublic/incubator-myfaces/src/components/org/apache/myfaces/custom/aliasbean/AliasBean.java,v
> retrieving revision 1.7
> diff -u -r1.7 AliasBean.java
> --- AliasBean.java 27 Jan 2005 16:00:30 -0000 1.7
> +++ AliasBean.java 10 Mar 2005 10:36:57 -0000
> @@ -202,6 +202,13 @@
> super.processValidators(context);
> removeAlias(context);
> }
> +
> + public void processDecodes(FacesContext context) {
> + log.debug("processDecodes");
> + makeAlias(context);
> + super.processDecodes(context);
> + removeAlias(context);
> + }
>
> public void processUpdates(FacesContext context) {
> log.debug("processUpdates");
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira