我的Action如下:
public class EditDeployAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)  throws Exception
{
......
//将查询到的数据写入到session中,供页面使用
HttpSession httpSession = request.getSession();
httpSession.setAttribute("infoTable",pInfoTable);//pInfoTable为PlanSunProject的一个实例 ......

}
}我的页面代码如下,可是不能得到结果。谢谢
<body>
<form action="../../rzgs.do" enctype="multipart/form-data" method="post" id="inFrm" name="inFrm" target="mainwindow">
  <% 
      if(request.getSession().getAttribute("infoTable")!=null)
      {
      
       PlanSunProject pInfoTable=(PlanSunProject)request.getSession().getAttribute("infoTable");//得到pInfoTable对象
      }
    %>
   
    <script language="javascript">
    alert(<%=String.valueOf(pInfoTable.getBuildingcompany())%>);
</script>  <tr>
    <td width="105" height="31"><font color='#003366' size='2'>项目名称:</td>
    <td width="212"><textarea id="location"  style="width:160px" name="projectName">
     <%=pInfoTable.getProjectname()%></textarea></td>
  </tr><input id="submitok" type="button" name="Submit" value="提交" onclick="SubmitOK()" /> 
<input id="reset" type="reset" name="reset" value="重填"/>
</form>
</body>

解决方案 »

  1.   

    你可以搞一个div根据id后台输出前台的页面
    把一些代码注释掉,看看到底是不是页面代码的问题
    最好看看Actioin是怎么定向的,返回的是不是requsest请求
      

  2.   

    你的页面报错吗?你在下面用pInfoTable应该调不出它里面的get方法吧??应该: <% 
          if(request.getSession().getAttribute("infoTable")!=null) 
          { 
          
          PlanSunProject pInfoTable=(PlanSunProject)request.getSession().getAttribute("infoTable");//得到pInfoTable对象 
          } 
        %> 
    改为:
     <% 
         PlanSunProject pInfoTable=new PlanSunProject();
          if(request.getSession().getAttribute("infoTable")!=null) 
          { 
          pInfoTable=(PlanSunProject)request.getSession().getAttribute("infoTable");//得到pInfoTable对象 
          } 
        %> 你把对象定义在if里面,外面访问不了。