Arsen Lupen
,
Greenhorn
Apr 05, 2009 10:08:24
Hi everybody,
i am trying to make MVC tutorial of Head Firts Ch 3.
I am at the step of checking the servlet whether it works or now.
but i what i see is page not found.SelectBeer.do is the url pattern .
Could you please help to to sove problem with web.xml mapping.
because i eveything what i need according to tutorial.
Thanks in advance
Bear Bibeault
,
Sheriff
staff
Apr 05, 2009 10:27:28
No one here is clairvoyant. Please show us your setup and mappings.
Ankitt Gupta
,
Ranch Hand
Apr 05, 2009 10:28:15
It will be better for us if you provide the code
Arsen Lupen
,
Greenhorn
Apr 05, 2009 10:43:11
ok
the path :
http://localhost:8080/Beer-V1/form.html works well.
When i try to submit : here you are the web.xml detail
i am getting the error like this :
HTTP Status 404 - /Beer-V1/%E2%80%9DSelectBeer%E2%80%9D
type Status report
message /Beer-V1/%E2%80%9DSelectBeer%E2%80%9D
description The requested resource (/Beer-V1/%E2%80%9DSelectBeer%E2%80%9D) is not available.
When i try to directly use the link:
http://localhost:8080/Beer-V1/SelectBeer
i got this :
HTTP Status 405 - HTTP method GET is not supported by this URL
here you are the web diractory structure:
form.html is in C:\Tomcat 5.5\webapps\Beer-V1
web.xml is in
C:\Tomcat 5.5\webapps\Beer-V1\WEB-INF
What can be the problem.
Ankitt Gupta
,
Ranch Hand
Apr 05, 2009 10:48:08
<url-pattern>/SelectBeer</url-pattern>
it will be
<url-pattern>/SelectBeer.do</url-pattern>
Bauke Scholtz
,
Ranch Hand
Apr 05, 2009 10:48:16
The 'action' value of your <form> is wrong. It should cover the exact url-pattern of the servlet.
Arsen Lupen
,
Greenhorn
Apr 05, 2009 10:52:02
thanks for quick reply
my html is
and i ahve changed the web xml to
and i am gettin the same error
type Status report
message /Beer-V1/%E2%80%9DSelectBeer.do%E2%80%9D
description The requested resource (/Beer-V1/%E2%80%9DSelectBeer.do%E2%80%9D) is not available.
Arsen Lupen
,
Greenhorn
Apr 05, 2009 10:53:12
web xml also SelectBeer.do
i am sorry for old file.
Ankitt Gupta
,
Ranch Hand
Apr 05, 2009 10:58:17
Change your XML from
TO
Arsen Lupen
,
Greenhorn
Apr 05, 2009 10:59:32
please see my las message i
I have already changed
Bauke Scholtz
,
Ranch Hand
Apr 05, 2009 11:03:17
You're using curly quotes instead of straight quotes. See, even the syntax highlighter borks on it, it doesn't color the values blue.
Use those quotes ".
Arsen Lupen
,
Greenhorn
Apr 05, 2009 11:03:22
Coulr you please expla'n me why the error 's wr'tten
type Status report with characters
%E2%80%9D
message /Beer-V1/%E2%80%9DSelectBeer.do%E2%80%9D
description The requested resource (/Beer-V1/%E2%80%9DSelectBeer.do%E2%80%9D) is not available.
Ankitt Gupta
,
Ranch Hand
Apr 05, 2009 11:06:02
please show your servlet class
Arsen Lupen
,
Greenhorn
Apr 05, 2009 11:08:12
Bauke you have done great.
it was beacues of qoutos.
now it works.
urrraaaaa
But why then browser didnot give any error about this quotos
Bauke Scholtz
,
Ranch Hand
Apr 05, 2009 11:12:02
You're welcome.
You won't get an error because the straight quotes are fully optional. Those curly quotes are just seen as actual part of the value. As those curly quotes aren't part of the basic ASCII charset, they got URL encoded before sending to the server side. More about URL encoding: http://www.w3schools.com/TAGS/ref_urlencode.asp
Arsen Lupen
,
Greenhorn
Apr 05, 2009 11:13:39
Thanks a lot
Bauke Scholtz
,
Ranch Hand
Apr 05, 2009 11:15:59
Oh, when I said optional, I do not necessarily mean that you should omit them. Always use them. Not only for readability, but also to avoid problems if you have spaces in the value. E.g. would only pick the value "foo" while would pick the full value "foo bar".
Arsen Lupen
,
Greenhorn
Apr 05, 2009 11:24:48
ok
i got it
thanks again
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com