你有没有修改过actionservlet?
有没有通过action传递一些数据到loginfailure.jsp或mainpage.jsp?
感觉是因为空指针导致的

解决方案 »

  1.   

    看一下你的struts-config的配置文件,以及页面是否正确调转到.do文件。
      

  2.   

    这是我action的execute()方法,使用了动态ActionForm来获取表单数据,user对象用来操作数据库:public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
            // TODO: Write method body
         ActionMessages errors = new ActionMessages();
         UserLogin user = new UserLogin();
        
            DynaActionForm daf = (DynaActionForm)form;
            String name = (String)daf.get("name");
            String password = (String)daf.get("password");
            
            if (user.validLogin(name, password) == true)
             return mapping.findForward(Constants.SUCCESS_KEY);
            if ((user.validLogin(name, password) == false) && (user.validUser == false))
             errors.add("error", new ActionMessage("error.user.mismatch"));
            if ((user.validLogin(name, password) == false) && (user.validUser == true))
             errors.add("error", new ActionMessage("error.password.mismatch"));
            
            if (!errors.isEmpty()) {
             saveMessages(request, errors);
             return mapping.findForward(Constants.FAILURE_KEY);
             } else return mapping.findForward(Constants.SUCCESS_KEY);        
        }
      

  3.   

    To thurm: 我没有修改过actionSevlet,也没有传递数据到页面,页面上的文字信息均能正确显示,例如在failure.jsp页面中,error.usr.mismatch的错误消息就能显示,但是没有背景图。To yjj317: 页面转调到了.do文件的,这是IE上显示的URL--http://localhost:8080/wutie/checkLogin.do用Struts做项目还是第一次,没什么经验,碰到这种问题还真不知道该怎么解决!大家再帮我看看!
      

  4.   

    网上有网友说javascript脚本这样的外部资源都是以servlet的路径为基准,也就是浏览器的地址栏里显示的地址(http://xxx.com/xxx.do)而不是转发到的jsp地址(http://xxx.com/example/xxx.jsp),如果这两个地址的路径不同,就会造成找不到图片的问题。但是我的背景是在<head></head>中声明的:
    <style type="text/css">
        <!--
        body {
        background-image: url(../pic/background.gif);
        }
        -->
        </style>
    这种情况该怎么处理呢?
      

  5.   

    我觉得你光是背景图片不能显示出来应该是你在导入图片时得url路径写法不对,你试着改一改看看行不行,我以前也遇到过好多类似得问题大部分都是url路径写得不对
      

  6.   

    使用绝对路径试试?
    background-image: url(<%=request.getContextPath()%>/pic/background.gif);
      

  7.   

    <head>
    <html:base/>
    </head>
      

  8.   

    To shloshlo:页面上加<html:base/>会生成当前网页的绝对URL,但是在网页上我并没有看到有什么不同,请再帮忙详细解释一下。
      

  9.   

    谢谢各位帮助!
    采用<html:base/>和background-image: url(<%=request.getContextPath()%>/pic/background.gif);均能将问题解决,还是url路径问题。