try setting your servlet mapping for the aciton servlet to

(i don't know if it will work)

more comments below...

see **
-----Original Message-----
From: Eric Dahnke [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 10:11 AM
To: [EMAIL PROTECTED]
Cc: Taro Tokuhiro
Subject: URL conventions, struts, and the Default Servlet



Hello List,

We're developing a struts application, and marketing wants to have the
following friendly urls for retrieving product information:

http://music.yamaha.com/PSR-1000
http://music.yamaha.com/CFS60

They are not happy with http://music.yamaha.com/products/PSR-1000 nor
any .do (or other extension), and not with any query strings (ie.
showProduct?modelName=PSR-1000). Fair enough, technology should support
business wishes.

We have researched struts, the JSP spec, and support for URL conventions
and have found the following information:

http://jakarta.apache.org/struts/userGuide/configuration.html

The above explains that you really need either a .do or /do/ in order to
envoke the action controller. However, the following link explains that
"The default servlet is the servlet which serves static resources as
well as serves the directory listings (if directory listings are
enabled)."

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/default-servlet.html

I have two questions then regarding the "The default servlet":

-1- Will it allow us to use http://music.yamaha.com/PSR-1000 urls? (it
seems it will)

*** yes, seems like it would.

-2- Can the default servlet be configured to be a struts action
controller?

*** no i don't think so, but you could forward to the struts controller

let's say you get a request http://music.yamaha.com/PSR-1000

overide the default servlet, read the request string, create a uri based on
the request string

grab a request dispatcher and forward to the action servlet as follows

requestDispatcher.forward(forward); //forward is a string set to
"product.do?PSR-1000"

Many Thx,

Eric Dahnke


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to