PDA

View Full Version : directory like URL, no extension?


vincent
Oct 7th, 2005, 06:57 AM
Hi, all

Is it possible to configure my web application to use directory like URL without using file extension? I mean:

http://localhost/myspring/signon, that is, pattern /signon will invoke signon.class to handle request.

After form submitted, URL will looked like this:

http://localhost/myspring/signon?username=xyz&password=123

signon.class will react according to received parameters. I can't see why we need any .html or .form extension in our web service. But I am still a newbie, I can't proper web.xml and dispatcher-servlet.xml. Any help?

Thanks,

Vincent Chen

jeoffw
Oct 11th, 2005, 11:46 AM
Vincent, you can map a spring dispatcher using a servlet-mapping like "/disp/*" in web.xml, although then you're jailed inside the "disp" subfolder.

FYI, you're not the only one searching for answers here:

"URL mapping, why don't I get it?"
http://forum.springframework.org/showthread.php?t=18004

"JstlView, extensionless URLs, /* matching and loops"
http://forum.springframework.org/showthread.php?t=18789


I too am looking for a clean/simple solution. So far the only possible solution I've found is to add multiple servlet-mapping elements to web.xml (one for each sub-url the dispatcher might need to dispatch). Then, you turn on the dispatcher's AlwaysUseFullPath property, to make sure the different sub-urls don't stomp on each other.

It would be really nice if we could get clean dispatching without having to manually/redundantly manage the mappings in web.xml as well as in the dispatcher.