org.springframework.samples.petportal.portlet
Class PetDescriptionUploadController

java.lang.Object
  extended by org.springframework.samples.petportal.portlet.PetDescriptionUploadController

@Controller
@RequestMapping(value="VIEW")
public class PetDescriptionUploadController
extends java.lang.Object

This Controller demonstrates multipart file uploads. In this case, an uploaded text file will be used as the description for a Pet.

Author:
John A. Lewis, Mark Fisher, Juergen Hoeller

Constructor Summary
PetDescriptionUploadController()
           
 
Method Summary
 java.util.SortedSet getPets()
           
 void processUpload(PetDescription upload, int petKey)
          On submit, set the description property for the selected Pet as a String.
 void registerMultipartEditor(org.springframework.web.bind.WebDataBinder binder)
          Register the PropertyEditor for converting from a MultipartFile to an array of bytes.
 void setPetService(PetService petService)
           
 java.lang.String showUploadForm()
          If there are no Pets, display the 'noPetsForUpload' view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PetDescriptionUploadController

public PetDescriptionUploadController()
Method Detail

setPetService

public void setPetService(PetService petService)

getPets

@ModelAttribute(value="pets")
public java.util.SortedSet getPets()

registerMultipartEditor

@InitBinder
public void registerMultipartEditor(org.springframework.web.bind.WebDataBinder binder)
Register the PropertyEditor for converting from a MultipartFile to an array of bytes.


showUploadForm

@RequestMapping
public java.lang.String showUploadForm()
If there are no Pets, display the 'noPetsForUpload' view. Otherwise show the upload form.


processUpload

@RequestMapping
public void processUpload(PetDescription upload,
                                         @RequestParam(value="selectedPet")
                                         int petKey)
On submit, set the description property for the selected Pet as a String.



John A. Lewis, Mark Fisher, Juergen Hoeller - 2007.