我在使用这两个标签时,运行页面都会报Attribute context invalid for tag put according to TLD这个错误,请问是什么原因?

解决方案 »

  1.   

    index.jsp<%@ page language="java" contentType="text/html; charset=GBK"%>
    <%@ taglib uri="struts-template" prefix="template" %>
    <template:insert template="/template/Templateypjustice.jsp">
      <template:put name="title" content="XXXXX" direct="true"/>
      <template:put name="header1" content="/pagestruct/header1.jsp" />  
      <template:put name="header2" content="/pagestruct/header2.jsp" /> 
      <template:put name="header3" content="/intro/pagestruct/header3.jsp" />
      <template:put name="content" content="/intro/index_content.jsp" />
      <template:put name="leftbar" content="/intro/pagestruct/leftbar.jsp" />
      <template:put name="footbar" content="/pagestruct/footbar.jsp" />
    </template:insert>Templateypjustice.jsp<%@ page contentType="text/html; charset=GBK"%>
    <%@ page errorPage="/template/error_manage.jsp"%>
    <%@ taglib uri='struts-template' prefix='template' %>
    <html>
    <head>
    <title><template:get name='title' /></title>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <template:get name='js' />
    <link rel="stylesheet" href="/ypjustice/style.css">
    </head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top"><table width="760" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="8"><img src="/ypjustice/images/index_1.gif" width="760" height="8"></td>
            </tr>
            <tr>
              <td height="167" valign="top"><table width="760" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="202" valign="top"><template:get name='header1' /></td>
                    <td width="558" valign="top"><template:get name='header2' /></td>
                  </tr>
                </table></td>
            </tr>
            <tr>
              <td height="24" background="/ypjustice/images/index_14.gif"><template:get name='header3' /></td>
            </tr>
            <tr>
              <td valign="top">
    <table width="760" height="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="202" valign="top" class="td1"><template:get name='leftbar' /></td>
                    <td valign="top"><template:get name='content' /></td>
                  </tr>
                </table>
              </td>
            </tr>
            <tr>
              <td height="27" bgcolor="#0168B5"><template:get name='footbar' /></td>
            </tr>
          </table></td>
      </tr>
    </table>
    </body>
    </html>
      

  2.   

    <template:put name="footbar" content="/pagestruct/footbar.jsp" /> 
    contenthu换成value (我是新手)
      

  3.   

    不行。template没有value这个属性。错误还是一样:Attribute value invalid for tag put according to TLD
      

  4.   

    楼主确定下面标签里的uri是正确的吗?
    <%@ taglib uri="struts-template" prefix="template" %>
      

  5.   

    我在web.xml里配置,这样写应该没有错吧?
     <taglib>
        <taglib-uri>struts-template</taglib-uri>
        <taglib-location>/WEB-INF/struts-template.tld</taglib-location>
     </taglib>
      

  6.   

    楼主的struts版本号是多少?
    如果是1.1以上的应该用struts-tiles.tld
    看看你的工程里是不是既有struts-template.tld又有struts-tiles.tld
      

  7.   

    这工程里只有这个struts-template.tld。这项目是以前别人写的,现在部分页面要改一下,里面页面框架都用template标签来实现的。放在tomact里运行,大多数页面都显示不了,都报同一个错误。