struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srineel Mazumdar <smaz19...@gmail.com>
Subject Issue with running Struts2 project
Date Mon, 05 Nov 2012 06:08:10 GMT
Hi,

I am new to Struts2 and for learning I am doing my own project. I am facing
the following issue and need help in fixing:

http://localhost:8081/NewPetstore : This URL is opening the index page.

However
http://localhost:8081/NewPetstore/shop/index.do shows 404 .


PFB the

*web xml*

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee" xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
  <display-name>NewPetstore</display-name>
  <!--
- Key of the system property that should specify the root directory of this
- web app. Applied by WebAppRootListener or Log4jConfigListener.
-->
<context-param>
        <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>

<param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
    </context-param>
    <filter>
        <filter-name>struts-cleanup</filter-name>

<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
    </filter>

    <filter>
        <filter-name>struts</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>


    <filter-mapping>
        <filter-name>struts-cleanup</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>



    <filter-mapping>
        <filter-name>struts</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

<!--
- Key of the system property that should specify the root directory of this
- web app. Applied by WebAppRootListener or Log4jConfigListener.
-->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>petstore.root</param-value>
</context-param>

<!--
- Location of the Log4J config file, for initialization and refresh checks.
- Applied by Log4jConfigListener.
-->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>

   <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

*struts.xml*

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<package name="newpetstore" extends="struts-default" namespace="/shop">

 <global-results>
<result name="failure">/WEB-INF/jsp/struts/Error.jsp</result>
<result name="unknown-error">/WEB-INF/jsp/struts/Error.jsp</result>
<result name="global-signon">/WEB-INF/jsp/struts/SignonForm.jsp</result>
</global-results>
 <action name="addItemToCart"
class="org.springframework.samples.jpetstore.web.struts.AddItemToCartAction">
<result name="success">/WEB-INF/jsp/struts/Cart.jsp<result/>
</action>

<action name ="checkout" name
="org.springframework.samples.jpetstore.web.struts.ViewCartAction">
<result name="success">/WEB-INF/jsp/struts/Checkout.jsp<result/>
</action>
 <!-- Check  -->
<!-- <action name="editAccount" class
="org.springframework.samples.jpetstore.web.struts.EditAccountAction"
name="workingAccountForm" scope="session" validate="true"
input="/WEB-INF/jsp/struts/EditAccountForm.jsp">
<result name="success" name="index.do"/>
</action>
 -->
<action name="editAccount"
class="org.springframework.samples.jpetstore.web.struts.EditAccountAction">
        <result type="redirectAction>
                <param name="actionName">index</param>
        </result>
        <result
name="input">/WEB-INF/jsp/struts/EditAccountForm.jsp</result>
</action>
 <action name="editAccountForm" class
="org.springframework.samples.jpetstore.web.struts.EditAccountFormAction">
<result name="success">/WEB-INF/jsp/struts/EditAccountForm.jsp<result/>
</action>
 <action name ="index" class
="org.springframework.samples.jpetstore.web.struts.DoNothingAction">
<result name="success">/WEB-INF/jsp/struts/index.jsp<result/>
</action>
 <action name ="listOrders" class
="org.springframework.samples.jpetstore.web.struts.ListOrdersAction">
<result name="success">/WEB-INF/jsp/struts/ListOrders.jsp<result/>
</action>
 <!--  Check -->
<!-- <action name="newAccount"
class="org.springframework.samples.jpetstore.web.struts.NewAccountAction"
name="workingAccountForm" scope="session" validate="true"
input="/WEB-INF/jsp/struts/NewAccountForm.jsp">
<result name="success">index.do<result/>
</action> -->
 <action name="newAccount"
class="org.springframework.samples.jpetstore.web.struts.EditAccountAction">
        <result type="redirectAction>
                <param name="actionName">index</param>
                <param name="namespace">/shop</param>
        </result>
        <result name="input">/WEB-INF/jsp/struts/NewAccountForm.jsp</result>
</action>
 <action name ="newAccountForm" class
="org.springframework.samples.jpetstore.web.struts.NewAccountFormAction">
<result name="success">/WEB-INF/jsp/struts/NewAccountForm.jsp<result/>
</action>
 <action name ="newOrder" class
="org.springframework.samples.jpetstore.web.struts.NewOrderAction">
<result name="confirm">/WEB-INF/jsp/struts/ConfirmOrder.jsp<result/>
<result name="shipping">/WEB-INF/jsp/struts/ShippingForm.jsp</result>
<result name="success">/WEB-INF/jsp/struts/ViewOrder.jsp</result>
</action>
 <action name ="newOrderForm" class
="org.springframework.samples.jpetstore.web.struts.NewOrderFormAction">
<result name="success">/WEB-INF/jsp/struts/NewOrderForm.jsp</result>
</action>
 <action name="removeItemFromCart"
class="org.springframework.samples.jpetstore.web.struts.RemoveItemFromCartAction">
<result name="success">/WEB-INF/jsp/struts/Cart.jsp</result>
</action>
 <action name="searchProducts"
class="org.springframework.samples.jpetstore.web.struts.SearchProductsAction">
<result name="success">/WEB-INF/jsp/struts/SearchProducts.jsp</result>
</action>
 <action name="signon"
class="org.springframework.samples.jpetstore.web.struts.SignonAction">
<result name="success">index.do</result>
</action>
 <action name="signonForm"
class="org.springframework.samples.jpetstore.web.struts.DoNothingAction">
<result name="success">/WEB-INF/jsp/struts/SignonForm.jsp</result>
</action>
 <action name="updateCartQuantities"
class="org.springframework.samples.jpetstore.web.struts.UpdateCartQuantitiesAction">
<result name="success">/WEB-INF/jsp/struts/Cart.jsp</result>
</action>
 <action name="viewCart"
class="org.springframework.samples.jpetstore.web.struts.ViewCartAction">
<result name="success">/WEB-INF/jsp/struts/Cart.jsp</result>
</action>
 <!-- Check -->
<!-- <action name="viewCategory"
class="org.springframework.samples.jpetstore.web.struts.ViewCategoryAction"
name="emptyForm" scope="session" validate="true"
input="/WEB-INF/jsp/struts/index.jsp">
<result name="success" name="/WEB-INF/jsp/struts/Category.jsp"/>
</action>
 -->
<action name="newAccount"
class="org.springframework.samples.jpetstore.web.struts.EditAccountAction">
        <result type="redirectAction>
                <param name="actionName">index</param>
                <param name="namespace">/shop</param>
        </result>
        <result name="input">/WEB-INF/jsp/struts/index.jsp</result>
</action>
 <action name="viewItem"
class="org.springframework.samples.jpetstore.web.struts.ViewItemAction">
<result name="success">/WEB-INF/jsp/struts/Item.jsp</result>
</action>
 <action name="viewOrder"
class="org.springframework.samples.jpetstore.web.struts.ViewOrderAction">
<result name="success">/WEB-INF/jsp/struts/ViewOrder.jsp"</result>
</action>
 <action name="viewProduct"
class="org.springframework.samples.jpetstore.web.struts.ViewProductAction"
<result name="success">/WEB-INF/jsp/struts/Product.jsp</result>
</action>
 </struts>

*applicationContext.xml,*
*
*
<?xml version="1.0" encoding="UTF-8"?>

<!-- - Application context definition for JPetStore's business layer. -
Contains
bean references to the transaction manager and to the DAOs in -
dataAccessContext-local/jta.xml
(see web.xml's "contextConfigLocation"). -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="
http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">


<bean id="addItemToCartAction"
class="com.home.practice.shop.AddItemToCartAction">
<property name="workingItemId" value="" />
<property name="cart" ref="domain.cart" />
</bean>

<!-- <bean id="baseAction" class="com.home.practice.shop.BaseAction" /> -->

<bean id="doNothingAction" class="com.home.practice.shop.DoNothingAction" />

<bean id="editAccountAction"
class="com.home.practice.shop.EditAccountAction">
<property name="username" value="" />
<property name="password" value="" />
<property name="repeatedPassword" value="" />
<property name="languages">
<list>
<value>enlish</value>
<value>japanese</value>
</list>
</property>
<property name="categories">
<list></list>
</property>
<property name="validate" value="" />
<property name="forwardAction" value="" />
<property name="account" ref="domain.account" />
<property name="myList" ref = "myPageList" />
</bean>

<bean id="editAccountFormAction"
class="com.home.practice.shop.EditAccountFormAction" />
 <bean id="listOrdersAction"
class="com.home.practice.shop.ListOrdersAction" />
 <bean id="newAccountAction"
class="com.home.practice.shop.NewAccountAction" />

 <bean id="newOrderAction" class="com.home.practice.shop.NewOrderAction">
<property name="order" ref="domain.order" />
<property name="shippingAddressRequired" value="false" />
<property name="confirmed" value="false" />
<property name="cardTypeList">
<list>
<value>Visa</value>
<value>MasterCard</value>
<value>American Express</value>
</list>
</property>
</bean>


<bean id="newOrderFormAction"
class="com.home.practice.shop.NewOrderFormAction">
<property name="order" ref="domain.order" />
<property name="shippingAddressRequired" value="false" />
<property name="confirmed" value="false" />
<property name="cardTypeList">
<list>
<value>Visa</value>
<value>MasterCard</value>
<value>American Express</value>
</list>
</property>
</bean>
 <bean id="removeItemFromCartAction"
class="com.home.practice.shop.RemoveItemFromCartAction">
<property name="workingItemId" value="" />
<property name="cart" ref="domain.cart" />
</bean>

<bean id="searchProductsAction"
class="com.home.practice.shop.SearchProductsAction" />


<bean id="signonAction" class="com.home.practice.shop.SignonAction">
<property name="username" value="" />
<property name="password" value="" />
<property name="repeatedPassword" value="" />
<property name="languages">
<list>
<value>enlish</value>
<value>japanese</value>
</list>
</property>
<property name="categories">
<list></list>
</property>
<property name="validate" value="" />
<property name="forwardAction" value="" />
<property name="account" ref="domain.account" />
<property name="myList" ref = "myPageList" />
</bean>

 <bean id="updateCartQuantitiesAction"
class="com.home.practice.shop.UpdateCartQuantitiesAction">
<property name="workingItemId" value="" />
<property name="cart" ref="domain.cart" />
</bean>


<bean id="viewCartAction" class="com.home.practice.shop.ViewCartAction">
<property name="workingItemId" value="" />
<property name="cart" ref="domain.cart" />
</bean>


<bean id="viewCategoryAction"
class="com.home.practice.shop.ViewCategoryAction" />

<bean id="viewItemAction" class="com.home.practice.shop.ViewItemAction" />

<bean id="viewOrderAction" class="com.home.practice.shop.ViewOrderAction">
<property name="username" value="" />
<property name="password" value="" />

<property name="repeatedPassword" value="" />

<property name="languages">
<list>
<value>enlish</value>
<value>japanese</value>
</list>
</property>
<property name="categories">
<list></list>
</property>
<property name="validate" value="" />

<property name="forwardAction" value="" />

<property name="account" ref="domain.account" />

<property name="myList"
ref = "myPageList" />
</bean>


<bean id="viewProductAction"
class="com.home.practice.shop.ViewProductAction" />
 <bean id="domain.account" class="com.home.practice.shop.domain.Account" />
<bean id="domain.cart" class="com.home.practice.shop.domain.Cart" />
<bean id="domain.cartItem" class="com.home.practice.shop.domain.CartItem" />
<bean id="domain.category" class="com.home.practice.shop.domain.Category" />
<bean id="domain.item" class="com.home.practice.shop.domain.Item" />
<bean id="domain.lineItem" class="com.home.practice.shop.domain.LineItem" />
<bean id="domain.order" class="com.home.practice.shop.domain.Order" />
<bean id="domain.product" class="com.home.practice.shop.domain.Product" />
<bean id="myPageList" class =
"org.springframework.beans.support.PagedListHolder"/>


</beans>


Regards,
Srineel

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message