Erro no UpLoad de arquivo.
JSP:
<form action="gravarSenha.action" enctype="multipart/form-data">
UpLoad <input type="file" name="arquivo">
<input type="submit">
</form>
Action:
public class GravarSenha extends SystemAction implements ServletRequestAware{
HttpServletRequest request;
public String execute(){
//******************** Erro ******
MultiPartRequestWrapper wrapper = (MultiPartRequestWrapper) request; //Erro aqui linha 45
File file = null;
try {
file = wrapper.getFiles("arquivo")[0];
} catch (Exception e) {
// TODO: handle exception
}
return SUCCESS;
}
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
}
Erro:
java.lang.ClassCastException: com.opensymphony.webwork.dispatcher.WebWorkRequestWrapper
br.com.clickideia.capacitacao.action.senha.GravarSenha.execute(GravarSenha.java:45)