how to call jsp variable through servlet

how to call jsp variable through servlet

Hi deepak;

i am posting some peace of code. and i need to call jsp varable <%=f%> through servlet so that it can call the downlode.jsp page.

String f = "C:/temp/View HR LeaveBalance2.txt"; FileWriter writer = new FileWriter(f, true); BufferedWriter bw = new BufferedWriter(writer); while (rs.next()) { String st1 = rs.getString(1); String st2 = rs.getString(2); String st3 = rs.getString(3); String st4 = rs.getString(4); bw.write(st1 + " " + st2 + " " + st3 + " " + st4); bw.newLine(); bw.newLine();
out.println(st1); out.println(st2); out.println(st3); out.println(st4); and i given a hyperlink to call this downlode page like out.println("Download document");

when i click on this hyper link it gives error i want only one downlode.jsp and it will save all the text.file if i put like code given it will work fine but [request.getParameter("ff")]not working can u give me any suggetion for that

<% String file = "C:/temp/A1.txt"; //request.getParameter("ff");

File f = new File(file);
String filename = f.getName();
String type = getMimeType("file:" + file);
response.setContentType(type);
response.setHeader("Content-Disposition","attachment;    filename=\"" + filename + "\"");
String name = f.getName().substring(f.getName().lastIndexOf("/") + 1, f.getName().length());
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();
View Answers









Related Tutorials/Questions & Answers:
how to call jsp variable through servlet
how to call jsp variable through servlet  Hi deepak; i am posting some peace of code. and i need to call jsp varable <%=f%> through servlet so that it can call the downlode.jsp page. String f = "C:/temp/View HR
How to call servlet in JSP?
How to call servlet in JSP?  How to call servlet in JSP
Advertisements
how to call a java class in jsp - JSP-Servlet
how to call a java class in jsp  hi.. friends iam new to roseindia.i... : Example of Extends Attribute of page Directive in JSP...(){ return "Roseindia.net"; } } For more information on JSP visit to : http
how to call a java class in jsp - JSP-Servlet
how to call a java class in jsp  hi.. friends iam new to roseindia.i... : Example of Extends Attribute of page Directive in JSP... on JSP visit to : http://www.roseindia.net/jsp/ImportAttribute.shtml
How to call jasper from jsp or servlet - JSP-Servlet
How to call jasper from jsp or servlet  Hi Expert , I created jasper report using ireport.how to call that jasper with jsp file or servlet file ? Thanks in advance Eswaramoorthy.s
how to connect the database using hibernet through servlet/jsp through form
how to connect the database using hibernet through servlet/jsp through form  plz give me the reply   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/jsf/myfacesspring
variable setting for servlet - JSP-Servlet
variable setting for servlet  how to set environment variable and class path variable for servlet and to compile servlet files i am using tomcat 6.0  Hi Friend, Please visit the following links: http
variable for cookie.setDomain - JSP-Servlet
variable for cookie.setDomain  I want to create a variable to use inside the following statement: cookie.setDomain(".mydomain.com"); Users will be hitting different sites using the same code for all. Any suggestions would
how to assign javascript variable value to a jsp variable
how to assign javascript variable value to a jsp variable  how to assign javascript variable value to a jsp variable
how call ireports in jsp
how call ireports in jsp  please send me code any one for calling ireports in servlet-jsp program i am trying to call the ireports in servlet and jsp error is occurred exception: javax.servlet.ServletException
Call servlet from javascript - JSP-Servlet
Call servlet from javascript  Hi in my application i have jsp that designs view, javascript for validation and servlet that perform business logic , in my jsp i have provided an upload button thet upload single column excel file
Sending query with variable - JSP-Servlet
database and query should have a variable at the end. While using this variable we... page. How can we resolve this. Static page link: But in case of static page here userno--> variable which contains no. that is retrieved from
mail through jsp and servlet - JSP-Servlet
mail through jsp and servlet  H! Rose India team, kindly let me know what is the error in this code (java file) because the java file is not compiling and gives 100 errors saying that you cannot user assert key word. I
onclick pass variable - JSP-Servlet
onclick pass variable  on button onclick event pass variable and print in textbox in same page... i want to pass value of variable at onclick event of button and also want to print it in textbox in same page....  Hi
How to call print dialog box through JMenuItem?
How to call print dialog box through JMenuItem?  What is the way to call the print dialog box through JMenuItem to print the current page like we can do in javascript by calling window.print() function
how to call the print dialog box through JMenuItem
how to call the print dialog box through JMenuItem  What is the way to call the print dialog box through JMenuItem to print the current page...could you please help me by sending code
Probem while creating PDF through JSP-Servlet - JSP-Servlet
java app or the batch file through JSP or servlet the PDFCreator is called but I...Probem while creating PDF through JSP-Servlet  Hi, I have a web-app... PDFCreator for this. If I call the PDFCreator through a standalone java app or through
how to pass variable from simple java main class(not servlet) to the jsp page?
how to pass variable from simple java main class(not servlet) to the jsp page?  I have a simple Java class in which I invoke a call to a JSP page... from the simple Java class to the JSP page. How can I do that? Here is my
To call jrxml/jasper file through jsp code in netbean
To call jrxml/jasper file through jsp code in netbean  I am making web application in jsp with netbean. For report I am using ireport 3.6.7.... my question is I want to call that jasper file through my jsp code and i also
Send forgot Password through mail - JSP-Servlet
used like jsp,servlet,php and .net etc.. Thanks  Sorry...Send forgot Password through mail   hello every one I am designing a admin login page where i am validating the password through file(Example
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet  Dear Sir, I want to add the Image In databse using servlet. I have a program Its fine run on command prompt. When I use Servlet Its not properly run. ServletOne.java: import
Diff ways to call a EJB from Servlet, JSP - Java Interview Questions
Diff ways to call a EJB from Servlet, JSP  How can I call EJB from Servlet or JSP
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet  Dear Sir, My previous Query that: I want to add the Image In databse using servlet. I have a program Its fine run on command prompt. When I use Servlet Its not properly run
pass a variable(friends name) through a hyperlink in to another jsp.
pass a variable(friends name) through a hyperlink in to another jsp.  hi friends, i am developing a site in jsp. i have some problem,plz tell me... how i do this? thanks
pass a variable(friends name) through a hyperlink in to another jsp.
pass a variable(friends name) through a hyperlink in to another jsp.  hi friends, i am developing a site in jsp. i have some problem,plz tell me... me how i do this? thanks
Upload Image to Database through Servlet - JSP-Servlet
Upload Image to Database through Servlet  Hello, I make.... classpath=C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar... assist me.and How I make this program efficient. My files are: UploadFile.java
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet  Dear Sir, My previous Query that: I want to add the Image In databse using servlet. I have a program Its fine run on command prompt. When I use Servlet Its not properly run
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet  Dear Sir, My previous Query that: I want to add the Image In databse using servlet. I have a program Its fine run on command prompt. When I use Servlet Its not properly run
what is proper way to save pictures in SQl database and call it through JSP ?
what is proper way to save pictures in SQl database and call it through JSP ?  Hi guys, I usually store picture path in DB and call them through 'getContextPath()' mehtod using this method I can call pictures and Text on same
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet  Dear Sir, I am not able to solve my problem cocerning Inserting the image in Database through Servlet. I am usng Oracle 10g. On server side of weblogic Its show that: Connection loaded
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet  Dear Sir, You write me: copy this link and paste in your Url http://rs236.rapidshare.com/files/144453519/New_WinZip_File.zip Check there a button called "FreeUser" Click on that button
how to call jsp from flex
how to call jsp from flex  hi, i want to know that how can i call a FLEX from JSP. . A good Example will be appreciated
how to call jsp from flex
how to call jsp from flex  Plz help me out to get JSP from FLEX.... I need your help.... Thanks for future
Redirecting the output of an expression to a variable - JSP-Servlet
Redirecting the output of an expression to a variable  I want to redirect the output of to a variable defined in variable.jsp. What is the syntax...' file: Create another jsp file 'get.jsp' to get the output: Thanks
convert javascript var to java variable - JSP-Servlet
convert javascript var to java variable  hi how to conver javascript var to java variable?  Hi Friend, We are providing you two ways: 1)a.jsp: function call(){ var name = "roseindia
Assigning a value to JSP variable from a bean class. - JSP-Servlet
Assigning a value to JSP variable from a bean class.  Hi, I want to know how we can assign value to a JSP variable from a Java Bean. I am using Struts, JSTL. Which tags should I use to assign the value. e.g Kindly
How to pass javascript variable in Scriplet of JSP?
How to pass javascript variable in Scriplet of JSP?  How can I assign the value of a javascript variable to a variable declared in jsp scriplet? Is it possible
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... are not store in Ms-Access. I store the input parameter through Standard Action . jsp:useBean call a property IssueData. this property exist in SimpleBean.java
call dll from java - JSP-Servlet
call dll from java  Hello all how to call dll file methods in java
Call dll from java - JSP-Servlet
Call dll from java  Any one tell me how to call dll from java...) in java .For this i want to call a dll from java . Also any one have another solution ,please tell me how to do it. Thank You in advance
application of remote procedure call - JSP-Servlet
application of remote procedure call  give the small application for the remote procedure call and its related program code in java
remote procedure call using java - JSP-Servlet
remote procedure call using java  what is the romote procedure call... Call) is a mechanism that enables a remote procedure call from a client... services to call other applications or Web services. JAX-RPC provides a uniform
how to call the array variable in scriptlet from javascript function
how to call the array variable in scriptlet from javascript function  This is the scriptlet code:- <% String[] abc={"saab","volvo","bmw","Benz","Porsche","Jaguar"}; %> Actually i want the array variable one by one
how to call java script function through java class file
how to call java script function through java class file  how to call jframe in java script
Converting jsp variable to java variable
Converting jsp variable to java variable  Hi how to convert java script variable to java variable on same jsp page
How to Assign struts2 property to jsp variable
How to Assign struts2 property to jsp variable  In Struts2 <s....   But i wants to assign the value to jsp variable   I wants to assign to jsp variable   wants to assign <s:property
How to call java method on Button click in jsp?
How to call java method on Button click in jsp?  How to call java method on Button click in jsp
How to make a servlet to automatically call another servlet at some time instant.
How to make a servlet to automatically call another servlet at some time instant.  Can some one assist me How to make a servlet to automatically call... to display in separate HTML page, in which first servlet display should call second
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database

Ads