private void injectQueryParams(final FacesContext context, final UrlMapping mapping,
final PrettyContext prettyContext)
{
boolean isPostback = FacesStateUtils.isPostback(context);
List<QueryParameter> params = mapping.getQueryParams();
QueryString queryString = prettyContext.getRequestQueryString();
for (QueryParameter param : params)
{
// check if to skip this QueryParameter due to onPostback attribute
if (!param.isOnPostback() && isPostback)
{
continue;
}
String el = param.getExpression().getELExpression();
if ((el != null) && !"".equals(el.trim()))
{
String name = param.getName();
if (queryString.getParameterMap().containsKey(name))
{
try
{
if (elUtils.getExpectedType(context, el).isArray())
{
String[] values = queryString.getParameterValues(name);
elUtils.setValue(context, el, values);
}
else
{
String valueAsString = queryString.getParameter(name);
// get the type of the referenced property and try to obtain a converter for it
Class<?> expectedType = elUtils.getExpectedType(context, el);
Converter converter = context.getApplication().createConverter(expectedType);