I have problem with HttpParameters from Struts2. When i send the form with HTTP POST, the parameters are correctly encoded. After the form is submitted, there's a button to go back. When i press it, it sends a HTTP GET request, but the encoding is different. For example, if i write München, the parameter will change to München..Everything in my project is encoded with UTF-8 and i'm guessing it has something to do with Struts2.
Questions:
- How does the encoding change?
- Where is the value of HttpParameters saved?
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.interceptor.HttpParametersAware;
public abstract class BaseAction extends ActionSupport implements Preparable, ModelDriven, HttpParametersAware {
private HttpParameters httpFormParams;
protected void init(DBConnection conn,
Object formBean,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
}
public void setParameters(HttpParameters parameters) {
this.httpFormParams = parameters;
}
public HttpParameters getParameters() {
return this.httpFormParams;
}
}