部分代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>


。  <taglib>
<taglib-uri>/WebRoot/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>



报的错是:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. One of '{"http://
 java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://
 java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://
 java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://
 java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://
 java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://
 java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://
 java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://
 java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, 
 "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, 
 "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://
 java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://
 java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, 
 "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/
 j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is 
 expected.是怎么回事啊?请高手指点啊

解决方案 »

  1.   

    看你是怎么引用struts-bean.tld里面的标签的?web.xml写:
    <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>页面中写:
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="c"%>试下
      

  2.   

    <jsp-config>
    <taglib>
    <taglib-uri>/WebRoot/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    </jsp-config>
      

  3.   

    根据楼上的,确实在web.xml中不报错了,但是有报出另外一个错误:javax.servlet.jsp.JspException: Cannot find bean userMessage in scope request
    userMessage是我一个存放用户信息的bean
      

  4.   

    我的部分action代码:
    public class PersonAction extends DispatchAction   { public ActionForward logon(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    PersonForm pFrom = (PersonForm) form;
    String userId = pFrom.getUserId();
    System.out.println("------action--------");
    String password = pFrom.getPassword();
    Person person = new Person();
    person.setUserId(userId);
    person.setPassword(password);
    boolean flg = DAOFactery.getInstacePersonDAO().queryDAO(person);
    if (flg==true){
    return mapping.findForward("suc");
    }else{
    return mapping.findForward("fal");
    }
    } public ActionForward findUser(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    try {
    ResultSet rs = DAOUserMessageFactory.getInstace().findBook();
        List ls = new ArrayList();
        UserMessage userMessage = null;
        while(rs.next()) {
         userMessage = new UserMessage();
         userMessage.setUserId(rs.getString("userId"));
         userMessage.setUserName(rs.getString("userName"));//(rs.getString("userId"));
         userMessage.setPassword(rs.getString("password"));//UserId(rs.getString("userId"));
         userMessage.setPcode(rs.getString("pCode"));//setUserId(rs.getString("userId"));
         userMessage.setPenalsum(rs.getString("penalsum"));//UserId(rs.getString("userId"));
         userMessage.setPbsum(rs.getString("pbsum"));//UserId(rs.getString("userId"));
         userMessage.setPnote(rs.getString("pnote"));//setUserId(rs.getString("userId"));
         userMessage.setPsex(rs.getString("psex"));//UserId(rs.getString("userId")
         ls.add(userMessage);
        }
    request.setAttribute("userMessage", ls);
    return mapping.findForward("suc");
    } catch (Exception e) {
    e.printStackTrace();
    return mapping.findForward("fal");
    }
    }部分jsp代码:<logic:iterate id="user" name="userMessage" property = "userMessage" scope ="request" type = "or.yh.vo.UserMessage">
       <tr>
       <td><bean:write name = "user" property = "userId"/></td>
      

  5.   

    你存request中的是对象,页面取的时候使用标签有问题。找不到属性。
    ------
    应该使用类似userMassege.userId获取。
      

  6.   

    你的那个是2.4 你是按2.3写的 
    <jsp-config>
    <taglib>
    <taglib-uri>sitemesh-decorator</taglib-uri>
    <taglib-location>
    /WEB-INF/sitemesh-decorator.tld
    </taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>sitemesh-page</taglib-uri>
    <taglib-location>
    /WEB-INF/sitemesh-page.tld
    </taglib-location>
    </taglib>
    </jsp-config>