Sending Java Beans From An Applet to A Servlet
I'm looking at sending a complex data type [a serialized java bean (strings, map, and an image)] from an applet to a Spring structured web application.
How would I send the bean? I'm assuming that I would create a URLConnection
, and then send out a post with a serialized version of 开发者_如何学运维the bean.
How would I set up spring to catch this on the Server side? [Would I use a @RequestParam
or @ModelAttribute
]
Both the applet and the server have access to the model.
It depends on how you serialize it. If it is JSON, you can use @RequestBody
, if it is binary (base64 string), it should be @RequestParam
, and then you should deserialize it.
精彩评论