Create a new json view

Assignment Help JAVA Programming
Reference no: EM13313163

Server Info

The server for this assignment is the following:

course-server.exdsyslab.net

Each of you has an account on that server.  You should be able to SSH to the server.    

Please let me know ASAP if you have problems logging into the server.

Deployment

In your home directory, there is a directory named "webapps".   Create a directory named "cset4100(hw4" inside the webapps directory.   You may want to copy your code from hw3 into the hw4 directory.

Requirements

You will be extending the application from the last assignment to support a web service API for the "Products" of a web application that serves JSON to "3rd party software/applications".  

You will need to provide JSON support for both the main product "index" page as well as the individual "product detail" page.

The benefits of the ModelRViewRController paradigm should become readily obvious in this assignment.  Specifically, you should only need to

1) create a new JSON "view" (e.g., a JSP page that only displays the JSON representation of the data)

2) Add code to your controller to check which view to display.  For this assignment, there will be a URL parameter named "format".  When the value of the "format" parameter is "json" display the JSON view, otherwise display the regular HTML JSP view.

The sample servlet code I provided for the last assignment already has some sample code to get you started.  You only need to provide a JSP "View" page for the JSON format.

In your JSP, to get access to JSON data add the following.  The first line does the import, and the second line creates a Google JSON converter object that you can use to convert Java

Objects into JSON representations < @ page import="com.google.gson.*"  >

< Gson gson = new GsonBuilder().setPrettyPrinting().create();  >

Example.  If I have an object named "fooObject", then the following JSP code will convert the fooObject to a JSON string representation

< = gson.toJson(fooObject)  >

Reference no: EM13313163

Questions Cloud

Determine the maximum shearing stress in shaft ab : A torque of magnitude T = 1000Nm is applied at D as shown. Knowing that the diameter of shaft AB is 56 mm and that the diameter of shaft CD is 42 mm, determine the maximum shearing stress in (a) shaft AB, (b) shaft CD.
What is the total flux across the coil : A long straight ideal solenoid of radius 6 cm, with 150 turns/m passes (on axis) through the center of a flat circular coil, What is the total flux across the coil, as a function of time
Convert the azimuths from north to bearings : convert the azimuths from north to bearings, and compute the angles, smaller than 180 degrees between successive azimuths 68o06'42", 133o15'56", 217o44'05", 320o35'18"
What is the average force the boys hand feel : A boy catches - with bare hands and his arm extended - a 0.16 kg baseball coming directly toward him ar a speed of 25 m/s. what is the average force the boy's hand feel while catching the ball
Create a new json view : Add code to your controller to check which view to display.  For this assignment, there will be a URL parameter named "format".  When the value of the "format" parameter is "json" display the JSON view, otherwise display the regular HTML JSP view.
The heat capacity of the calorimeter itself was 883 j/k : The heat capacity of the calorimeter itself was 883 J/K and it contained 830.1 g of water (c = 4.184 J/g.K). If the temperature increased by 13.2°C, what is ?E (in kJ) for the combustion of 1 mole of sucrose? Enter your answer in exponential form,..
Access the tax table to use : Ray and Maria Gomez have been married 3 years. They live at 1610 Quince Ave., McAllen, TX 78701. Ray works for Palm Oil Corporation and Maria works for the City of McAllen. Maria's Social Security number is 444-65-9912 and Ray's is 469-21-5523..
What is the average force exerted by the ground on the ball : A 0.140-kg baseball is dropped from rest. It has a speed of 1.20 m/s just before it hits the ground. what is the average force exerted by the ground on the ball
What is the impulse received by the soccer ball : A soccer ball with mass 0.285kg is initially at rest and is kicked at an angle of 22.8 (degrees) with respect to the horizontal. What is the impulse received by the soccer ball during the kick

Reviews

Write a Review

JAVA Programming Questions & Answers

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Inheritancedemo

Create a New Project named InheritanceDemo . 2. Create a new class called Person and cut and paste the Person.java file from Blackboard into the class. Create a new class called Student and cut and paste the Student.java file from Blackboard into the..

  Write function in javascript to compute person-s gross pay

Write the function using JavaScript syntax to compute a person's gross pay for a week. The function should receive the number of hours worked and the rate of pay per hour.

  Create an array that stores in integers from the keyboard

create an array that stores in integers from the keyboard and then I can scan that array to check numbers in order, if the number I check is greater than the previous then I will set the next number in the array to the higher value.

  Java problem - g queue

A queue is an ordered collection of items in which the removal of items is restricted to the FIFO ( rst in rst out) principle.

  Achieving simplicity and merely being simplistic

What is the difference between achieving simplicity and merely being simplistic?

  What value would be returned from call to its size() method

If a collection stores 5 objects, what value would be returned from a call to its size() method?

  Write a java program to implement the finite field

Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".

  Develop a graphical user interface based java program

Develop a Java program that can communicate with a real SMTP email server for sending emails. TNE 60003 - introduction to network programming, You program should provide a GUI and can successfully send the SMTP commands to the mail server

  The ai player will not be asking

The AI player will not be asking the user for any input. This means that placeShips() and fire() should not ask the user for locations. The AI player should choose locations of ships and automatically place them

  What is server-side and client-side scripting?

1. What is Server-side and Client-side scripting? Explain the differences between server-side and client - side scripting languages. Please provide 3 advantages and disadvantages of each. Please provide applicable references in APA style

  Write a method called hash midpoint

Write a method called hasMidpoint that accepts three integers as parameters and returns 'true' if one of the integers is the midpoint between the other two integers; that is to is if one integer is exactly between the two others. The method should re..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd