You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by angelwei <go...@hotmail.com> on 2008/07/31 07:48:53 UTC

Create multiple struts configuration file problem

Hai, can anybody help me to solve the problem javax.servlet.jsp.JspException:
Cannot retrieve mapping for action /pro.
if i replace the content in struts-config-product.xml to struts-config.xml.
it work. any idea???

web.xml

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/product</param-name>
<param-value>/WEB-INF/product/struts-config-product.xml</param-value>
</init-param>

struts-config-product.xml (product folder)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>

<!-- Data Sources -->
<data-sources>
</data-sources>

<!-- Form Beans -->
<form-beans>
<form-bean name="productForm" type="app.ProductForm"/>
</form-beans>

<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>

<!-- Global Forwards -->
<global-forwards>
</global-forwards>

<!-- Action Mappings -->
<action-mappings>
<action path="/pro"
type="app.ProductAction"
name="productForm"
scope="request">
<forward name="success" path="/success.html"/>
</action>
</action-mappings>

</struts-config>

ProductForm.java

package app;

import org.apache.struts.action.ActionForm;

public class ProductForm extends ActionForm{
private int id;

public int getId(){
return id;
}

public void setId(int id){
this.id=id;
}
}

ProductAction.java

package app;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class ProductAction extends Action{
public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
ProductForm product=(ProductForm)form;
int iProduct=product.getId();
HttpSession session=request.getSession();
session.setAttribute("product",form);
return mapping.findForward("success");
}
}

thank you.
-- 
View this message in context: http://www.nabble.com/Create-multiple-struts-configuration-file-problem-tp18748135p18748135.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Create multiple struts configuration file problem

Posted by "Engr. Jherald Gerome Lacambra" <jg...@gmail.com>.
try first to use what i have posted. Its different from what you are using
now

2008/8/7 angelwei <go...@hotmail.com>:

>
> if i try this on web.xml:
>
>   <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,
> /WEB-INF/struts-config-product.xml</param-value>
>     </init-param>
>       <load-on-startup>1</load-on-startup>
> </servlet>
>
> it can run well. but if i try to use different <init-param> tag
> it come out the error.
>
> javax.servlet.jsp.JspException: Cannot retrieve mapping for action /pro.
>
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>config/product</param-name>
> <param-value>/WEB-INF/product/struts-config-product.xml</param-value>
> </init-param>
>
> what's going wrong???
> i waste a lot of time to solve it..
> Do u have any idea???
> --
> View this message in context:
> http://www.nabble.com/Create-multiple-struts-configuration-file-problem-tp18748135p18863061.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jherald Gerome Lacambra

Re: Create multiple struts configuration file problem

Posted by angelwei <go...@hotmail.com>.
if i try this on web.xml:

   <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,
/WEB-INF/struts-config-product.xml</param-value>
     </init-param>
      <load-on-startup>1</load-on-startup>
</servlet>

it can run well. but if i try to use different <init-param> tag 
it come out the error.

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /pro.

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/product</param-name>
<param-value>/WEB-INF/product/struts-config-product.xml</param-value>
</init-param> 

what's going wrong???
i waste a lot of time to solve it..
Do u have any idea???
-- 
View this message in context: http://www.nabble.com/Create-multiple-struts-configuration-file-problem-tp18748135p18863061.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Create multiple struts configuration file problem

Posted by "Engr. Jherald Gerome Lacambra" <jg...@gmail.com>.
try this on web.xml:

   <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,
/WEB-INF/struts-config-product.xml</param-value>
     </init-param>
      <load-on-startup>1</load-on-startup>
</servlet>


2008/8/6 angelwei <go...@hotmail.com>:

>
> ya, i want to know how to create different module. this is because my
> current
> work need to do that.
> can anybody tell me how to create multiple struts configuration file??
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/Create-multiple-struts-configuration-file-problem-tp18748135p18842655.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jherald Gerome Lacambra

Re: Create multiple struts configuration file problem

Posted by angelwei <go...@hotmail.com>.
ya, i want to know how to create different module. this is because my current
work need to do that.
can anybody tell me how to create multiple struts configuration file??
Thanks.
-- 
View this message in context: http://www.nabble.com/Create-multiple-struts-configuration-file-problem-tp18748135p18842655.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Browser url & parameters

Posted by Pascal Lalonde <pl...@auroramsc.com>.
Hi guys,

    I am wondering if it's possible to modify the url format to get an 
url of file format.

Current pattern:
www.myfunnyurl.com/namespace/actionname.action?param1=value1&param2=value2

I am looking for something like this:
www.myfunnyurl.com/namespace/actionname/value1/value2

Thanks,

-- 

*Pascal Lalonde
Programmeur Analyste*

------------------------------------------------------------------------

Re: Create multiple struts configuration file problem

Posted by Dave Newton <ne...@yahoo.com>.
Are you deliberately using modules (if so, I have no idea--I always found them more trouble than they're worth)? If not you can just use a comma-separated list.

Dave


--- On Thu, 7/31/08, angelwei <go...@hotmail.com> wrote:

> From: angelwei <go...@hotmail.com>
> Subject: Create multiple struts configuration file problem
> To: user@struts.apache.org
> Date: Thursday, July 31, 2008, 1:48 AM
> Hai, can anybody help me to solve the problem
> javax.servlet.jsp.JspException:
> Cannot retrieve mapping for action /pro.
> if i replace the content in struts-config-product.xml to
> struts-config.xml.
> it work. any idea???
> 
> web.xml
> 
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>config/product</param-name>
> <param-value>/WEB-INF/product/struts-config-product.xml</param-value>
> </init-param>
> 
> struts-config-product.xml (product folder)
> 
> <?xml version="1.0"
> encoding="UTF-8"?>
> <!DOCTYPE struts-config PUBLIC "-//Apache Software
> Foundation//DTD Struts
> Configuration 1.1//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> <struts-config>
> 
> <!-- Data Sources -->
> <data-sources>
> </data-sources>
> 
> <!-- Form Beans -->
> <form-beans>
> <form-bean name="productForm"
> type="app.ProductForm"/>
> </form-beans>
> 
> <!-- Global Exceptions -->
> <global-exceptions>
> </global-exceptions>
> 
> <!-- Global Forwards -->
> <global-forwards>
> </global-forwards>
> 
> <!-- Action Mappings -->
> <action-mappings>
> <action path="/pro"
> type="app.ProductAction"
> name="productForm"
> scope="request">
> <forward name="success"
> path="/success.html"/>
> </action>
> </action-mappings>
> 
> </struts-config>
> 
> ProductForm.java
> 
> package app;
> 
> import org.apache.struts.action.ActionForm;
> 
> public class ProductForm extends ActionForm{
> private int id;
> 
> public int getId(){
> return id;
> }
> 
> public void setId(int id){
> this.id=id;
> }
> }
> 
> ProductAction.java
> 
> package app;
> 
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.HttpSession;
> 
> import org.apache.struts.action.Action;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionForward;
> import org.apache.struts.action.ActionMapping;
> 
> public class ProductAction extends Action{
> public ActionForward perform(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request, HttpServletResponse response){
> ProductForm product=(ProductForm)form;
> int iProduct=product.getId();
> HttpSession session=request.getSession();
> session.setAttribute("product",form);
> return mapping.findForward("success");
> }
> }
> 
> thank you.
> -- 
> View this message in context:
> http://www.nabble.com/Create-multiple-struts-configuration-file-problem-tp18748135p18748135.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org