Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

url-pattern in servlet-mapping is giving error  RSS feed

 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my web.xml file, i am trying to map http://localhost:8080/XMLToDB/xmltodb/index.htm url to the dispatcher servlet.

please find below web.xml file:



the above url-mapping is successfully mapped to http://localhost:8080/XMLToDB/xmltodb/index.htm url.

but, now i am adding few more pages to my application. and they are not *.htm pages. so, i changed the value of url-pattern tag in web.xml file to <url-pattern>/xmltodb/*</url-pattern> . but this time, i am getting below error on opening the url:

The requested resource () is not available.

please tell me the correct url-pattern that will match both XMLToDB/xmltodb/index.htm, and XMLToDB/xmltodb/mapping urls.

i tried; xmltodb/*, xmltodb/**, xmltodb/*.*, /xmltodb/*.*, /* etc. but all fails...

please help.
 
Nivs Solanki
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vikas


Url pattern of DispatcherServlet and ActionServet of Struts framework
take the *.do ,*.jsp or *.html pattern and others , but not like this xmltodb/*, xmltodb/**, xmltodb/*.*, /xmltodb/*.*,
 
Ravishanker kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vikas,

you can user multiple <servlet-mapping> for same servlet.
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Nivs Solanki,

org.springframework.web.servlet.DispatcherServlet is spring servlet class. so we can use any mapping, as shown in one of the example from spring site below:

https://src.springframework.org/svn/spring-samples/mvc-basic/trunk/src/main/webapp/WEB-INF/web.xml

Ravishanker kumar,

ok, let me try multiple <servlet-mapping> and then get back to you. but, still am puzzling why /xmltodb/*.* is not mapping xmltodb/index.htm file?
 
Nivs Solanki
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok vikas
when it done let me know how it work as i have a very little knowledge of Spring framewok

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!