• Post Reply Bookmark Topic Watch Topic
  • New Topic

REST Servlets and data from a form  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1054
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a web service with a button and some checkboxes, the user tick a checkbos and the option is send to the controller like in Servlets but I am not using MVC but REST.

The controller should get the data from the form. I am confused

Any idea, please?


Regards, Isaac
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You appear to be seriously confused about MVC and REST - these are not incompatible.

REST is an architectural style related to the way HTTP methods (GET, POST, DELETE, etc) are used in relation to resources exposed by a web service.

MVC - Model View Controller - architecture refers to the organization of components within the web service - there is an elegant relationship between MVC and REST.

Model - clearly the resource you are exposing has a data model.
View - one of the cool things about REST is that it makes it easy to think about different views of a resource - you might have a plain text view, a graphic view, an audio stream view, etc etc etc
Controller - a REST front end decides which Model and View to use based on the information in the request.

Bill
 
Isaac Ferguson
Ranch Hand
Posts: 1054
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this code in a test package:



the WEB-INF folder contains web.xml



When I type in the browser:



I get this error:


The name of the app is leanRouteWS and the name of the WS is WebService.

In the example I got from the internet it was like this:





Any idea, please?

 
Isaac Ferguson
Ranch Hand
Posts: 1054
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried some variations but definitely there is something I am missing. Any idea, please?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
404 means the servlet container can not find the servlet.

At this point we usually ask for your complete directory layout for this application.

Bill
 
Isaac Ferguson
Ranch Hand
Posts: 1054
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok maybe a link to Git could help? leanRouteWS

Any idea, please?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
404 means the servlet container can not find the servlet.


The most likely reasons - either:
1. the servlet container does not recognize your directory as containing a web application
2. the servlet container can not find a servlet corresponding to your web.xml and url addressing.

If this was my problem I would first see if the server could find a plain HTML page in your web application directory.

Note that your Java code has nothing to do with your 404 error, something is wrong elsewhere.

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