jsf 2 - How to update URL from java code -


what looking simple way update browsers url.

i have added deeplinks primefaces datatables, that:

some_url?filter=column:value;column:value 

will automatically filters datatable on page given values url.

    <f:viewparam name="filter" value="#{newsbean.items.settings.deeplink}"/>     <h:form id="newsform">         <f:event type="prerenderview" listener="#{newsbean.items.deeplinkaction}" />          <p:datatable .... > 

"deeplink" saves string , "deeplinkaction" parses string , filters datatable.

now want update url on filtering datatable. when filterevent fired string of "deeplink" updated filtered values given pattern. how can achieve, string of deeplink shown in url. not want reload page, due double filtering , double database access.

is there clientside solution show url. not want have button.

thanks

you can in modern browsers. having prepared new url, can use pushstate method follow.

var newurl="/new-url"; window.history.pushstate({}, "page title", newurl); 

for more information should visit here. however, want job in java code, recommend prepare url in java class, use ajax transfer url client side, use pushstate.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -