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



Home Answers Viewqa JSP-Servlet export jsp page

Have Programming Question? Ask it here!
 
 
 


freena
export jsp page
3 Answer(s)      4 years and a month ago
Posted in : JSP-Servlet


i want to export jsp page in word and pdf format... code that export my jsp page in word and pfd format....

Advertisement
View Answers

August 7, 2010 at 5:05 PM


Hi Friend,

Try the following code:

1)pdf.jsp:

<html>
<body>
<form method="get" action="pdfdata.jsp">
<table>
<tr><td>Name</td></th><td><input type="text" name="name"></td></tr>
<tr><td>Address</td></th><td><input type="text" name="address"></td></tr>
<tr><td>Contact No</td></th><td><input type="text" name="contact"></td></tr>
<tr><td>Email</td></th><td><input type="text" name="email"></td></tr>
<tr><td></td><td><input type="submit" value="Export"></td></tr>
</table>
</form>
</body>
</html>

2)pdfdata.jsp:

<%@page import=" java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="com.lowagie.text.Document"%>
<%@page import="com.lowagie.text.Paragraph"%>
<%@page import="com.lowagie.text.pdf.PdfWriter"%>

<%
try {
OutputStream file = new FileOutputStream(new File("C://text.pdf"),true);

Document document = new Document();
PdfWriter.getInstance(document, file);
document.open();
String name=request.getParameter("name");
String address=request.getParameter("address");
String contact=request.getParameter("contact");
String email=request.getParameter("email");
document.add(new Paragraph("Hello,"));
document.add(new Paragraph("It is "+new Date().toString()));
document.add(new Paragraph(" "));
document.add(new Paragraph("Name is : "+name));
document.add(new Paragraph("Address : "+address));
document.add(new Paragraph("Contact No : "+contact));
document.add(new Paragraph("Email : "+email));
document.close();
file.close();
out.println("Data is exported successfully.");
} catch (Exception e) {

e.printStackTrace();
} finally {
out.close();
}
%>

For the above code, you need itext api.

Thanks


December 7, 2010 at 10:18 AM


hi ! I followed you, but report is not thai font. Can you help me please.



December 7, 2010 at 10:23 AM


thai font don't show in myreport.pdf

I was supposed to do,please suggest.



Related Tutorials/Questions & Answers:
export jsp page - JSP-Servlet
export jsp page  i want to export jsp page in word and pdf format... code that export my jsp page in word and pfd format....  Hi Friend, Try the following code: 1)pdf.jsp: Name Address Contact
How to export web page to excel using java or jsp or servlets
How to export web page to excel using java or jsp or servlets  Hi I am trying to export web page(jsp page ) to excel using jsp or servlets. I am retrieving records from database and displaying in the jsp page, In this page I
Advertisements
export to excel - JSP-Servlet
export to excel  Hi this is priti. I need a help. What is my question is i have a report page here i need a button cllaed "Export to excel". After clicking the button all the values from the jsp page will save to a excel file
export
export  how to export tabled data in jsp into excel
How to export chart(graph) generated by jsp into a excel?
How to export chart(graph) generated by jsp into a excel?  How to export chart(graph) generated by jsp into a excel? I have a jsp page which generates charts . Now I need those charts to be exported into an excel.please help
export value in csv from jsp
export value in csv from jsp  Hi! i have creted a html form using javascript. i hv taken the array values in jsp. nw i want to pass these array values from jsp to csv file. so please help me how to send
How to export data from jsp to excel sheet by using java
How to export data from jsp to excel sheet by using java   How to export data from jsp to excel sheet by using java
export data to excel sheet - JSP-Servlet
export data to excel sheet  Hi.. how to export data to excel sheet from jsp? and how to update the excel sheet from jsp? and how to get... from jsp? Pls.....   Hi Friend, Try the following code: 1
Export Extjs Gridview data to excel in jsp
Export Extjs Gridview data to excel in jsp  i need to export the extjs girdview data to excel can you please help me thanks in advance
How to download web page table data, export the table records in an excel file and save
How to download web page table data, export the table records in an excel file and save  i have a web page(.jsp) which contains the table of 4 to 5 columns. i m displaying the table using in my jsp page. below this table i want
Export html data to excel
Export html data to excel  I am trying to export data from an html page to an excel sheet.Any advise
jsp page
jsp page  <%@page contentType="text/html" pageEncoding="UTF-8"%>...;%@page import="java.sql.Statement"%> <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.Connection"%> <%@page import
jsp page
jsp page  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
JSP Tutorials - Page 3
JSP Tutorials - Page 3
jsp page - JSP-Servlet
jsp page  what are elemets and template data in jsp page??  Hi Friend, Template Data is a parameterized content that allows the JSP document to generate a response stream of characters. JSP Elements provides
Export chart to JPEG file
Export chart to JPEG file  Hi. I have one problem. I have generated piecharts and barcharts using chartlib.js and jquery in jsp. Now i want to export this charts to jpeg file . how can i do this? Thank q in advance
The Page Directive in JSP Page
The Page Directive in JSP Page     ... of the JSP page which works for the entire JSP page. These directives apply different... and explanation one-by-one. This is the directive of the JSP page which defines
jsp page submitting
jsp page submitting  whenever i am submitting the jsp page it downloads some unknown file on tomcat server
export instance sql
export instance sql  How to export instance in sql
JSP page directive tag
JSP page directive tag  What is page directive tag in JSP?.   Hi, The answer given below: The page directive applies to an entire JSP... unit. or Defines attributes that apply to an entire JSP page. Thanks
create a folder in jsp page
create a folder in jsp page  i want to create a folder in jsp page And it can be delete aslo
Search Page in jsp
Search Page in jsp  search page in jsp   Please go through the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
refresh jsp page - Ajax
refresh jsp page  Code for refresh a web page in jsp.  Hi friend, function refreshpage() { window.location.reload
JSP Error Page
JSP Error Page          JSP Error Page is used to specify the custom... of errorPage attribute of the page directive in jsp. This attribute sets a url
Forward a Jsp Page
Forward a Jsp Page In this example program we will show you how to use the <... is not logged in you can forward the user on the login page. Here is the use of <jsp:forward tag: <jsp:forward page="
jsp login page
jsp login page  hi tell me how to create a login page using jsp and servlet and not using bean... please tell how to create a database in sql server... please tell with code
Search page form in jsp
Search page form in jsp  search form in jsp   Please go through the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
Unable to execute JSP page
folder. But I could not execute the JSP page. Please help me...Unable to execute JSP page  I have written one jsp file. It contains html tags and jsp directives. I have saved the file with the extension .jsp
Page object - JSP-Servlet
Page object  Hello friends, How can we make use of PAGE object of implicit JSP object. If this is possible explain me about.......  Hi friend, Implicit Objects in JSP are objects
JSP Page Directive
JSP Page Directive  Defined JSP Page Directive ?   The <%@ page %> directive applies to an entire JSP file and any of its static... is a file whose content becomes part of the calling JSP file.The <%@ page %>
list to be displayed in jsp page.
list to be displayed in jsp page.  Can any one help me? Am developing the code in struts.I have a list in action class that has to be printed in the dropdownlist in another jsp page.Please help me in the code.. Thank u
JSP error page - JSP-Servlet
JSP error page  Hi i have 1000 of JSP. but we coded it without adding the . but now i have to forward the page to the specific page when the exception occured in JSP. is there any short cut i can do? do not want to add this line
jsp login page
jsp login page  Hi All, can any one tell me how to create Login page using JSP and Beans. A simple log in page. Please reply ASAP. Thanx, am2085   Hello Friend, Please visit the following link: JSP Login Using
page refresh - JSP-Servlet
page refresh  Hi All, I've done a login application using Ajax. I wrote jsp page having sign in option. when i click the sign in,pop up window... up window has to close and jsp page has to refresh. how can i solve
JSP LOGIN Page
JSP LOGIN Page  sir....i have two user types usercategory and user and both user have userid and password in two different table and now i am making login page for which i have to retrieve usertype,userid and password from two
JSP Hindi Page - JSP-Servlet
JSP Hindi Page  I need to provide users with option to print a Certificate in English or Hindi. This is an html page generated by JSP Code. Depending upon the button clicked english or hindi version of the Certificate should
How to export grid into excel
How to export grid into excel  Hi, i created a grid panel i have to export it to the excel. please help me by some sample code. thanks in advance. cool day dude
jsp page tags - JSP-Servlet
jsp page tags  Hi, Can anyone please explain me how to use Pager tags (http://jsptags.com/tags/navigation/pager/index.jsp). After getting the data from the database, how should we use that in these tags. Can you please
Sorting a jsp page. - JSP-Servlet
Sorting a jsp page.  Hi there, It's me again. I tried to use Ajax... is process the code in the servlet. Here's the code in the jsp below: JSP Page Universal Books Home Page
jsp reload current page problem
jsp reload current page problem  Hi, i am facing problem while reloading the JSP page
how to create web page on jsp?
how to create web page on jsp?  how to create web page on jsp
jsp reload current page problem
jsp reload current page problem  Hi, i am facing problem while reloading the JSP page
Switch case in Jsp page
using switch case in jsp page...Switch case in Jsp page  <table> <tr><td>Enter Distance :</td> <td><input type="text" name="dis"/></td>
Jsp include page problem
Jsp include page problem  I have included footer.jsp in all my pages. It is working in all pages except search.jsp. In search.jsp (Old footer.jsp content is displayed ) How can I rectify this?   Hi, You have to delete
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... :  For more information on JSP visit to : http
Hide the Jsp Page
Hide the Jsp Page  I want to hide the Entire JSP Page.is it possible
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n... i run jsp page on the browser it only shows the code nothing else.. I have...;/html> 2) insert.jsp <%@ page import="package oracle.jdbc.driver;" %>
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n... i run jsp page on the browser it only shows the code nothing else.. I have...;/html> 2) insert.jsp <%@ page import="package oracle.jdbc.driver;" %>
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n... i run jsp page on the browser it only shows the code nothing else.. I have...;/html> 2) insert.jsp <%@ page import="package oracle.jdbc.driver;" %>
 

 

 

DMCA.com