You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Reynolds <ji...@gmail.com> on 2006/02/17 16:50:49 UTC

extension-mapping path-mapping

Hello,

I am probbly wrong on a couple of issues here, so I am needing
assistance on the following:

I am running a struts application in a directory (context?) named "test".
In my web.xml I configured the following:
  <servlet>
    <servlet-name>test</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
......
  <servlet-mapping>
    <servlet-name>test</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>


For whatever reason, I have alwasy called the application with
/test/welcome.do or something like that.

Question1) Does the name in the servlet-name, have to be the same name
as the context? Or did it just work because of that.

Question 2) Because I am using Tomcat 5.5, the group says I need to
run my struts app in the "root" of the webserver. So I am confused, do
I need to change the servlet-name to "root" or can I just call
welcome.do in the root folder.

Question 3) Someone mentioned I may have better luck getting indexed
if my app used path-mapping and not extension mapping. Can I change it
after the app is up and running, Is it just a config?

I apologize, but I have only done the form from the examples which I
guess use the *.do

Thanks,

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


Re: extension-mapping path-mapping

Posted by Dave Newton <ne...@pingsite.com>.
Jim Reynolds wrote:
> I am running a struts application in a directory (context?) named "test".
> In my web.xml I configured the following:
>   <servlet>
>     <servlet-name>test</servlet-name>
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> ......
>   <servlet-mapping>
>     <servlet-name>test</servlet-name>
>     <url-pattern>*.do</url-pattern>
>   </servlet-mapping>
>
>
> For whatever reason, I have alwasy called the application with
> /test/welcome.do or something like that.
>
> Question1) Does the name in the servlet-name, have to be the same name
> as the context? Or did it just work because of that.
>   
No. It doesn't matter what the servlet-name is, although most people use
'action'.
> Question 2) Because I am using Tomcat 5.5, the group says I need to
> run my struts app in the "root" of the webserver. So I am confused, do
> I need to change the servlet-name to "root" or can I just call
> welcome.do in the root folder.
>   
Uh...

- You don't need to run it in the root of the webserver, which would be
in (by default) ${tomcat-dir}/webapps/ROOT.
- If you deployed to ROOT you would use http://${hostname}/welcome.do.
> Question 3) Someone mentioned I may have better luck getting indexed
> if my app used path-mapping and not extension mapping. Can I change it
> after the app is up and running, Is it just a config?
>   
Sure. Normally Tomcat will restart the app if web.xml is touched.

Bear in mind that depending on your application/server setup you could
just extension map to *.html.

You might also want to brush up on basic J2EE web-app stuff.

Dave



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