myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wang suya <o-s...@seiss.co.jp>
Subject Re: AW: use jsValueChangeListener
Date Wed, 21 Feb 2007 01:18:59 GMT
Hi Simon Kitching

   I actrully wrote the program same as you wrote :

<%@page contentType="text/html; charset=Shift_JIS" %>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

<html>
<head>
<title>jsfsample1</title>
</head>
<body bgcolor="#ffffff">
<h1>JSF sample</h1>
<f:view>
	<h:form id="form1">
		<h:outputText
		id="text1" 
		value="Welcome to JavaServer Pagee."
		binding="#{SampleJsfBean.text1}"/>
		<br />
		<h:selectBooleanCheckbox 
		id="check1"
		immediate="true"
		onchange="this.form.submit();"
		binding="#{SampleJsfBean.check1}"
		valueChangeListener="#{SampleJsfBean.check1_valueChanged}" />
		<h:messages/>
		<h:outputText	
		value="check"/>
	</h:form>

</f:view>
</body>
</html>	

public void check1_valueChanged(ValueChangeEvent valueChangeEvent){
		Boolean neu =(Boolean)valueChangeEvent.getNewValue();
		text1.setValue("check is " + neu.toString());
	}
}

But it does not work when I run it. The content of text1 does not change. Do you know
where is my wrong?  Thank you very much.

Wang suya




Simon Kitching さんは書きました:
>Every JSF input component has a "valueChangeListener" attribute whose
>value is an EL expression. So:
>
><h:inputText id="name"
>   valueChangeListener="#{myBean.handleNameChange}" .../>
>
>public void handleNameChange(ValueChangeEvent ev) {
>  .. do what you want here
>}
>
>wang suya wrote:
>> Dear Worm Danny
>> 
>>     Thank you for your replay. I want to use Beans to relate with valueChangeListener
>> but it does not work. Therefore I tryed jsValueChangeListener. Now I know what jsValueChangeListener
>> is. Do you know  whether Tomahawk can relate  valueChangeListener to Beans?
>> 
>>    Wang suya  
>> 
>> Worm, Danny さんは書きました:
>>> Hi wang suya,
>>>
>>> please have a look at this link:
>>> http://myfaces.apache.org/tomahawk/javascriptListener.html
>>>
>>> At the bottom of the page there are two examples of your
>>> trouble-component :)
>>>
>>> "js" in the component-name means JavaScript, that means client-side
>>> execution (no Beans or EL)
>>>
>>> Perhaps that's helpful. 
>>>
>>> Kind regards
>>> DaWorm
>>>
>> 
>> wang suya
>
>

wang suya

Mime
View raw message