在前进的WEB-INF / page.xhtml中执行commandButton-beanFunction

时间:2015-01-20 09:17:04

标签: jsf servlets forward commandbutton web-inf

我在Glassfish 4.1上使用Java EE作为企业应用程序,我有以下组件:

Java Servlet:

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");

    this.setUser(um.getLoggedUser());

    final String indexPath =  "/Index.xhtml";
    final String creatorPath =  "/WEB-INF/HiddenPages/EventPageCreator.xhtml";

    if(creator())
        request.getRequestDispatcher("/WEB-INF/HiddenPages/Creator.xhtml").forward(request, response);
    else
        response.sendRedirect("/Index.xhtml");
}

WEB-INF下的创建者页面是出现问题的页面: 它与ManagedBean方法有关。

<h:form><p:menubar>
    <p:menuitem action="#{bean.logout()}" value="Logout" ajax="false">
</p:menuitem></p:menubar></h:form>

豆子:

@ManagedBean
@RequestScoped
public class Bean(){
    public void logout(){
        System.out.println("logout");
    }
}

问题是页面C​​reator.xhtlm正确地加载了所有css以及该bean给出的属性。问题是,一旦我点击logout menuitem它就不会调用相关函数并发生500内部错误,java.lang.IllegalStateException:在提交响应后无法转发。

0 个答案:

没有答案