How to fix the “No message available” error when using servlets
up vote
-1
down vote
favorite
I just want to catch some values from my form using servlets but i got this error :
There was an unexpected error (type=Not Found, status=404).
No message available
Here is my Servlet :
@WebServlet("/catcher")
public class catchServlet extends HttpServlet
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");
System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);
PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);
And my HTML :
<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>
The values are going to the URL, but nothing is printed neither in the console nor the /catcher
page
I've tried with the post method but it doesnt change anything
java spring servlets
|
show 1 more comment
up vote
-1
down vote
favorite
I just want to catch some values from my form using servlets but i got this error :
There was an unexpected error (type=Not Found, status=404).
No message available
Here is my Servlet :
@WebServlet("/catcher")
public class catchServlet extends HttpServlet
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");
System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);
PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);
And my HTML :
<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>
The values are going to the URL, but nothing is printed neither in the console nor the /catcher
page
I've tried with the post method but it doesnt change anything
java spring servlets
Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40
My form is at thehttp://localhost:8080/board
address and when i submit it goes herehttp://localhost:8080/catcher?cityName=London&countryCode=UK
with the error
– loic.k
Nov 11 at 14:44
That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48
I only have these infosInitializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
And i dont have web.xml file, is it necessary ?
– loic.k
Nov 11 at 15:06
Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07
|
show 1 more comment
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I just want to catch some values from my form using servlets but i got this error :
There was an unexpected error (type=Not Found, status=404).
No message available
Here is my Servlet :
@WebServlet("/catcher")
public class catchServlet extends HttpServlet
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");
System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);
PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);
And my HTML :
<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>
The values are going to the URL, but nothing is printed neither in the console nor the /catcher
page
I've tried with the post method but it doesnt change anything
java spring servlets
I just want to catch some values from my form using servlets but i got this error :
There was an unexpected error (type=Not Found, status=404).
No message available
Here is my Servlet :
@WebServlet("/catcher")
public class catchServlet extends HttpServlet
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");
System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);
PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);
And my HTML :
<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>
The values are going to the URL, but nothing is printed neither in the console nor the /catcher
page
I've tried with the post method but it doesnt change anything
java spring servlets
java spring servlets
asked Nov 11 at 14:33
loic.k
106
106
Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40
My form is at thehttp://localhost:8080/board
address and when i submit it goes herehttp://localhost:8080/catcher?cityName=London&countryCode=UK
with the error
– loic.k
Nov 11 at 14:44
That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48
I only have these infosInitializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
And i dont have web.xml file, is it necessary ?
– loic.k
Nov 11 at 15:06
Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07
|
show 1 more comment
Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40
My form is at thehttp://localhost:8080/board
address and when i submit it goes herehttp://localhost:8080/catcher?cityName=London&countryCode=UK
with the error
– loic.k
Nov 11 at 14:44
That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48
I only have these infosInitializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
And i dont have web.xml file, is it necessary ?
– loic.k
Nov 11 at 15:06
Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07
Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40
Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40
My form is at the
http://localhost:8080/board
address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK
with the error– loic.k
Nov 11 at 14:44
My form is at the
http://localhost:8080/board
address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK
with the error– loic.k
Nov 11 at 14:44
That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48
That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48
I only have these infos
Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
And i dont have web.xml file, is it necessary ?– loic.k
Nov 11 at 15:06
I only have these infos
Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
And i dont have web.xml file, is it necessary ?– loic.k
Nov 11 at 15:06
Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07
Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249735%2fhow-to-fix-the-no-message-available-error-when-using-servlets%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40
My form is at the
http://localhost:8080/board
address and when i submit it goes herehttp://localhost:8080/catcher?cityName=London&countryCode=UK
with the error– loic.k
Nov 11 at 14:44
That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48
I only have these infos
Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
And i dont have web.xml file, is it necessary ?– loic.k
Nov 11 at 15:06
Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07