To get the current request parameters (for example in Ajax behavior processing) in Apache Wicket 1.4:
String parameterValue = RequestCycle.get().getRequest().getParameter(parameterName);
In 1.5 you have a better control where the parameter comes from:
// GET request
StringValue parameterValue = RequestCycle.get().getRequest().getQueryParameters().getParameterValue(parameterName);
// POST request
StringValue parameterValue = RequestCycle.get().getRequest().getPostParameters().getParameterValue(parameterName);
Or if you don't care about the method:
StringValue parameterValue = RequestCycle.get().getRequest().getRequestParameters().getParameterValue(parameterName);
String parameterValue = RequestCycle.get().getRequest().getParameter(parameterName);
// GET request StringValue parameterValue = RequestCycle.get().getRequest().getQueryParameters().getParameterValue(parameterName); // POST request StringValue parameterValue = RequestCycle.get().getRequest().getPostParameters().getParameterValue(parameterName);
StringValue parameterValue = RequestCycle.get().getRequest().getRequestParameters().getParameterValue(parameterName);
Aucun commentaire:
Enregistrer un commentaire