• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

REST Servlets and data from a form

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic