Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a recipe database (Step 2: Creating webservices to access the database)  RSS feed

 
Shakur Burton
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Tomcat 8, I am creating a new web application called 'recipewebapp', while aiming to create the appropriate data structure 'recipewebapp'...
Using this web.xml file, this is what I have so far...



This is what this web.xml file corresponds with, according to what I have created in Tomcat 8 so far on my virtual machine:
C:\progs\tomcat8\webapps\recipewebapps\WEB-INF\classes\com\cs330\meals

I have created this web.xml file to access these three web services, which are accessible from the following URLs:

To retrieve all recipes (aka all values in my MySQL 'recipe' database).
http://localhost:8080/recipewebapp/reciperesources/rp1/recipes

To retrieve recipes by id (aka all values in my MySQL 'recipe' database by a specific given ID).
http://localhost:8080/recipewebapp/reciperesources/rp1/recipes/2

To retrieve recipes by numOfServings (greater than or equal to the parameter) (aka all values in MySQL 'recipe' database by a specfic variable called 'NumOfServings').
http://localhost:8080/recipewebapp/reciperesources/rp1/recipes/recipe?serving s=6

This is the MySQL database code in which the web.xml is associated with:


All of this seems right so far - however, now I have to create some java code to associate with both the web.xml code and the MySQL code alongside it, which looks like this so far... With my aim being to match what goes alongside the MySQL database code.



Unlike before, I have made some effort to re - type this code a little and make it match what's require of it in MySQL. If there are any suggestions on how I can tweak or improve this code, it would be greatly appreciated.
Thank You.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please edit your code to have proper indentation -- large blocks of unindented code are just too hard to read.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!