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

Help, Are you real? I dont want to get help from a computer

Are you real? I dont want to get help from a computer

Convert string to super ascii, A string S is said to be "Super ASCII", if i...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''a''''-''''z'''') and

Create an applet for grid layout, Take the Student Choice GUI you created i...

Take the Student Choice GUI you created in Assignment and convert it to an applet.  Because standalone GUI applications and applets are so similar, a lot of the code should be reus

Convert US Dollars to Canadian Dollars, How to write a program that convert...

How to write a program that converts US dollars into Canadian dollars.The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars whe

Discuss features of java, Question 1 Discuss features of JAVA Question...

Question 1 Discuss features of JAVA Question 2 What are primitive data types? Discuss Question 3 Explain data conversion function ValueOf ()? Question 4 What are th

What is constructor, What is Constructor? A constructor is used to init...

What is Constructor? A constructor is used to initialize a newly created object. It's called just after memory is allocated for the object. It can be used to initial

Write short notes on (i) rmi and (ii) corba, Question 1 Write a program in...

Question 1 Write a program in Java to find the highest of any five numbers. How do you compile and execute this Java program? Question 2 Write a program to explain the Except

Posting on a wall, Viewing a User's Wall Where your project allows you t...

Viewing a User's Wall Where your project allows you to view a user's profile, your ZHTML must provide the following capabilities: 1. Provide a Wall for that user profile, dis

Zhtml requirements, In addition to your Java code requirements, you also ne...

In addition to your Java code requirements, you also need to enhance the ZHTML for your application. As before, you can continue working with the page(s) you used for the previous

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