0

i had mapped an Integer to h:outputText (JSF 2.0)

<h:outputText id="txt_pay_days" value="#{articleBean.noOfDays}"/>

and changed the value using jquery using

$("#txt_pay_days").text("123");

the value of integer is not changed to 123 in the bean (on the server side) .

What am i doing wrong. Or is this not the right way to do it.

Any suggestions ??

1 Answer 1

2

If you want to change on server side you need an ajax call. You can use f:ajax

<h:commandButton value="My ajax button">
    <f:setPropertyActionListener target="#{articleBean.noOfDays}" value="123" />
    <f:ajax  execute="txt_pay_days" update="txt_pay_days" />
</h:commandButton>

Execute tell which component(s) you want to process in ajax call , and update tell wich component(s) you want to update in view.

setPropertyActionListener will set the value of #{articleBean.noOfDays} .

You can found more informantion here:

Sign up to request clarification or add additional context in comments.

3 Comments

It is an h:outputText that won't go to the server.
Matt, i know it's an outputText, this button it's just an example, when clicked will update the outputText.
But the client side change doesn't get to the server thus you will get the "old" value from server again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.