我在我的 jsf 页面中有这样的输入
<html:inputText id="ResponseOK" value="#{bean.ResponseOK}" binding="#{bean.ResponseOKInput}" />
当我单击命令按钮时,我想获取 servlet 中的值(通过 request.getParameter ("ResponseOK"))
<html:commandButton value="Valider" action="#{bean.callServlet}"/>
调用一个函数
public void callServlet()
{
String url = "http://localhost:8080/TestOne/Timers"; //servlet
FacesContext context = FacesContext.getCurrentInstance();
try {
context.getExternalContext().redirect(url);
}catch (Exception e) {
e.printStackTrace();
}
finally{
context.responseComplete();
}
}
不幸的是,在我的 servlet 变量 Ok 中,只返回 null
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String Ok = request.getParameter("ResponseOK");// return null
System.out.println(timerOk);
}
非常感谢你