kuba44
kuba44

Reputation: 1878

get current page address with query string

I know that current URI of page I can get by

#{request.requestURI}

it is in EL also available as follows:

String uri = ((HttpServletRequest) externalContext.getRequest()).getRequestURI();

Can i get current page address with query string at JSF page? How can i do this ?

For example for page with address in browser /pages/work/myPage.xhtml?id=43&idLast=21 I want to get String with /pages/work/myPage.xhtml?id=43&idLast=21

Upvotes: 0

Views: 1357

Answers (1)

skuntsel
skuntsel

Reputation: 11742

You can do it via HttpServletRequest methods HttpServletRequest#getRequestURI() and HttpServletRequest#getQueryString():

In EL that'd be:

#{request.requestURI}#{not empty request.queryString ? '?' : ''}#{request.queryString}"

Upvotes: 1

Related Questions