Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35

Thread: How to create a file upload browser in spring roo?

  1. #21
    Join Date
    Oct 2010
    Location
    Almere, The Netherlands
    Posts
    32

    Default

    Quote Originally Posted by lukeb View Post
    Furthermore, normally after saving a record roo redirects to a page that show the record just stored.
    In case of the upload form roo return to the form (but the file has been uploaded).
    LuKe
    You might be running into an exception which is not being displayed. That would explain why you go back to the form and don't see the correct results in the database. You could set a breakpoint in the BigController_Roo_Controller.aj create method to see what's happening.

    BTW, if you only want to move the uploaded file to a different location you can use the transferTo method of CommonsMultipartFile.

  2. #22

    Default

    I've tried to debug on the BigController_Roo_Controller.aj create method but everything seams to run well.

    Here are the debug info:


    Code:
    2010-11-16 11:03:23,194 [http-8080-6] DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - Using EntityManagerFactory 'entityManagerFactory' for OpenEntityManagerInViewFilter
    2010-11-16 11:03:23,211 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'entityManagerFactory'
    2010-11-16 11:03:23,211 [http-8080-6] DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - Opening JPA EntityManager in OpenEntityManagerInViewFilter
    2010-11-16 11:03:23,211 [http-8080-6] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 12899018032
    2010-11-16 11:03:23,223 [http-8080-6] DEBUG org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'testUpload02' processing POST request for [/testUpload02/bigs]
    2010-11-16 11:03:23,279 [http-8080-6] DEBUG org.springframework.web.multipart.commons.CommonsMultipartResolver - Found multipart file [file] of size 56699 bytes with original filename [locandinaISmall.jpg], stored at [/home/luke/Documents/workspace-sts-2.5.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/testUpload02/upload__58fe5fca_12c5422792a__8000_00000010.tmp]
    2010-11-16 11:03:23,302 [http-8080-6] DEBUG org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapping [/bigs] to HandlerExecutionChain with handler [com.eidosoft.testupload02.web.BigController@34a083f2] and 4 interceptors
    2010-11-16 11:03:23,320 [http-8080-6] DEBUG org.springframework.beans.factory.annotation.InjectionMetadata - Processing injected method of bean 'com.eidosoft.testupload02.domain.Big': PersistenceElement for transient javax.persistence.EntityManager com.eidosoft.testupload02.domain.Big.entityManager
    2010-11-16 11:03:23,320 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'entityManagerFactory'
    2010-11-16 11:03:23,323 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'c' of java.lang.String to @javax.validation.constraints.NotNull @javax.validation.constraints.Size java.lang.String
    2010-11-16 11:03:23,323 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'c'
    2010-11-16 11:03:23,347 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value '' of java.lang.String to java.lang.String
    2010-11-16 11:03:23,347 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to ''
    2010-11-16 11:03:23,348 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'n' of java.lang.String to @javax.validation.constraints.NotNull @javax.validation.constraints.Size java.lang.String
    2010-11-16 11:03:23,348 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'n'
    2010-11-16 11:03:23,348 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value '' of java.lang.String to long
    2010-11-16 11:03:23,348 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to [null]
    2010-11-16 11:03:23,349 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value org.springframework.web.multipart.commons.CommonsMultipartFile@6a74f160 of org.springframework.web.multipart.commons.CommonsMultipartFile to @javax.persistence.Transient org.springframework.web.multipart.commons.CommonsMultipartFile
    2010-11-16 11:03:23,350 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to org.springframework.web.multipart.commons.CommonsMultipartFile@6a74f160
    fileName: locandinaISmall.jpg
    size: 56699
     hehe  this.fileName: locandinaISmall.jpg ,  org.springframework.web.multipart.commons.CommonsMultipartFile
    try 01
    try end
    2010-11-16 11:03:23,492 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.hibernate.validator.constraints.impl.NotNullValidator'
    2010-11-16 11:03:23,492 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.hibernate.validator.constraints.impl.NotNullValidator'
    2010-11-16 11:03:23,492 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.hibernate.validator.constraints.impl.SizeValidatorForString'
    2010-11-16 11:03:23,492 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.hibernate.validator.constraints.impl.SizeValidatorForString'
    2010-11-16 11:03:23,493 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.hibernate.validator.constraints.impl.NotNullValidator'
    2010-11-16 11:03:23,493 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.hibernate.validator.constraints.impl.NotNullValidator'
    2010-11-16 11:03:23,493 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.hibernate.validator.constraints.impl.SizeValidatorForString'
    2010-11-16 11:03:23,493 [http-8080-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.hibernate.validator.constraints.impl.SizeValidatorForString'
    2010-11-16 11:03:23,493 [http-8080-6] DEBUG org.springframework.web.bind.annotation.support.HandlerMethodInvoker - Invoking request handler method: public java.lang.String com.eidosoft.testupload02.web.BigController.create(com.eidosoft.testupload02.domain.Big,org.springframework.validation.BindingResult,org.springframework.ui.Model,javax.servlet.http.HttpServletRequest)
    2010-11-16 11:03:23,493 [http-8080-6] DEBUG org.springframework.web.servlet.DispatcherServlet - Rendering view [org.springframework.web.servlet.view.tiles2.TilesView: name 'bigs/create'; URL [bigs/create]] in DispatcherServlet with name 'testUpload02'
    2010-11-16 11:03:23,494 [http-8080-6] DEBUG org.springframework.web.servlet.view.tiles2.TilesView - Added model object 'big' of type [com.eidosoft.testupload02.domain.Big] to request in view with name 'bigs/create'
    2010-11-16 11:03:23,494 [http-8080-6] DEBUG org.springframework.web.servlet.view.tiles2.TilesView - Added model object 'org.springframework.validation.BindingResult.big' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view with name 'bigs/create'
    2010-11-16 11:03:23,494 [http-8080-6] DEBUG org.apache.tiles.impl.BasicTilesContainer - Render request recieved for definition 'bigs/create'
    2010-11-16 11:03:23,615 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'c' of @javax.validation.constraints.NotNull @javax.validation.constraints.Size java.lang.String to java.lang.String
    2010-11-16 11:03:23,615 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'c'
    2010-11-16 11:03:23,616 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'c' of @javax.validation.constraints.NotNull @javax.validation.constraints.Size java.lang.String to java.lang.String
    2010-11-16 11:03:23,616 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'c'
    2010-11-16 11:03:23,631 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'n' of @javax.validation.constraints.NotNull @javax.validation.constraints.Size java.lang.String to java.lang.String
    2010-11-16 11:03:23,631 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'n'
    2010-11-16 11:03:23,632 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'n' of @javax.validation.constraints.NotNull @javax.validation.constraints.Size java.lang.String to java.lang.String
    2010-11-16 11:03:23,632 [http-8080-6] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'n'
    2010-11-16 11:03:23,659 [http-8080-6] DEBUG org.springframework.web.multipart.commons.CommonsMultipartResolver - Cleaning up multipart file [file] with original filename [locandinaISmall.jpg], stored at [/home/luke/Documents/workspace-sts-2.5.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/testUpload02/upload__58fe5fca_12c5422792a__8000_00000010.tmp]
    2010-11-16 11:03:23,660 [http-8080-6] DEBUG org.springframework.web.servlet.DispatcherServlet - Successfully completed request
    2010-11-16 11:03:23,660 [http-8080-6] DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - Closing JPA EntityManager in OpenEntityManagerInViewFilter
    2010-11-16 11:03:23,660 [http-8080-6] DEBUG org.springframework.orm.jpa.EntityManagerFactoryUtils - Closing JPA EntityManager

  3. #23

    Default And when updating?

    Does anyone has been able to apply this to the <form:update>?

    As soon as I add the enctype="multipart/form-data" to the form:update, as I did successfully to form:create, I get a persistence error:

    org.hibernate.PersistentObjectException: detached entity passed to persist: valizatools.com.server.domain.Artist; nested exception is javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: valizatools.com.server.domain.Artist

  4. #24
    Join Date
    Jun 2010
    Posts
    440

    Default

    G uys,
    Dont miss 2nd part on fileupload article series...this complementary to the one referred injira 442. It will address very large blob.

    B. Roogards
    jD

  5. #25

    Default

    I can't wait!

  6. #26
    Join Date
    Oct 2011
    Posts
    1

    Default How to upload excel data to database in STS?

    I really don't know how to do it.

  7. #27
    Join Date
    Dec 2011
    Posts
    6

    Default

    Maybe you should give a look to this video:
    http://www.youtube.com/watch?v=0cZCgrskkaQ

    I don't know if it could help you, but it could be a start.
    Bye

  8. #28
    Join Date
    Jun 2010
    Posts
    440

    Default

    @adam37

    Oh no, you got the buggy one...
    I wished you would have used the latest version of my tutorial for your video. The one without the nasty exception.

    Too bad
    jD

  9. #29
    Join Date
    Dec 2011
    Posts
    6

    Default

    :S...
    Could you be more precise?
    Where can I find the second version of your tutorial?
    Thank you very much for the tutorial!!!

  10. #30
    Join Date
    Jun 2010
    Posts
    440

    Default

    (:S...)++

    Tell you what... Put an attribution notice -given credit to the tutorial's author; which I truly believe is the correct way to proceed anyway- to the video and I let you access to 2nd version.

    As a matter of fact, I have a business proposition for you since -with exception of the music- I think you did a great job creating a video of my tutorial.

    We can join efforts for serving better the SR community; I have many-many of those tutorials -that you can turn into videos- which the SR community has shown great interest on them.

    What you think?

    B. Roogards
    jD @ http://pragmatikroo.blogspot.com
    Last edited by delgad9; Apr 22nd, 2012 at 02:07 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •