Spring MVC Controllers, JAVA Programming

Assignment Help:
I want to upload an item object with it''s image is it possible that i pass a complete object of my Item along with it''s image from my Controller if yes then how may i Do it? and I need a Json Pattern also which will be coming from client side.

What would be the Json pattern for my following Item Object.

Class Item{

String ItemID;
String ItemName;
String CategoryID;
List imagesList;

}

Class Image{

String imageId;
String imageTitle;
byte[] image;
}



and one more thing. Please tell me how can I pass two parameters in my Controller. e.g. if I want to pass Item object in the Request Body along with an extra parameter say String UserID. HOw may I write the following code.

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public void add(@RequestBody Item myItem, String UserID)

{ ...... }

and please tell me what if I pass in the Request in Json format. What will be it looks like?

{ "Item" : { "ItemID": "1", ......}, "UserID" : "hello"}

will it be like this or what? because i tried it i''m getting the Object and string as Null. I also tried it with @RequestParam but same got NULL while debugging.

Currently i''m dealing with this by this.

Class ItemUserPost{
Item item;
String UserID;
}



I''m storing this object in MongoDB. Will be my whole collection of Item will stored along with the images? or i have to use a MultiPart and GridFS API for this. Kindly please refer if related question already posted.

Please Help Urgent.

Thanks in Advance.

Related Discussions:- Spring MVC Controllers

Find Largest, My java asignment is the following. Sorry if this is a repeat...

My java asignment is the following. Sorry if this is a repeat send. My email is Finding the largest object Write a method that returns the largest objects in an array of objects.

Explain role java.rmi.naming class, The Naming class gives methods for stor...

The Naming class gives methods for storing and obtaining references to remote objects in the remote object registry.

Bilbo board , Design and simulate the bilbo board which should include thre...

Design and simulate the bilbo board which should include three configurable bilbos and some application logic to verify tester operation. the system will be designed using proteus

Arrays, 1. Arrays and working with arrays

1. Arrays and working with arrays

Program that instantiates a number of actors and writers, Talent agencies l...

Talent agencies like ICM, CAA and Paradigm represent writers, directors and actors (among other talent).  These agencies take in hundreds of millions of dollars a year collecting 1

Create modeling tickets for a city subway system, For this assignment you'l...

For this assignment you'll create some classes for modeling tickets for a city subway system. The type of system we are modeling has these main features: Stations are grouped in

Multiple choices output and codes, codes and output on how to make multiple...

codes and output on how to make multiple choices quiz

Recursive Division Maze Generation, can you tell me what the code for a 2d ...

can you tell me what the code for a 2d random java array using Recursive Division Maze Generation

Write Your Message!

Captcha
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