Java GAE会话没有';不行?

Java GAE会话没有';不行?,java,google-app-engine,jsp,session,Java,Google App Engine,Jsp,Session,我的项目在调试模式下运行良好,但在gae上部署时运行不佳。会议似乎有点问题 关键的java和jsp如下所示: NewStudInfoServlet.java public class NewStudInfoServlet extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { if (req.getPara

我的项目在调试模式下运行良好,但在gae上部署时运行不佳。会议似乎有点问题

关键的java和jsp如下所示:

NewStudInfoServlet.java

public class NewStudInfoServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
    if (req.getParameterValues("StuFirName") != null
            && req.getParameter("StuFirName") != ""
            ) {

            Stud stud = new Stud();
            stud.setFirstName(req.getParameter("StuFirName"));              

            req.getSession().setAttribute("NewStud", stud); 
            req.getSession().setAttribute("StuInfoPage", "NewStudSchoolInfo");
            req.getSession().setAttribute("NewLackInfo", "successful!");                
        } else {
        req.getSession().setAttribute("StuInfoPage", "NewStudInfo");
        req.getSession().setAttribute("NewLackInfo", "First name, Last name, Graduation Year is required");
    }
    resp.sendRedirect("/NewAlumni.jsp");
newalumnium.jsp

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
    <%@include file='WEB-INF/Header.jsp'%>
    <%
        if (session.getAttribute("StuInfoPage") != null
                && session.getAttribute("StuInfoPage").toString() == "NewStudSchoolInfo") {
    %>
    <%@include file='WEB-INF/NewStudSchoolInfo.jsp'%>       
    <%
        } else {
    %>
    <%@include file='WEB-INF/NewStudInfo.jsp'%>
    <%
        }
    %>
是因为我可以在NewStudInfo.jsp中看到该死的“successful!”

怎么了?我需要你的帮助

我已准备好在appengine-web.xml中设置true


提前感谢。

您是否已通过向appengine-web.xml文件添加
true
来启用HTTP会话,如中所述?

您应该使用等于而不是==运算符检查字符串相等性。改变
session.getAttribute(“StuInfoPage”).toString()=“NewStudSchoolInfo”

session.getAttribute(“StuInfoPage”).toString().equals(“NewStudSchoolInfo”)

这就是原因!非常感谢。但为什么即使我使用session.getAttribute(“StuInfoPage”).toString()=“NewStudSchoolInfo”,它也能在调试模式下工作呢?
req.getSession().setAttribute("NewStud", stud); 
req.getSession().setAttribute("StuInfoPage", "NewStudSchoolInfo");
req.getSession().setAttribute("NewLackInfo", "successful!");