The Kat's Work - Blog
Main | Blog | Registration | Login
Friday
2024-05-17
11:30 AM
Welcome Guest | RSS

I'm intending to implement a auto save function to a web application.

The application uses java struts with an MS SQL 2000 database.

I plan to use jquery to submit the form periodically, to be saved into a draft table(s) .

See planned workflow below.




Views: 1519 | Added by: The_Kat | Date: 2010-07-22 | Comments (0)


So here is a stupid little problem i have just fixed. Entirely because i stupidly left something out but there was no help online so i thought i post this to help anyone who does the same.

On a webpage with textareas i was trying to process the submission by looping through the parameter names. I found that that the text area names weren't present in the list.

Simple solution i had only provided an "id" not an "name" attribute. Once i provided a name it worked.

Views: 868 | Added by: The_Kat | Date: 2010-07-02 | Comments (0)



So I wanted to have a nice slick way for the user to attach files to a "form”. Investigating there are lots of plugins available but most provide support only for PHP and Ruby???? So I thought I’d go through the implementation for Java Spring.

 
First off download the plugin from the site. Unzip and add to your webcontent. As for most of my implementations I will be using jQuery, although you can use plain JavaScript.




Firstly lets look at implementing the code on the web page. Include the .js file, now make a button that will be pressed to upload files.



As you can see I’m doing the upload on a jQuery dialog. Now on pressing the upload button the user is presented with the standard file selection. When they choose a file, the file is posted to upload.html. As you can also see the file will be named "uploadFile” and the request will also include the id parameter.

 

From a technical point of view the ajaxUploader is creating an iframe that has an input with type file, it than submits this form to the server.

 
Now on the server side simply set up a standard controller function as below.



After that its pretty standard file processing code. As you can see in the case the upload fails I return false to the JavaScript on the page, by means of xml. The result is processed appropriately by the JavaScript.




edit you need to add the following bean to your application context

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- Max size in bytes. -->
        <property name="maxUploadSize" value="40000000"/>
    </bean>
Views: 5012 | Added by: The_Kat | Date: 2010-03-25 | Comments (0)

« 1 2 ... 8 9 10 11 12 13 »
Login form
Adverts
Search
Calendar
«  May 2024  »
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
262728293031
Entries archive
Site friends
  • Create your own site
  • Spree4.com
  • My Blog
  • Statistics

    Total online: 1
    Guests: 1
    Users: 0
    spree4
    Copyright MyCorp © 2024
    Website builderuCoz