这个是jsp的代码
<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
  <title>
     <bean:message key="initial.title"/>
  </title>
</head>
<body>
   <html:form action="iniBookAction">
     <table>
       <tr>
          <th>
             <bean:message key="initial.lookup"/>
          </th>
          <td>
             <html:text property="bookname" size="16" maxlength="16"/>
          </td>
          <td>
             <html:submit property="submint" value="Submit"/>
             <html:submit property="submittotallist" value="book list"/>
          </td>
     </table>
<%
   String button1=(String)request.getParameter("submit");
   String button2=(String)request.getParameter("submittotallist");
   if(button1!=null||button2!=null){
%>
   <table border="1">
     <tr>
        <td><bean:message key="initial.bookname"/></td>
        <td><bean:message key="initial.author"/></td>
     </tr>
     <%
       Iterator bookList=(Iterator)session.getAttribute("bookList");
       if(bookList==null)
         System.out.println("booklist is null");
       else
         System.out.println("booklist is NOT null");
     %>
     <%
       for (;bookList.hasNext();) {
         shopping.Book bookTemp=(shopping.Book)bookList.next();
     %>
     <tr>
     <td>
        <A href="lookupBookAction.do?lookupname=<%=bookTemp.getBookName()%>">
        <%=bookTemp.getBookName()%></A>
     </td>
     <td><%=bookTemp.getAuthor()%></td>
     </tr>
     <%}%>
     <logic:iterate id="book"
                       collection="<%=bookList%>"
                       type="shopping.Book"
                       offset="0"
                       length="2">
     <tr>
<td><%=book.getBookName()%></td>
<td><%=book.getAuthor()%></td>
<td>waiting...</td>
     </tr>
     </logic:iterate>
     </table>
     <%}%>
    </html:form>
</body>
</html:html>

解决方案 »

  1.   

    这个是struts-config.xml的代码
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
    <struts-config>
      <form-beans>
        <form-bean name="iniBookForm" type="shopping.iniBookForm" />
        <form-bean name="orderActionForm" type="shopping.OrderActionForm" />
      </form-beans>
      <global-forwards>
        <forward name="lookupsuccess" path="/initial.jsp" />
        <forward name="detail" path="/detail.jsp" />
        <forward name="initial" path="/initial.jsp" />
        <forward name="viewcart" path="/view.jsp" />
        <forward name="initialjsp" path="/initial.jsp" />
        <forward name="balance" path="/payonline.jsp" />
        <forward name="viewjsp" path="/view.jsp" />
        <forward name="allorder" path="/orderdeal.jsp" />
      </global-forwards>
      <action-mappings>
        <action name="iniBookForm" type="shopping.iniBookAction" validate="false" input="/initial.jsp" scope="request" path="/iniBookAction" />
        <action name="iniBookForm" type="shopping.lookupBookAction" validate="false" input="/initial.jsp" scope="request" path="/lookupBookAction" />
        <action name="iniBookForm" type="shopping.CartAction" validate="false" input="/detail.jsp" scope="request" path="/cartAction" />
        <action name="orderActionForm" type="shopping.ViewAction" validate="false" input="/view.jsp" scope="request" path="/viewAction" />
        <action name="orderActionForm" type="shopping.BalanceAction" validate="false" input="/payonline.jsp" scope="request" path="/balanceAction" />
        <action name="orderActionForm" type="shopping.OrderDealAction" validate="false" input="/orderdeal.jsp" scope="request" path="/orderDealAction" />
      </action-mappings>
    </struts-config>请问哪里配置错了吗???怎么改啊??
      

  2.   

    没有资源文件我说详细一点:看struts-config.xml文件
    <message-resources
        parameter="org.apache.struts.webapp.example.ApplicationResources"/>  <message-resources
        parameter="org.apache.struts.webapp.example.AlternateApplicationResources_zh"
        key="alternate">
      </message-resources>
    上面第一个没有指明key,那么就是缺省的“org.apache.struts.action.MESSAGE”
    当你的页面有<bean:message key="index.heading"/>没有指明bundle时,他也是用的却省的资源文件,现在你没有,所以就出异常了
      

  3.   

    那是不是增加一个ApplicationResources.properties文件就可以了?
      

  4.   

    增加一个ApplicationResources.properties文件就可以了