h:button not passing f:param from a JSF component -


i have jsf 2 page <h:button>. want pass 2 <f:param> outcome page.

value of <f:param> pone comes page bean.
value of <f:param> ptwo comes input field on page.

ptwo's value not stored on page bean.
ptwo's input field value set javascript when user clicks on image map within same page.

the problem request passes null param ptwo.

if set value of ptwo static value, value="12345", 12345 passed.

so, why <f:param> not pass value of input field source page?

thanks!

<input type="text" id="ptwo"/> <h:button value="go" outcome="destpage"> <f:param name="pone" value=#{mybean.pone}"/> <f:param name="ptwo" value=#{ptwo}"/> </h:button>

you cannot reference value of input field in el expression this. not if use h:inputtext.

furthermore, jsf calculates link button including parameters when page rendered on server side. when user sees page , enters in input field, url link fixed , won't change.

to solve in similar way, use h:commandbutton instead of h:button, submit form including value ptwowith h:inputtext , return redirect new page. xhtml this:

<h:form>   <h:inputtext value="#{bean.ptwo}"/>   <h:commandbutton action="#{bean.gotodest}" value="go"/> </h:form> 

the referenced action method this:

public string gotodest() {   return "destpage?faces-redirect=true&pone=" + pone + "&ptwo=" + ptwo; } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -