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> </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>
Related Tutorials/Questions & Answers:
passing file parameter through ajax - Ajaxpassing 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
Advertisements
Passing Parameter - JSP-ServletPassing 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-ServletPassing 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 parameter from html to appletpassing 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
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... as
parameter. In our case applet should display "Welcome
in
Passing parameter JSP parameter passing throught out web appJSP
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
JSP:Passing query as parameter - Java BeginnersJSP:
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 BeginnersJSP:
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
Ajax File Upload ExampleAjax 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 - Ajaxjava
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
pass parameter - file - Java Beginnerspass
parameter - file Hi, I want to pass paramter
file to method... immediately.
file.jsp
==========
File Parameter Use
Please Select the
file
2. Display.java
Main function parameter in C language - AjaxMain 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
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-uploadADS_TO_REPLACE_1
Ajax file uploadAjax 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
File uploading - AjaxFile 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
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:ADS
Ajax form element - AjaxAjax 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
Passing values in ComboBox from XML filePassing 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
how to use ajax in html filehow 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">
<
Drag and drop file uploading - AjaxDrag 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
Large File reading through Axis2 Web serviceLarge
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
Access Excel file through JDBCAccess 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
To call jrxml/jasper file through jsp code in netbeanTo 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
How to save form data to a csv file using jquery or ajax=data.responseText;
Now the problem is ,i should write form data to a csv
file using
ajax...How to save form data to a csv
file using jquery or ajax Please let... for the above link. It was by mistake posted. Please go
through the following