分类:
2008-09-08 18:23:31
项目中需要通过一链接直接进入JSF生命周期, 苦思冥想无法解决. Google之, 得解. 现帖出那位老外的代码, 很有用的工具类.
public abstract class AbstractFacesServlet extends HttpServlet {
/** Creates a new instance of AbstractFacesServlet */
public AbstractFacesServlet() {
super();
}
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
protected abstract void processRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException;
/**
* Handles the HTTP GET
method.
*
* @param request
* servlet request
* @param response
* servlet response
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
protected void log(FacesContext facesContext, String message) {
facesContext.getExternalContext().log(message);
}
/**
* Handles the HTTP POST
method.
*
* @param request
* servlet request
* @param response
* servlet response
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
[1]