Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Ajax passing file parameter through ajax

Have Programming Question? Ask it here!
 
 
 


harita
passing file parameter through ajax
3 Answer(s)      6 years and a month ago
Posted in : Ajax



Advertisement
View Answers

August 7, 2008 at 5:19 PM


Hi friend,

file1.jsp



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> passing file using jsp and ajax </TITLE>

<script>


function fileParam(){



xmlHttp=GetXmlHttpObject()

if (xmlHttp==null) {

alert ("Browser does not support HTTP Request")

return

}



var filename= document.form.filename.value;



var url="http://localhost:8080/file2.jsp";;

url=url+"?filename="+filename;

xmlHttp.onreadystatechange=stateChanged

xmlHttp.open("GET",url,true)

xmlHttp.send(null)



}

function stateChanged() {



if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {



var showdata = xmlHttp.responseText;

alert(showdata);

}

}



function GetXmlHttpObject()

{

var xmlHttp=null;

try

{

// Firefox, Opera 8.0+, Safari

xmlHttp=new XMLHttpRequest();

}

catch (e)

{

//Internet Explorer

try

{

xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

}

catch (e)

{

xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

}

}

return xmlHttp;

}


</script>

</HEAD>


<BODY>

<br><br>

<center>

<table bgcolor="#efefef">

<tr><td colspan=3 align="center"><b></b></td></tr>

<tr><td colspan=3 align="center"><b>&nbsp;</b></td></tr>

<tr>

<td>


<form name="form">

<fieldset style="width:250px;">


<legend><b>#Form</b></legend>

<table width="250px" border=0 align="center">



<tr><td>File</td><td><input type="file" name="filename"></td></tr>



<tr>

<td colspan=2 align="center">

<input type="button" name="button" value="Button" onclick="fileParam();">

</td>

</tr>


</table>

</fieldset>

</form>


</td>


</tr>

</table>

</center>

</BODY>

</HTML>


August 7, 2008 at 5:21 PM


file2.jsp


<%

String filename = request.getParameter("filename");

out.println(filename);

System.out.println("filename" + filename);

%>

-------------------------------------------------------------------

Read for more information.


http;//www.roseindia.net/jsp/


Thanks.


August 7, 2008 at 6:41 PM


Hi, thanks for sending solution for this.

U have send the code for the server side, in which only file name we are getting.
but how can i download the file by using struts.upload.FormFile.



Related Tutorials/Questions & Answers:
passing file parameter through ajax - Ajax
passing file parameter through ajax  I have file parameter in jsp file, i need to pass it to server side through ajax. how i can i do that.   Hi friend, file1.jsp passing file using jsp
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
Advertisements
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
Java parameter passing
Java parameter passing  What type of parameter passing does Java support
Passing Parameter - JSP-Servlet
Passing Parameter  I would like to ask how to pass a parameter from javascript section into the jsp section.It will be something like...; answer<%; <---I'm stuck here passing the var
Passing Parameter - JSP-Servlet
Passing Parameter  Hi, it'me again. Below is the set of code that I get from your solution entitled droplist that read from database. It do read from..., there's var answer. I need to pass this parameter back into the jsp part, how should i do
Passing a parameter using URL string
Passing a parameter using URL string  How to pass a parameter using the URL string in a JSF application
passing parameter from Java code to CSS file - Design concepts & design patterns
passing parameter from Java code to CSS file  hi, i have to pass a string variable from by java code to a CSS file so that i can use that variable in my CSS file. Plz help me as soon as possible
passing parameter from html to applet
passing parameter from html to applet  how to pass the following from HTML to applet in Java code - font size,font style,font size?give me suitable code
passing values between jsp file through hyperlink in div tag
passing values between jsp file through hyperlink in div tag  <p>hi please help me to solve this. i have searchproj.jsp and updateproj.jsp. In searchproj.jsp values r retrieved from db as follows </p> <pre class
Applet - Passing Parameter in Java Applet
Applet - Passing Parameter in Java Applet   ... and passing parameter in applet, a example is given below. In this example, we... case applet should display "Welcome in Passing parameter in java applet
JSP parameter passing throught out web app
JSP parameter passing throught out web app  i want to pass one param from page1.jsp page to page4.jsp page but in between this i need to navigate page3.jsp and page2.jsp.Please help me to understand how could i transfer param
Passing Parameter Values to another jsp in Query Strings
Passing Parameter Values to another jsp in Query Strings  HI ALL, I m trying to pass a variable value to another JSP using query string... response.sendRedirect("http://localhost:8080/SWIFT/index.jsp?loginid='"+loginid
JSP:Passing query as parameter - Java Beginners
JSP:Passing query as parameter  Hi Friends, I have a real tough..."; String qry3="select age from table13"; string q=Insert into emp values(?,?,?); int update=prep.executeUpdate(q); prep.setString(1,qry1); prep.setString
JSP:Passing query as parameter - Java Beginners
JSP:Passing query as parameter  Hi Friends, I have a real tough..."; String qry3="select age from table13"; string q=Insert into emp values(?,?,?); int update=prep.executeUpdate(q); prep.setString(1,qry1); prep.setString
Passing parameter over Form to BackingBean - Java Server Faces Questions
Passing parameter over Form to BackingBean  Dear User, i have problems concerning passing parametes from form to my backing bean. I have... here, my Bean Code. This is the form
Parameter passing from jsp page to jsp page - JSP-Servlet
Parameter passing from jsp page to jsp page  Hi I intends to pass the parameters that I received from previous page through query String. I get all parameter in respective string variables. I have to passed the parameters
pass parameter - file - Java Beginners
pass parameter - file  Hi, I want to pass paramter file to method... immediately. file.jsp ========== File Parameter Use Please Select the file 2. Display.java
Passing Parameter with <jsp: include>
Passing Parameter with <jsp: include>     ... a file in a jsp page. While using <jsp:param> we are adding the file at run time. The code of the program is given below
Main function parameter in C language - Ajax
Main function parameter in C language  Please let me know how... line arguement.Also how is fgetpos() and fsetpos() used in file operation .... The fgetpos function gets the current value of the stream argument?s file
Ajax File Upload Example
Ajax File Upload Example       This application illustrates how to upload a file using servlet through the Ajax technology. In this example you simply create a file
java file with many methods - Ajax
java file with many methods  I have to send response to a java file where there are many methods and I have to call one of them by passing parameter .How can I do
How to access session values through Ajax?
How to access session values through Ajax?  Suppose in a servlet a variable userName is kept in session. How can I access this variable from JSP through AJAX? Is it possible
run a batch file through javascript
run a batch file through javascript   How to run a batch file through javascript without prompting
Locale Specific Date validations through JavaScript/Ajax...
Locale Specific Date validations through JavaScript/Ajax...  Hi, I....), how to manipulate date validations through JavaScript or Ajax? Thanks... in JSP file. For example You if your validation function is like
Passing Multi select list box values using ajax to get values to dependent list box
Passing Multi select list box values using ajax to get values to dependent list box  Hi, I have a jsp page which has 3 dependent list boxes with multiple selection. How can i pass multiple selected values through ajax to retrieve
How to pass parameter through drop down list using session management in jsp??
How to pass parameter through drop down list using session management in jsp??  How to pass parameter through drop down list in the URL and access it on same jsp page using session management
AJAX file upload
AJAX file upload If you want to upload file asynchronously means without... files. URL for Code http://www.webtoolkit.info/ajax-file-upload.html Demo URL http://www.webtoolkit.info/demo/ajax-file-upload Description
File uploading - Ajax
File uploading  hi friends, how to uploading the file by using "AJAX".Please send the complete source code for this application   where u want to store the file Can u specify
Ajax file upload
Ajax file upload  I am developing a application for image upload using ajax and servlet. The image should be converted in byte[] and must be saved in oracle databse as blob. After uploading the image it should be displayed
Passing values in ComboBox from XML file
Passing values in ComboBox from XML file In this tutorial we are going... from an XML document. For this what we need  a XML file in which we have... the data from the XML file and insert it into the ComboBox. To make a program over
Getting Parameter from a css styled jsp file to a java servlet file...
Getting Parameter from a css styled jsp file to a java servlet file... ... is it not getting the parameter??? How do i accept the value in the servlet file...; java servlet file-- /* * To change this template, choose Tools
Need Help-How to store input parameter in DB through Java Bean - JSP-Servlet
Need Help-How to store input parameter in DB through Java Bean  Hello Sir, I have a simple Issue but It is not resolve by me i.e input parameter are not store in Ms-Access. I store the input parameter through Standard Action
reading and displaying svg file through java
reading and displaying svg file through java  sample program for reading a svg file
File copy through intranet - Java Beginners
File copy through intranet  Can i copy files from system A to System B connected through intranet?? Is this possible through java IO? If yes, please let me know
Ajax form element - Ajax
Ajax form element  I have problem in passing a value into form feild using ajax. I want to get the value is as a parameter. Can some one help me plz
iterate through map and write the content in a separate file
iterate through map and write the content in a separate file  I am trying to save the data from file to a map, then iterate through map and write... through the above file and save it in maps depending on if it is a concept
iterate through map and write the content in a separate file
iterate through map and write the content in a separate file  I am trying to save the data from file to a map, then iterate through map and write... through the above file and save it in maps depending on if it is a concept
iterate through map and write the content in a separate file
iterate through map and write the content in a separate file  I am trying to save the data from file to a map, then iterate through map and write... through the above file and save it in maps depending on if it is a concept
Large File reading through Axis2 Web service
Large File reading through Axis2 Web service  This is Vinay Rai. This is regarding the web service help which i am looking for. I am currently working on axis2 web service and i am very new to this. so need your help
How can I paginate a table which has shown in a div through Ajax in client side without using database
How can I paginate a table which has shown in a div through Ajax in client side without using database   The table is shown by calculation in a PHP script file so The data not store any where so please give me the way to paginate
Drag and drop file uploading - Ajax
Drag and drop file uploading  Hi all, This is NageswaraRao i want file uploading feature on my web development..using drag and drop mouse functionality. Problem:I have Created one Text area when i drop the file on text area
downloading file through a file's path stored in database in jsp
downloading file through a file's path stored in database in jsp  hi want to download a file from a directory where the file location is stored... table,but i dont know hoe to download the file using its path stored
how to use ajax in html file
how to use ajax in html file  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <
Access Excel file through JDBC
Access Excel file through JDBC In this section, you will learn how to access excel file through Jdbc and display records in JTable. As you know Excel comes... and the excel file. Here the name of the worksheet is equivalent to any database
Passing a 2 Dimentional Array From one Jsp to Another Jsp file and Retreving it
Passing a 2 Dimentional Array From one Jsp to Another Jsp file and Retreving... are dynamically stored into it in one jsp file .I passed this array into another Jsp File and when i tried to retrieve the data in the 2 Dimensional array
Passing Parameters - JSP-Servlet
Passing Parameters  Hi I have to pass parameter like... First Name /**SECOND PAGER upto this page I passed the parameter through query string **/ Name /** I have to redirect all received params through
To call jrxml/jasper file through jsp code in netbean
To call jrxml/jasper file through jsp code in netbean  I am making... Through plugin ,ireport is integrated with neatbean and I also created one report. So my question is I want to call that jasper file through my jsp code and i also
Advertisements
 

 

 

DMCA.com