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



Home Answers Viewqa Java-Beginners how to call jsp variable through servlet
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Neo Java Developer
how to call jsp variable through servlet
0 Answer(s)      4 years ago
Posted in : Java Beginners


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();

Advertisement
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... on JSP visit to : http://www.roseindia.net/jsp/ImportAttribute.shtml
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 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: http://www.roseindia.net/jsf/myfacesspring/loginRegistration.shtml Hope
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
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 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
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
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
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
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
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 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
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
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
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
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
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
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
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
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
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
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 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
call dll from java - JSP-Servlet
call dll from java  Hello all how to call dll file methods in java
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
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
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
Advertisements
 

 

 

DMCA.com