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

Develop a school java project, Develop a School java project Project Des...

Develop a School java project Project Description: Programming java, threads. Not so hard but requires knowledgeSkills required: Java

Explain the rules for tostring() methods, Explain the Rules for toString() ...

Explain the Rules for toString() Methods ? toString() methods should return a single line of text that does not contain any carriage returns or linefeeds. toString() methods

How can we include images in a web page using html and java, How can we inc...

How can we include images in a web page using HTML and Java script?2011 Images in HTML It is quite straight forward to include gif and jpg images in an HTML webpage using the

Give an example of class or static members, Give an example of Class or sta...

Give an example of Class or static Members? Below is a Car class along with such a speedLimit field and getSpeedLimit() method. public class Car { private String licensePla

What is lookupdispatchaction, The LookupDispatchAction is a subclass of Dis...

The LookupDispatchAction is a subclass of DispatchAction. It does a reverse lookup on the resource package to get the key and then gets the method whose name is associated with the

2D arrays, write an application that stores at least five different departm...

write an application that stores at least five different department and supervisor names in a two dimensional array

Need java, Need JAVA,SPRING,JSF(primefaces) Application Support Project ...

Need JAVA,SPRING,JSF(primefaces) Application Support Project Description: We want someone to be part of our team's new development, it's minute application but in future, cha

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