You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by srikanth <sr...@egovernments.org> on 2011/11/12 17:59:24 UTC

Struts Conventional plugin is not working, Not calling invoking my Action but page is displaying

struts.xml is like

<?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.1.7.dtd">
<struts>
	<constant name="struts.devMode" value="true" />
	<constant name="struts.configuration.xml.reload" value="true"/>  	
	<constant name="struts.convention.action.packages" value="my.struts2.example.web.actions" />
	<constant name="struts.custom.i18n.resources" value="custom" />
	<constant name="struts.i18n.reload" value="false" />
	<constant name="struts.locale" value="en_IN" />
	<constant name="struts.multipart.maxSize" value="10485760" />
	<constant name="struts.multipart.parser" value="jakarta"/>
	
	<package name="mypackage" extends="struts-default" namespace="/">
             ...................
         </package>
</struts>

web.xml is like


<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      version="2.5">
.............
          <filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
         <filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.action</url-pattern>
	</filter-mapping>
...............

</web-app>


Project structure is like

  -XYZ.ear|
         |--xyz.war
         |
         |--lib|
               |- xyz.jar
               |- struts2-core-2.2.3.1.jar
               |- struts2-convention-plugin-2.2.3.1.jar
               |- xwork-core-2.2.3.1.jar
               |- freemarker-2.3.16.jar
               | etc (all jars required for struts2)


  xyz.jar is containing my struts.xml file
xyz.jar contains my Action class as follows.

my.struts2.example.web.actions.common

//java imports......
@ParentPackage("mypackage")
public class HomepageAction extends ActionSupport {
    public String execute() {
       return SUCCESS;
    }
}

xyz.war contains my jsp for HomepageAction like as follows
...WEB-INF/content/common/homepage.jsp

  With this my server is starting successfully and deployed as expected but when i request URL like

  http://localhost:8080/xyz/common/homepage.action

Its not going to the HomepageAction execute method but the page is displaying

thanks





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


Re: Struts Conventional plugin is not working, Not calling invoking my Action but page is displaying

Posted by srikanth <sr...@egovernments.org>.
Everything is fine, the problem is conventional plugin wont work with 
jboss as 7... but the problem got solved by xwork-core patch.

On 21-11-2011 11:58, Li Ying wrote:
> Do you want to map your action to the following url?
> namespace: common
> action:  homepage
>
> But your package configuration is:
> <package name="mypackage" extends="struts-default" namespace="/">
>
> I think maybe this setting maps all the actions in this package to
> namespace "/",
> but not "common" as you want.
>
> Read the following documents, may help:
> http://struts.apache.org/2.x/docs/package-configuration.html
> and
> http://struts.apache.org/2.x/docs/namespace-configuration.html
>
>
> 2011/11/13 srikanth<sr...@egovernments.org>:
>> struts.xml is like
>>
>> <?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.1.7.dtd">
>> <struts>
>>         <constant name="struts.devMode" value="true" />
>>         <constant name="struts.configuration.xml.reload" value="true"/>
>>
>>         <constant name="struts.convention.action.packages"
>> value="my.struts2.example.web.actions" />
>>         <constant name="struts.custom.i18n.resources" value="custom" />
>>         <constant name="struts.i18n.reload" value="false" />
>>         <constant name="struts.locale" value="en_IN" />
>>         <constant name="struts.multipart.maxSize" value="10485760" />
>>         <constant name="struts.multipart.parser" value="jakarta"/>
>>
>>         <package name="mypackage" extends="struts-default" namespace="/">
>>             ...................
>>         </package>
>> </struts>
>>
>> web.xml is like
>>
>>
>> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>>      version="2.5">
>> .............
>>          <filter>
>>                 <filter-name>struts2</filter-name>
>>
>>   <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>>         </filter>
>>         <filter-mapping>
>>                 <filter-name>struts2</filter-name>
>>                 <url-pattern>*.action</url-pattern>
>>         </filter-mapping>
>> ...............
>>
>> </web-app>
>>
>>
>> Project structure is like
>>
>>   -XYZ.ear|
>>         |--xyz.war
>>         |
>>         |--lib|
>>               |- xyz.jar
>>               |- struts2-core-2.2.3.1.jar
>>               |- struts2-convention-plugin-2.2.3.1.jar
>>               |- xwork-core-2.2.3.1.jar
>>               |- freemarker-2.3.16.jar
>>               | etc (all jars required for struts2)
>>
>>
>>   xyz.jar is containing my struts.xml file
>> xyz.jar contains my Action class as follows.
>>
>> my.struts2.example.web.actions.common
>>
>> //java imports......
>> @ParentPackage("mypackage")
>> public class HomepageAction extends ActionSupport {
>>    public String execute() {
>>       return SUCCESS;
>>    }
>> }
>>
>> xyz.war contains my jsp for HomepageAction like as follows
>> ...WEB-INF/content/common/homepage.jsp
>>
>>   With this my server is starting successfully and deployed as expected but
>> when i request URL like
>>
>>   http://localhost:8080/xyz/common/homepage.action
>>
>> Its not going to the HomepageAction execute method but the page is
>> displaying
>>
>> thanks
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Struts Conventional plugin is not working, Not calling invoking my Action but page is displaying

Posted by Li Ying <li...@gmail.com>.
Do you want to map your action to the following url?
namespace: common
action:  homepage

But your package configuration is:
<package name="mypackage" extends="struts-default" namespace="/">

I think maybe this setting maps all the actions in this package to
namespace "/",
but not "common" as you want.

Read the following documents, may help:
http://struts.apache.org/2.x/docs/package-configuration.html
and
http://struts.apache.org/2.x/docs/namespace-configuration.html


2011/11/13 srikanth <sr...@egovernments.org>:
> struts.xml is like
>
> <?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.1.7.dtd">
> <struts>
>        <constant name="struts.devMode" value="true" />
>        <constant name="struts.configuration.xml.reload" value="true"/>
>
>        <constant name="struts.convention.action.packages"
> value="my.struts2.example.web.actions" />
>        <constant name="struts.custom.i18n.resources" value="custom" />
>        <constant name="struts.i18n.reload" value="false" />
>        <constant name="struts.locale" value="en_IN" />
>        <constant name="struts.multipart.maxSize" value="10485760" />
>        <constant name="struts.multipart.parser" value="jakarta"/>
>
>        <package name="mypackage" extends="struts-default" namespace="/">
>            ...................
>        </package>
> </struts>
>
> web.xml is like
>
>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>     version="2.5">
> .............
>         <filter>
>                <filter-name>struts2</filter-name>
>
>  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>        </filter>
>        <filter-mapping>
>                <filter-name>struts2</filter-name>
>                <url-pattern>*.action</url-pattern>
>        </filter-mapping>
> ...............
>
> </web-app>
>
>
> Project structure is like
>
>  -XYZ.ear|
>        |--xyz.war
>        |
>        |--lib|
>              |- xyz.jar
>              |- struts2-core-2.2.3.1.jar
>              |- struts2-convention-plugin-2.2.3.1.jar
>              |- xwork-core-2.2.3.1.jar
>              |- freemarker-2.3.16.jar
>              | etc (all jars required for struts2)
>
>
>  xyz.jar is containing my struts.xml file
> xyz.jar contains my Action class as follows.
>
> my.struts2.example.web.actions.common
>
> //java imports......
> @ParentPackage("mypackage")
> public class HomepageAction extends ActionSupport {
>   public String execute() {
>      return SUCCESS;
>   }
> }
>
> xyz.war contains my jsp for HomepageAction like as follows
> ...WEB-INF/content/common/homepage.jsp
>
>  With this my server is starting successfully and deployed as expected but
> when i request URL like
>
>  http://localhost:8080/xyz/common/homepage.action
>
> Its not going to the HomepageAction execute method but the page is
> displaying
>
> thanks
>
>
>
>
>
> ---------------------------------------------------------------------
> 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