You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anjib Mulepati <an...@hotmail.com> on 2010/11/29 18:13:21 UTC

Upload file content to text box using struts 1.3.8

Can anyone help me on getting file content (txt/CSV file) to be load in 
text area of web page?

I have textarea in webpage and want to load the content of the file to 
that textarea. I am using struts 1.3.8. I couldn't fig out how can mimic 
file input button.

Any hint will be appreciated.

Thanks
Anjib


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upload file content to text box using struts 1.3.8

Posted by Li Ying <li...@gmail.com>.
Another way is, using AJAX:

(1)Send a file upload post, (using AJAX), to your FileUploadAction

(2)FileUploadAction just read in the CSV file content, and return it
as HTTP Response

(3)On client side, AJAX can receive the Server response, then you can put it
to the textarea (using JQuery)

See:
http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upload file content to text box using struts 1.3.8

Posted by Li Ying <li...@gmail.com>.
Why do you need two forms?

Can't you put the FileUpload and the textarea in one form?

And in your Action, you can create 2 method, one handle the file upload,

and the other one handle the other request

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upload file content to text box using struts 1.3.8

Posted by Anjib <an...@hotmail.com>.
  This textarea itself is one of the component of the form. So how to 
put two forms in a single page?

On 11/29/2010 9:30 PM, Li Ying wrote:
> (1)Select file from a [file input]
> (2)Upload it to your Action (by a post)
> (3)In your action, read in the CSV data, and store into some
> property(let's say CSVDataProperty)
> (4)Show your page again, and set the default value of the textarea by
> CSVDataProperty
>
>
>
> 2010/11/30 Anjib Mulepati<an...@hotmail.com>:
>> Can anyone help me on getting file content (txt/CSV file) to be load in text
>> area of web page?
>>
>> I have textarea in webpage and want to load the content of the file to that
>> textarea. I am using struts 1.3.8. I couldn't fig out how can mimic file
>> input button.
>>
>> Any hint will be appreciated.
>>
>> Thanks
>> Anjib
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upload file content to text box using struts 1.3.8

Posted by Li Ying <li...@gmail.com>.
(1)Select file from a [file input]
(2)Upload it to your Action (by a post)
(3)In your action, read in the CSV data, and store into some
property(let's say CSVDataProperty)
(4)Show your page again, and set the default value of the textarea by
CSVDataProperty



2010/11/30 Anjib Mulepati <an...@hotmail.com>:
> Can anyone help me on getting file content (txt/CSV file) to be load in text
> area of web page?
>
> I have textarea in webpage and want to load the content of the file to that
> textarea. I am using struts 1.3.8. I couldn't fig out how can mimic file
> input button.
>
> Any hint will be appreciated.
>
> Thanks
> Anjib
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org