Справочник функций

Ваш аккаунт

Войти через: 
Забыли пароль?
Регистрация
Информацию о новых материалах можно получать и без регистрации:

Почтовая рассылка

Подписчиков: -1
Последний выпуск: 19.06.2015

запуск JSP

7.6K
24 мая 2007 года
JEgor
54 / / 08.11.2006
Привет всем! Пытаюсь запустить JSP:
Код:
<%@ taglib prefix="html" uri="/tags/struts-html" %>
<%@ taglib prefix="bean" uri="/tags/struts-bean" %>

<%@ taglib prefix="bean" uri="/tags/struts-bean" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- :TODO: It would be interesting to try this with frames and modules -->
<html>
<head>
<title>Добро пожаловать в магазин.</title>
</head>
<body>
<h1>Список товаров</h1>
<html:errors />
<table>
<thead>
<tr><c:forEach var="column"
items="Наименование товара,цена,В наличии на складе,Заказать">
<th><c:out value="${column}"/></th>
</c:forEach>
</tr>
</thead>
<tbody>
<c:forEach var="item" items="${goods}">
<tr><td><c:out value="${item.name}"/></td>
<td><c:out value="${item.price}"/></td>
<td><c:out value="${item.quantity}"/></td>
<td><html:form action="orderItem">
<input type="hidden" name="id" value="<c:out value=’${item.id}’/>"/>
<html:text property="quantity"/>
<html:submit />
</html:form></td>
</tr>
</c:forEach>
</tbody>
</table>
<p><html:link page="/showCart.do">Перейти к корзине</html:link>
</p>
</body>
</html>

Веб-сервер выдает ошибку:
Код:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:495)
    at org.apache.jsp.list_jsp._jspService(list_jsp.java:77)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:198)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:138)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2459)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:132)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:593)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:126)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)


root cause

javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:741)
    at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
    at org.apache.jsp.list_jsp._jspx_meth_html_form_0(list_jsp.java:105)
    at org.apache.jsp.list_jsp._jspService(list_jsp.java:67)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:198)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:138)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2459)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:132)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:593)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:126)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:432)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:954)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)

Хотя все Sturts lib я добавил в \WEB-INF\lib и в \shared\lib.
Может кто знает в чем дело.
6.6K
25 мая 2007 года
Aoli
185 / / 22.01.2007
А что ты в struts-config написал?
7.6K
25 мая 2007 года
JEgor
54 / / 08.11.2006
Код:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
          "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<!--
  Default configuration file for examples application.
  Each module also has its own struts-config under: /WEB-INF/$MODULE/
  @version $Revision: 1.9 $ $Date: 2004-09-07 03:50:06 +0100 (Tue, 07 Sep 2004) $
-->
<struts-config>
   <data-sources>
  <data-source>
  <set-property property="driverClass" value="com.mysql.jdbc.Driver"/>
  <set-property property="url" value="jdbc:mysql://localhost/store"/>
  <set-property property="user" value="root"/>
  </data-source>
  </data-sources>

  <form-beans>
  <form-bean
  name="orderForm"
  type="com.koliamorev.OrderForm"/>
  </form-beans>

  <action-mappings>
    </action>
    <action
   path="/listItems"
   type="com.koliamorev.ListItemsAction"
   scope="session"
   input="/list.jsp">
   <forward name="success" path="/list.jsp"/>
   </action>

    <action
     path="/orderItem"
    type="com.koliamorev.OrderItemAction"
   name="orderForm"
   scope="session"
   input="/list.jsp">
   <forward name="success" path="/showCart.do"/>
   </action>

   <action
   path="/showCart"
   type="com.koliamorev.ShowCartAction"
   input="/list.jsp">
   <forward name="success" path="/cart.jsp"/>
   </action>
  </action-mappings>
  <message-resources parameter="resources.application"/>
</struts-config>

Пакет com.koliamorev. с классами у меня лежит в \WEB-INF\classes
web.xml:
Код:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
  <display-name>Struts Examples Application</display-name>
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>

    <!-- module configurations -->
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>

  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <!-- The Usual Welcome File List -->
  <welcome-file-list>
    <welcome-file>list.jsp</welcome-file>
    <welcome-file>cart.jsp</welcome-file>
  </welcome-file-list>
  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/tags/struts-html</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/tags/struts-logic</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/tags/struts-nested</taglib-uri>
    <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
  </taglib>
  <!-- tiles not used here
    <taglib>
      <taglib-uri>/tags/struts-tiles</taglib-uri>
      <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
    </taglib>
    -->
</web-app>

Возможно что в *.xml неправельно написано?
6.6K
27 мая 2007 года
Aoli
185 / / 22.01.2007
Код:
<action-mappings>
    </action> - это зачем тут? :))
    <action
   path="/listItems"
   type="com.koliamorev.ListItemsAction"
   scope="session"
   input="/list.jsp">!!!
   <forward name="success" path="/list.jsp"/>
   </action>

    <action
     path="/orderItem"
    type="com.koliamorev.OrderItemAction"
   name="orderForm"
   scope="session"
   input="/list.jsp"> - если ты пишешь страничку инпута, то обязан написать имя бина формы, например так:
<action ... name="orderForm" input="/orderIn.jsp"/>
   <forward name="success" path="/showCart.do"/>
   </action>

   <action
   path="/showCart"
   type="com.koliamorev.ShowCartAction"
   input="/list.jsp"> - аналогично :)
   <forward name="success" path="/cart.jsp"/>
   </action>
  </action-mappings>
Реклама на сайте | Обмен ссылками | Ссылки | Экспорт (RSS) | Контакты
Добавить статью | Добавить исходник | Добавить хостинг-провайдера | Добавить сайт в каталог