You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Nuno Sousa <wi...@gmail.com> on 2008/06/05 21:03:42 UTC

Accessing to back bean updated values

Hi,

For now, I'm just trying to alert a bean value in an onClick event
associated with an inputText.

[b]On my backbean i have defined my HtmlInputText with the event:[/b]
[code]inputText.setOnclick("jsFunction();");[/code]


[b]On my xhtml page i have defined my javascript function accessing
backbean:[/b]


  <script language="JavaScript" type="text/javascript">
  //<![CDATA[

  function jsFunction() {
    alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
  }

  //]]>

   </script>

If i click on the inputText it alerts me the correct bean value, but
if i change my bean value and click again, it shows me the same value.
Only when i refresh the page, my alert gets a new value. How can i
force my alert to ask allways the bean value without page refreshing?

Thanks

-- 
Ping is just a number timming is everything

Re: Accessing to back bean updated values

Posted by Christopher Cudennec <Sm...@gmx.net>.
Just have a look at the IceFaces demo site 
(http://component-showcase.icefaces.org/component-showcase/showcase.iface). 
IceFaces includes support for Ajax. Have a look at the "Buttons & Links" 
example. You should be able to reproduce what they do.

Cheers,

Christopher

Nuno Sousa schrieb:
> I'm using icefaces that i think it is imcompatible with richfaces right?
>
>
> On Fri, Jun 6, 2008 at 9:33 PM, Christopher Cudennec <Sm...@gmx.net> wrote:
>   
>> Ajax seems to be your solution. Try to integrate Richfaces. It's pretty easy
>> to use and gives you what you need.
>>
>> - C
>>
>> Nuno Sousa schrieb:
>>     
>>> Something like an invisible button over each dataTable inputText could
>>> be a solution?
>>> On click, get the new value and focus the inputText, something like that
>>> hehe.
>>> Thanks
>>>
>>>
>>> On Thu, Jun 5, 2008 at 8:03 PM, Nuno Sousa <wi...@gmail.com> wrote:
>>>
>>>       
>>>> Hi,
>>>>
>>>> For now, I'm just trying to alert a bean value in an onClick event
>>>> associated with an inputText.
>>>>
>>>> [b]On my backbean i have defined my HtmlInputText with the event:[/b]
>>>> [code]inputText.setOnclick("jsFunction();");[/code]
>>>>
>>>>
>>>> [b]On my xhtml page i have defined my javascript function accessing
>>>> backbean:[/b]
>>>>
>>>>
>>>>  <script language="JavaScript" type="text/javascript">
>>>>  //<![CDATA[
>>>>
>>>>  function jsFunction() {
>>>>   alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
>>>>  }
>>>>
>>>>  //]]>
>>>>
>>>>  </script>
>>>>
>>>> If i click on the inputText it alerts me the correct bean value, but
>>>> if i change my bean value and click again, it shows me the same value.
>>>> Only when i refresh the page, my alert gets a new value. How can i
>>>> force my alert to ask allways the bean value without page refreshing?
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> Ping is just a number timming is everything
>>>>
>>>>
>>>>         
>>>
>>>  ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG. Version: 8.0.100 / Virus Database: 270.0.0/1485 - Release
>>> Date: 05.06.2008 10:07
>>>
>>>       
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG. 
> Version: 8.0.100 / Virus Database: 270.0.0/1488 - Release Date: 06.06.2008 17:48
>   


Re: Accessing to back bean updated values

Posted by Nuno Sousa <wi...@gmail.com>.
I'm using icefaces that i think it is imcompatible with richfaces right?


On Fri, Jun 6, 2008 at 9:33 PM, Christopher Cudennec <Sm...@gmx.net> wrote:
> Ajax seems to be your solution. Try to integrate Richfaces. It's pretty easy
> to use and gives you what you need.
>
> - C
>
> Nuno Sousa schrieb:
>>
>> Something like an invisible button over each dataTable inputText could
>> be a solution?
>> On click, get the new value and focus the inputText, something like that
>> hehe.
>> Thanks
>>
>>
>> On Thu, Jun 5, 2008 at 8:03 PM, Nuno Sousa <wi...@gmail.com> wrote:
>>
>>>
>>> Hi,
>>>
>>> For now, I'm just trying to alert a bean value in an onClick event
>>> associated with an inputText.
>>>
>>> [b]On my backbean i have defined my HtmlInputText with the event:[/b]
>>> [code]inputText.setOnclick("jsFunction();");[/code]
>>>
>>>
>>> [b]On my xhtml page i have defined my javascript function accessing
>>> backbean:[/b]
>>>
>>>
>>>  <script language="JavaScript" type="text/javascript">
>>>  //<![CDATA[
>>>
>>>  function jsFunction() {
>>>   alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
>>>  }
>>>
>>>  //]]>
>>>
>>>  </script>
>>>
>>> If i click on the inputText it alerts me the correct bean value, but
>>> if i change my bean value and click again, it shows me the same value.
>>> Only when i refresh the page, my alert gets a new value. How can i
>>> force my alert to ask allways the bean value without page refreshing?
>>>
>>> Thanks
>>>
>>> --
>>> Ping is just a number timming is everything
>>>
>>>
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG. Version: 8.0.100 / Virus Database: 270.0.0/1485 - Release
>> Date: 05.06.2008 10:07
>>
>
>



-- 
Ping is just a number timming is everything

Re: Accessing to back bean updated values

Posted by Christopher Cudennec <Sm...@gmx.net>.
Ajax seems to be your solution. Try to integrate Richfaces. It's pretty 
easy to use and gives you what you need.

- C

Nuno Sousa schrieb:
> Something like an invisible button over each dataTable inputText could
> be a solution?
> On click, get the new value and focus the inputText, something like that hehe.
> Thanks
>
>
> On Thu, Jun 5, 2008 at 8:03 PM, Nuno Sousa <wi...@gmail.com> wrote:
>   
>> Hi,
>>
>> For now, I'm just trying to alert a bean value in an onClick event
>> associated with an inputText.
>>
>> [b]On my backbean i have defined my HtmlInputText with the event:[/b]
>> [code]inputText.setOnclick("jsFunction();");[/code]
>>
>>
>> [b]On my xhtml page i have defined my javascript function accessing
>> backbean:[/b]
>>
>>
>>  <script language="JavaScript" type="text/javascript">
>>  //<![CDATA[
>>
>>  function jsFunction() {
>>    alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
>>  }
>>
>>  //]]>
>>
>>   </script>
>>
>> If i click on the inputText it alerts me the correct bean value, but
>> if i change my bean value and click again, it shows me the same value.
>> Only when i refresh the page, my alert gets a new value. How can i
>> force my alert to ask allways the bean value without page refreshing?
>>
>> Thanks
>>
>> --
>> Ping is just a number timming is everything
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG. 
> Version: 8.0.100 / Virus Database: 270.0.0/1485 - Release Date: 05.06.2008 10:07
>   


Re: Accessing to back bean updated values

Posted by Nuno Sousa <wi...@gmail.com>.
Something like an invisible button over each dataTable inputText could
be a solution?
On click, get the new value and focus the inputText, something like that hehe.
Thanks


On Thu, Jun 5, 2008 at 8:03 PM, Nuno Sousa <wi...@gmail.com> wrote:
> Hi,
>
> For now, I'm just trying to alert a bean value in an onClick event
> associated with an inputText.
>
> [b]On my backbean i have defined my HtmlInputText with the event:[/b]
> [code]inputText.setOnclick("jsFunction();");[/code]
>
>
> [b]On my xhtml page i have defined my javascript function accessing
> backbean:[/b]
>
>
>  <script language="JavaScript" type="text/javascript">
>  //<![CDATA[
>
>  function jsFunction() {
>    alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
>  }
>
>  //]]>
>
>   </script>
>
> If i click on the inputText it alerts me the correct bean value, but
> if i change my bean value and click again, it shows me the same value.
> Only when i refresh the page, my alert gets a new value. How can i
> force my alert to ask allways the bean value without page refreshing?
>
> Thanks
>
> --
> Ping is just a number timming is everything
>



-- 
Ping is just a number timming is everything

Re: Accessing to back bean updated values

Posted by Nuno Sousa <wi...@gmail.com>.
Well, i was trying to avoid that, because i need to show a new value
on my dataTable cell when i click it. Having to click first in a
button just to update the value isn't that beauty solution, but thanks
:)



On Thu, Jun 5, 2008 at 8:03 PM, Nuno Sousa <wi...@gmail.com> wrote:
> Hi,
>
> For now, I'm just trying to alert a bean value in an onClick event
> associated with an inputText.
>
> [b]On my backbean i have defined my HtmlInputText with the event:[/b]
> [code]inputText.setOnclick("jsFunction();");[/code]
>
>
> [b]On my xhtml page i have defined my javascript function accessing
> backbean:[/b]
>
>
>  <script language="JavaScript" type="text/javascript">
>  //<![CDATA[
>
>  function jsFunction() {
>    alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
>  }
>
>  //]]>
>
>   </script>
>
> If i click on the inputText it alerts me the correct bean value, but
> if i change my bean value and click again, it shows me the same value.
> Only when i refresh the page, my alert gets a new value. How can i
> force my alert to ask allways the bean value without page refreshing?
>
> Thanks
>
> --
> Ping is just a number timming is everything
>



-- 
Ping is just a number timming is everything

Re: Accessing to back bean updated values

Posted by Richard Yee <ry...@cruzio.com>.
Nuno,
As someone else mentioned before, the EL expression gets evaluated on 
the server and the JavaScript gets processed on the browser. Therefore, 
the value that you are displaying is whatever was on the server when the 
page was rendered. Why don't you just put a commandButton on the page 
whose action attribute has a method binding to a method in your backing 
bean that resets the value in the inputText component.

-R

Nuno Sousa wrote:
> Hi,
>
> For now, I'm just trying to alert a bean value in an onClick event
> associated with an inputText.
>
> [b]On my backbean i have defined my HtmlInputText with the event:[/b]
> [code]inputText.setOnclick("jsFunction();");[/code]
>
>
> [b]On my xhtml page i have defined my javascript function accessing
> backbean:[/b]
>
>
>   <script language="JavaScript" type="text/javascript">
>   //<![CDATA[
>
>   function jsFunction() {
>     alert('#{myBackBean.dataTable.value.get(3).get(0).myRealValue}');
>   }
>
>   //]]>
>
>    </script>
>
> If i click on the inputText it alerts me the correct bean value, but
> if i change my bean value and click again, it shows me the same value.
> Only when i refresh the page, my alert gets a new value. How can i
> force my alert to ask allways the bean value without page refreshing?
>
> Thanks
>
>