- 爱易网页
- 
                            Java教程
- 在<jsp:include/>中引用action不能正常显示,该怎么处理 
日期:2014-05-18  浏览次数:21068 次 
                    
                        
                         在<jsp:include/>中引用action不能正常显示
在 <jsp:include/> 中引用多个action遇到不能正常显示的问题,只能显示第一个action的内容,相关文件如下: 
 1,include.jsp的内容: 
 代码 
  
          1.    <jsp:include   page= "test1.do "/>        
          2.    <jsp:include   page= "test2.do "/>        
  
  
 2,struts-config.xml的部分内容: 
 代码 
  
          1.    <action   path= "/test1 "   name= "myForm "   type= "TestAction1 "   scope= "request "   validate= "true "   input= "/error.jsp ">        
          2.          <forward   name= "test "   path= "/test1.jsp "/>        
          3.    </action>        
          4.    <action   path= "/test2 "   name= "myForm "   type= "TestAction2 "   scope= "request "   validate= "true "   input= "/error.jsp ">        
          5.          <forward   name= "test "   path= "/test2.jsp "/>        
          6.    </action>        
  
  
 3,TestAction1的内容(TestAction2的内容类似) 
 代码 
  
          1.   import   javax.servlet.http.HttpServletRequest;       
          2.   import   javax.servlet.http.HttpServletResponse;       
          3.   import   org.apache.struts.action.Action;       
          4.   import   org.apache.struts.action.ActionForm;       
          5.   import   org.apache.struts.action.ActionForward;       
          6.   import   org.apache.struts.action.ActionMapping;       
          7.          
          8.   public   class   TestAction1   extends   Action       
          9.   {       
       10.               public   ActionForward   execute(       
       11.                                       ActionMapping   actionMapping,       
       12.                                       ActionForm   actionForm,       
       13.                                       HttpServletRequest   request,       
       14.                                       HttpServletResponse   response)       
       15.               {       
       16.                           return   actionMapping.findForward(    "test "   );       
       17.               }       
       18.   }       
  
  
 4,test1.jsp的内容(test2.jsp的内容相似) 
 代码 
  
          1.   test1:    <br   />        
          2.    <%=new   java.util.Date()%>