解决方案 »

  1.   

    我感觉是这样,你第一次登陆的时候没有获取一些必要的参数,导致异常
    你这里报错java.lang.NullPointerException
    就是某个对象没有被实例化。
    第二次的时候,这个对象应该就已经被实例化了
    你debug一下,看看到底是哪里抛出的异常
      

  2.   

    空指针是这么多错误中最好解决的!断点调试,看看你出现空指针那行的变量哪个是NULL就知道哪里没有给对象地址了这个很好解决,没看到你的代码,不好给出具体的方案!
      

  3.   

    登陆代码:(可以登陆进入)<form action="${pageContext.request.contextPath}/system/elecMenuAction_loginHome.do" method="post" onsubmit="return check();">进入首页面,有很多框架集组成,其中mainFrame中还有许多IFrame<SCRIPT type="text/javascript">
    function submitrequest(action){
    eval("document.location='"+action+"'");
    }function exitsys(){
        window.close();   
     }
    </SCRIPT>
    </HEAD><FRAMESET border=0 frameSpacing=0 rows=82,* frameBorder=0 id="mainparent">
    <FRAME name=topFrame src="system/elecMenuAction_title.do" noResize scrolling=no>
    <FRAMESET name="main" border=0 frameSpacing=0 frameBorder=0 cols=143,1%,*>
    <FRAME name="leftFrame" src="system/elecMenuAction_left.do" noResize>
    <frame name="changeButton" src="system/elecMenuAction_change1.do" frameBorder=0 marginHeight=0 marginWidth=0 scrolling=no noresize>
    <FRAME name="mainFrame" src="system/elecMenuAction_loading.do" >
    </FRAMESET>
    </FRAMESET>mainFrame中的各种Iframe<form name="Form1" method="post" action="name.aspx" id="Form1"> <table width="100%" border="0" height="88" border="1" background=${pageContext.request.contextPath }/images/back1.jpg>
    <tr>
    <td colspan=3 class="ta_01" align="center" background="${pageContext.request.contextPath }/images/b-info.gif"><strong>系统首页</strong></td>
    </tr> <tr>
    <td width="70%" height="84" align="left" valign="top" >

    <fieldset style="width: 279px; height: 200px; padding: 1 background:${pageContext.request.contextPath }/images/back1.JPG"><legend>
    <font color="#0000FF">
    <img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"> 校准提醒</font></legend>
    <IFRAME src="system/elecMenuAction_alermXZ.do"  name="alarmx" id="alarmx" frameBorder=0 width=270 scrolling=auto height=170></IFRAME>

    </fieldset>

    <fieldset style="width: 279px; height: 200px; padding: 1 background:${pageContext.request.contextPath }/images/back1.JPG"><legend>
    <font color="#0000FF">
    <img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"> 检修提醒</font></legend>

    <IFRAME src="system/elecMenuAction_alermJX.do"  name="alarmj" id="alarmj" frameBorder=0 width=270 scrolling=auto height=170></IFRAME>

    </fieldset>

    <fieldset style="width: 279px; height: 200px; padding: 1 background:${pageContext.request.contextPath }/images/back1.JPG"><legend>
    <font color="#0000FF">
    <img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"> 站点运行情况</font></legend>

    <IFRAME src="system/elecMenuAction_alermZD.do"  name="station" id="station" frameBorder=0 width=270 scrolling=auto height=170></IFRAME>
         
       </fieldset>
       
       
       
        <fieldset style="width: 279px; height: 200px; padding: 1 background:${pageContext.request.contextPath }/images/back1.JPG"><legend>
    <font color="#0000FF">
    <img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"> 设备运行情况</font></legend>
                 <IFRAME src="system/elecMenuAction_alermSB.do"  name="dev" id="dev" frameBorder=0 width=270 scrolling=auto height=170></IFRAME>
    </fieldset>


    </td>
               
    <td width="30%" align="left" valign="top">
    <fieldset style="width: 275px; height: 404px; padding: 1"><legend>
    <font color="#0000FF">
    <img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"> 验收提醒</font></legend>
    <IFRAME src="${pageContext.request.contextPath }/system/elecMenuAction_alermYS.do"  name="project" id="project" frameBorder=0 width=270 scrolling=auto height=340></IFRAME>
    </fieldset>
    </td>
    </tr>
    <tr><td height=2></td></tr>

    </table> </form></body>
    其中一个Actionpublic String alermZD() {
    List<ElecCommonMsg> commonMsgList =elecCommonMsgService.findElecCommonMsgByCurrentDate();
    List<ElecCommonMsgVo>  commonMsgVoList=new ArrayList<ElecCommonMsgVo>();
    for(ElecCommonMsg e:commonMsgList){
    ElecCommonMsgVo  elecCommonMsgVo=new ElecCommonMsgVo();
    elecCommonMsgVo.setStationRunTitle(e.getStationRunTitle());
    elecCommonMsgVo.setDevRunTitle(e.getDevRunTitle());
    commonMsgVoList.add(elecCommonMsgVo);
    }
    System.out.println("commonMsgVoList  in alermZD  size:"+commonMsgVoList.size());
    request.setAttribute("commonMsgVoList", commonMsgVoList);
    return "loginHome_alermZD";
    }第一次登陆进入这两个框是这样的刷新一下是这样的
      

  4.   


    你先调用iframe的url但是这时候需要的一些值还没有生成你把访问顺序换下
    最后掉iframe的url看看
      

  5.   

    偶又看了下发现个问题。
    struts2第一次启动textprovider为空,
    刷新页面之后textprovider有值了,之后只要不重启服务器,这个textprovider都有值。但重启服务器后,这个值又为null了。
    不知道这个textprovider是怎么来的,求教各位大侠。
      

  6.   

    我在怀疑是不是 frame在第一次载入时不会去执行你的.do方法或者其它原因不能这样用,可以考虑在src中直接写入url,把.do方法放在你的页面载入时执行试试吧。
      

  7.   

    或者在.do方法后面加上个随机数试试。
    src="system/elecMenuAction_left.do?math="+new Date().getTime()
      

  8.   

    经过一番折腾
    现象解决了,做法是,把原先用spring管理struts2的做法给取消,就能够正常显示了。但是这是为什么呢?暂还不清楚。另外各位大虾,平时做项目大家都是用spring管理struts2吗?这样做有什么好处,不用spring管理struts2又有什么好处?