Skip to main content

setPropertyActionListener doesn't work property in XHTML mode

6 replies [Last post]
cain_templar
Offline
Joined: 2008-10-31
Points: 0

While setPropertyActionListener works fine in jsp mode, it doesn't really work in XHTML (facelets) mode.

When I press the command button, the value I should get in the input text box is "Jialiang". However, what I got is some sort of string expression:

/index.xhtml @26,75 value="Jialiang": ValueExpression[Jialiang]

In JSP mode, I can get the value correctly; this only happens in XHTML mode.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cain_templar
Offline
Joined: 2008-10-31
Points: 0

Yeah, I suspect it's the toString() result of a ValueExpression. Thanks for the confirmation.

Hopefully they can fix this real quick cuz I really like the setPropertyActionListener in Oracle ADFFaces (trinidad?).

Ryan Lubke

I've logged an issue [1] to track this.

[1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=917

webtier@javadesktop.org wrote:
> While setPropertyActionListener works fine in jsp mode, it doesn't really work in XHTML (facelets) mode.
>
>
>
>
>
>

>
> When I press the command button, the value I should get in the input text box is "Jialiang". However, what I got is some sort of string expression:
>
> /index.xhtml @26,75 value="Jialiang": ValueExpression[Jialiang]
>
> In JSP mode, I can get the value correctly; this only happens in XHTML mode.
> [Message sent by forum member 'cain_templar' (cain_templar)]
>
> http://forums.java.net/jive/thread.jspa?messageID=325165
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Ryan Lubke

Fix applied. Feel free to give tonight's nightly build a shot to verify
on your end.

Ryan Lubke wrote:
> I've logged an issue [1] to track this.
>
> [1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=917
>
> webtier@javadesktop.org wrote:
>> While setPropertyActionListener works fine in jsp mode, it doesn't
>> really work in XHTML (facelets) mode.
>>
>>
>>
>>
>> >> value="Jialiang"/>
>>

>>
>> When I press the command button, the value I should get in the input
>> text box is "Jialiang". However, what I got is some sort of string
>> expression:
>>
>> /index.xhtml @26,75 value="Jialiang": ValueExpression[Jialiang]
>>
>> In JSP mode, I can get the value correctly; this only happens in
>> XHTML mode.
>> [Message sent by forum member 'cain_templar' (cain_templar)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=325165
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

arveds
Offline
Joined: 2008-12-31
Points: 0

Works for me now, the way it's intended to.

arveds
Offline
Joined: 2008-12-31
Points: 0

I concur - I get the same results. You can use most any f:setPropertyActionListener example you find on the Web and none of them do what the authors say they will, so presumably they are not using Facelets.

What that string is, BTW, *is* the string representation of a TagValueExpression. If you were to set the bean property "fname" in your managed bean as a ValueExpression, that is

private ValueExpression fname;
public void setFname(ValueExpression fname) { this.fname = fname; }

and then do

String actualFNameValue = fname.getValue(FacesContext.getCurrentInstance().getELContext());

you'd get "Jialiang" as the result. I'm not saying this *should* happen, it's merely the explanation of that string.

Arved Sandstrom

arveds
Offline
Joined: 2008-12-31
Points: 0

I might add, based on the following from the API, we might be seeing expected behaviour. (If not then the API is pretty confusing):

********************
The "target" and "value" tag attributes are ValueExpression instances and are stored unevaluated as instance variables of the listener.

When the listener executes, perform the following:

1) Call getValue() on the "value" ValueExpression.
- If value of the "value" expression is null, call setValue() on the "target" ValueExpression with the null value.
- If the value of the "value" expression is not null, call getType() on the "value" and "target" ValueExpressions to determine their property types.
2) Coerce the value of the "value" expression to the "target" expression value type following the Expression Language coercion rules. Call setValue() on the "target" ValueExpression with the resulting value.
3) If either coercion or the execution of setValue() fails throw an AbortProcessingException.
********************[i][/i][i][/i][b][/b][b][/b]