Re: How to dynamically inject parameters without having to inject target backingbean

Splash Forums PrettyFaces Users How to dynamically inject parameters without having to inject target backingbean Re: How to dynamically inject parameters without having to inject target backingbean

#22800

nena_99
Participant

Note: I tried something like the following:

public String handleEmployeeReportsNavigation() {

return buildURL(“pretty:employeeReports”, getId());

}

protected String buildURL(String mappingId, Object… params) {

HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();

PrettyContext context = PrettyContext.getCurrentInstance(request);

PrettyURLBuilder builder = new PrettyURLBuilder();

UrlMapping mapping = context.getConfig().getMappingById(mappingId);

String targetURL = builder.build(mapping, true, params);

}


This returns a URL of the format: /employees/employeeReports/#id (replace #id with the actual ID) – however, the application does not navigate to the given resource. I’m not sure why – any help would be appreciated…

Thanks