struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: Pretty urls without .action
Date Tue, 22 Jan 2008 10:16:01 GMT
Hi Jignesh,

You're right.  It doesn't work in the root namespace (only). It works in 
other namespaces. (I was testing in /test/)

The reason is that when you GET http://host:8080/email tomcat responds 
with a 302 Redirect to http://host:8080/email/
Your browser then does a GET to http://host:8080/email/ and tomcat 
returns a 404 Not Found (correctly)

I'm not sure where that behaviour originates.  I'll post separately 
about this to see if anyone else knows.

It works when change the namespace of your action like this:

<package name="ISP" extends="struts-default" namespace="/isp">

In this case, GET http://host:8080/isp/email will execute your action.

regards,
 Jeromy Evans

jignesh.patel wrote:
> Hi,
> This is my web.xml
> <web-app>
>
>     <display-name>Project Name</display-name>
>
>         <filter>
>         <filter-name>struts-cleanup</filter-name>
>        
> <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
>         </filter>
>
>     <filter>
>         <filter-name>struts2</filter-name>
>        
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>     </filter>
>         <filter>
>                 <filter-name>sitemesh</filter-name>
>                
> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
>         </filter>
>         <filter-mapping>
>         <filter-name>struts-cleanup</filter-name>
>         <url-pattern>/*</url-pattern>
>         </filter-mapping>
>         <filter-mapping>
>         <filter-name>sitemesh</filter-name>
>         <url-pattern>/*</url-pattern>
>         </filter-mapping>
>     <filter-mapping>
>         <filter-name>struts2</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>
>    <session-config>
>                 <session-timeout>60</session-timeout>
>         </session-config>
>
>     <welcome-file-list>
>         <welcome-file>ISP_View/index.html</welcome-file>
>     </welcome-file-list>
>
> </web-app>
>
> This is my sample struts.xml
> <struts>
>     <package name="ISP" extends="struts-default">
>
>                 <interceptors>
>                         <interceptor name="closeSession"
> class="isp.interceptor.CloseSessionInterceptor"/>
>
>                         <interceptor-stack name="default">
>                                         <interceptor-ref
> name="closeSession"/>
>                                         <interceptor-ref
> name="completeStack"/>
>                                         <interceptor-ref
> name="paramsPrepareParamsStack"/>
>                         </interceptor-stack>
>
>                 </interceptors>
>
>   <action name="email" class="isp.action.TempAction">
>                         <result>/XXX_View/temp.jsp</result>
>                         <result name="success">/XXX_View/temp.jsp</result>
>                         <result name="input">/XXX_View/temp.jsp</result>
>                 </action>
> </package>
> </struts>
>
> struts.properties file
>
> struts.devMode = true
> struts.enable.SlashesInActionNames=true
> struts.multipart.parser=org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest
>
>
> And url works fine with .action and .com not works only with /email or every
> action name without .action ext. ):
>
> And one more thing i am using sitemesh,but i think it not a big issue at
> all.
>
> Br,
> jignesh
>
>
>
>
>
> jignesh.patel wrote:
>   
>> Hi,
>>
>> Still not able to call without any domain name like .action,.com
>>
>> URL:- http://host:8080/email(withour . extension)
>> Error Page:-
>>
>> type Status report
>> message /email
>> description The requested resource (/email) is not available.   
>>
>> My struts.properties file
>>
>> struts.devMode = true
>> struts.enable.SlashesInActionNames=true
>> struts.multipart.parser=org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest
>> struts.action.extension=action,,com
>>
>> Have u check it with your struts application any time before..
>>
>> Plz reply
>>
>>
>>
>> Jeromy Evans - Blue Sky Minds wrote:
>>     
>>> Yes, the constant "struts.action.extension" takes a comma separated list:
>>>
>>> eg.
>>> struts.action.extension=action,,
>>>
>>> The double comma above means "blank" is a valid extension
>>>
>>> You can add that to struts.properties, struts.xml or web.xml: 
>>> http://struts.apache.org/2.x/docs/constant-configuration.html
>>> You'll have to take care with your mod_jk mappings.
>>>
>>> jignesh(india) wrote:
>>>       
>>>> Hi,
>>>>     I am having struts2 application ready with my tomcat server.Now i
>>>> want
>>>> to host it with apache server,but it should be looks like pretty one.
>>>> I mean i want my urls without .action,.do or anything just like action
>>>> name
>>>> nothing more.Is this possible in struts2
>>>> e.g 
>>>> https://kily.myseaversite.com/category.action should be work like
>>>> https://kily.myseaversite.com/category
>>>>
>>>> Can anybody help me..?
>>>>
>>>> Thanks in advanced
>>>> Br,jignesh
>>>>
>>>>   
>>>>         
>>> ---------------------------------------------------------------------
>>> 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


Mime
View raw message