繁体   English   中英

从servlet传递确认到JSP,出现错误

[英]Passing confirmation to JSP from servlet, getting errors

目前,我正在尝试创建一个可以返回汽车的页面,我有一个创建新对象并将其传递给jsp的方法。 我遇到的问题是jsp总是期望对象到达,从而导致http状态500。

仅当通过servlet创建对象时,才如何在页面上具有该对象。 同样,这只是为了确认您的请求已通过。 我的代码如下

<h4>
<%  ConfirmationBean confirmationBean = (ConfirmationBean)request.getAttribute("confirmation");
    if( !confirmationBean.getConfirmation().equals("") || !confirmationBean.getConfirmation().equals(null)){
        out.println(confirmationBean.getConfirmation());
    }
%>
</h4>

和我得到的堆栈跟踪如下。

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:579)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

检查此request.getAttribute("confirmation")的返回是否为null

if(request.getAttribute("confirmation")!=null){
         //go ahead
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM