Announcement Announcement Module
Collapse
No announcement yet.
Multipart Request and command class in annotation based configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multipart Request and command class in annotation based configuration

    I am new to Spring annotation based MVC.
    I am writing a web service using this framework.This web service needs to read HTML file type value(one that has Browse... button to upload a file from filesystem).

    I have put this code in applicationContext.xml -

    Code:
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    
        <!-- one of the properties available; the maximum file size in bytes -->
        <property name="maxUploadSize" value="100000"/>
    </bean>

    I am using @Controller annotation to define a controller .Now I need a command class whose attributes will be set with Request Parameters.So if any client side JSP tries to post a request to my web service ,the command object attributes get set.
    How do I define a command class in my controller class?If I use something like @ModelAttribute("clientCommand") ClientCommand - I will always get it as null.
    Once I am able to do this,I am hoping I will be able to get the contents of the file by doing something like clientCommand.getFile().
    Any ideas?

  • #2
    If I were you, I would use Spring Web Services to implement my web service. It's simple, fast, reliable - and it's REST. Just take a look at the Spring Web Services reference guide, and try to implement your solution. You are welcome to post any specific doubt or problem you should encounter in the appropriate web services section of the forum.

    Comment

    Working...
    X