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



Home Answers Viewqa JSP-Servlet writing in Excek sheet

Have Programming Question? Ask it here!
 
 
 


prashant
writing in Excek sheet
2 Answer(s)      5 years and 2 months ago
Posted in : JSP-Servlet



Advertisement
View Answers

June 12, 2009 at 1:06 PM


Hi Friend,

Follow these steps:
1) Create form.jsp
<html>
<body>
<form name="userform" method="post" action="excelFile.jsp">
<table>
<tr><td>Enter ID:</td><td><input type="text" name="id"></td></tr>
<tr><td>Enter Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Enter Class:</td><td><input type="text" name="class"></td></tr>
<tr><td>Enter Age:</td><td><input type="text" name="age"></td></tr>
<tr><td>Enter Address:</td><td><input type="text" name="address"></td></tr>
<tr><td><input type="submit" value="Export to excel"></td></tr>
</table>
</form>
</body>
</html>


June 12, 2009 at 1:07 PM


continue.............

2) Create excelFile.jsp:
<%@page import="java.io.*"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%>
<%
String value1=request.getParameter("id");
String value2=request.getParameter("name");
String value3=request.getParameter("class");
String value4=request.getParameter("age");
String value5=request.getParameter("address");
try{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Excel Sheet");
HSSFRow rowhead = sheet.createRow((short)0);
rowhead.createCell((short) 0).setCellValue("Student ID");
rowhead.createCell((short) 1).setCellValue("Name");
rowhead.createCell((short) 2).setCellValue("Class");
rowhead.createCell((short) 3).setCellValue("Age");
rowhead.createCell((short) 4).setCellValue("Address");

HSSFRow row = sheet.createRow((short)1);
row.createCell((short)0).setCellValue(value1);
row.createCell((short)1).setCellValue(value2);
row.createCell((short)2).setCellValue(value3);
row.createCell((short)3).setCellValue(value4);
row.createCell((short)4).setCellValue(value5);
FileOutputStream fileOut = new FileOutputStream("c:\\StudentData.xls");
wb.write(fileOut);
fileOut.close();
out.println("Data is saved in excel file.");
}catch ( Exception ex ){
}
%>
Thanks


Related Tutorials/Questions & Answers:
writing in Excek sheet - JSP-Servlet
writing in Excek sheet  Hello Dear sir, i got one scenario where i have to pick the data of the student like id , name , class , age & address from jsp & then i have to store these data into Excel Sheet
style sheet properties
style sheet properties  What are style sheet properties
Advertisements
connect many access sheet to one access sheet
connect many access sheet to one access sheet   hellow sir. i have six application page it has attribute name rollno(primary key) and attendance... access sheet as name rollno attendance of 1,2nd,3rd.....6th
Ghost Writing
Ghost Writing Ghost Writing is the kind of writing when someone... of writing it. So ghostwriter is a person who works behind the scene on a writing project in return of certain amount. The write-ups of the writer
insert excel sheet into mysql as a table
insert excel sheet into mysql as a table  sir, i want to import an excel sheet into mysql5.0 database as in the table format using tomcat 6.0 by jsp
reading excel sheet in java
reading excel sheet in java  can anyone tell me a proper java code to read excel sheet using poi   Here is a java code that reads an excel file using POI api and display the data on the console. import java.io.
Blog Writing
Blog Writing A blog, the short form of web log is an online user... on that. But the professionals are a better choice for writing the blog for commercial or promotional purpose. We provides the services of writing blogs for the commercial
update excel sheet using jsp::
update excel sheet using jsp::   Hi Sir,... I have a excel sheet for employee details "i retrieve particular datas from given excel sheet and display it into another excel sheet using jsp
Copy Mails to Xl sheet - JavaMail
Copy Mails to Xl sheet  Can somebody give me the Java code to copy outlook mails into an Xl sheet
Writing Actions
Writing Actions The Action is responsible for controlling of data flow within an application. You can make any java class as action. But struts have some built in interface and class for making action easily. To make an Action class
read data from Excel sheet
read data from Excel sheet  Hi, How to read data from an excel sheet using JSP. Thank you
how to display data in excel sheet?
how to display data in excel sheet?  According to the user Id,some links will be generated from the database,and if we click a link,data would... the button and to display the data in excel sheet
dynamically writing text javascript
dynamically writing text javascript  dynamically writing text javascript. Is it possible
dynamically writing text javascript
dynamically writing text javascript  dynamically writing text javascript. Is it possible
jsp with excel sheet data uploading into database
jsp with excel sheet data uploading into database  how to upload data in excel sheet with jsp into oracle 10g database
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
Cascading Style Sheet(CSS)
Cascading Style Sheet(CSS)       Cascading Style Sheet (CSS) is known as style sheet language.... The application of style sheet is to style the web pages written in HTML and XHTML
Web Writing
Web Writing       The art of writing for the web is far removed from writing for the print world.... Following is the prime aspect you need to keep in mind while writing for the web
Excel sheet image reading issue
Excel sheet image reading issue   Hello every one.I?m trying to read images from an excel sheet using OleDbDataReader. My excel file has 6 columns of data, the first 5 are all text but the last is image. While I?m
Create Excel Sheet Using JSP
create excel sheet using jsp       In this example we create excel sheet and insert values into table of the excel sheet . In this example we use page directive
SEO Writing
SEM and SEO Article Writing SEM and SEO article helps your business to grow... the intended traffic through SEM and SEO article writing in addition to other tools... is the demand of SEM and SEO article writing services. A good command over
Selecting Excel Sheet File
selecting excel sheet file       In this program we are going to select the excel sheet... sheet .  The package we need to import is java.io.* 
writing HTML entirely by hand
writing HTML entirely by hand  How comfortable are you with writing HTML entirely by hand
writing plugin - WebSevices
writing plugin  can anyone help me in writing plugin for internet explorer browser using c++ in .net environment
Excel Sheet Footer
Excel Sheet Footer In this section, you will learn how to create footer on a sheet using Apache POI. In the given below example, we will create footers having different position on sheet. These footers will appear on the hardcopy
Set Sheet Name Compressed Unicode
Set Sheet Name Compressed Unicode   ... the sheet name and compress it. The methods can be used for built in data format: setSheetName(int sheet, String name):  This method is used to set the sheet
Printing data into Excel sheet - Java Beginners
Printing data into Excel sheet  Hi all i am writing one application where there is need to bring the data into "Excel Sheet" with proper format.My... database then showing it(data) to in "Excel Sheet" is it possible to do ? if yes
Excel Sheet Header
Excel  Sheet Header In this section, you will learn how to create header on a sheet using Apache POI. In the given below example, we will create... on the hardcopy(print out) . You can see this by taking print preview of the sheet. Given
exporting data to excel sheet - JDBC
(); final HSSFWorkbook wb = new HSSFWorkbook(); final HSSFSheet sheet = wb.createSheet("Excel Sheet"); try{ Connection con = null
writing webservices in php
writing webservices in php  How to write a simple web service in PHP
extract data from excel sheet to mysql
extract data from excel sheet to mysql  sir, i want to extract data from excel sheet and save the data in mysql5.0 database in the form of table
browse and submit the excel sheet into mysql as a table
browse and submit the excel sheet into mysql as a table  sir, i want to browse and after clicking a submit button, the data in the excel sheet should be stored in the mysql5.0 as a table
Need to Remove Duplicate Records from Excel Sheet
Duplicate Records from Excel Sheet. I have one excel sheet having two fields (EmpNum, Rating) have to save in another excel sheet with unique empnum of latest... and to save only unique empnum with rating in another excel sheet
how to write quesry results into spread sheet
how to write quesry results into spread sheet   Hello sir/madam, I... and pop up the spread sheet in the jsp to save option. thanks   more clarification: spread sheet is nothing but csv file. thanks
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 the data from excel sheet? and how to make calculations in excel sheet like total avg
Excel sheet in read only mode - WebSevices
Excel sheet in read only mode  If am opening an excel sheet(through web application) to edit any information,Its opening in read-only mode... sheet,It has both read and write permission. How can i make the excel sheet
Set Zoom Magnification of Excel Sheet
Set  Zoom Magnification of Excel Sheet In this section, you will learn how to set the zoom magnification of a Excel workbook's sheet. Zoom... for the denominator. You can set the zoom magnification of a sheet as follows : sheet1.setZoom
question "writing prog"
question "writing prog"  Hello I want helping for this question, please Write a program that reads some friendsā?? names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
Export data to Excel Sheet in STRUTS 1.3
Export data to Excel Sheet in STRUTS 1.3  hi. how can i export content present on the jsp to excel sheet on button click..... and challenging part is i have to merge few rows and columns for a particular field(Value
excel sheet reading and using that data - JSP-Servlet
excel sheet reading and using that data  i have to do a read a excel sheet file of a employee record and then i have to use a employee details to send mail to those employees how to do in jsp sir please help me sir.. Thanks
Insert Image into Excel Sheet
Insert Image into Excel Sheet In this section, you will learn how to insert image into excel sheet using Apache POI. In the given below example, am image is insert into excel sheet at row 1 and at column 1. you can specify the top
File saving and Writing
File saving and Writing   Hello Rose india..... I have a doubt for you plzzz kindly Help me... I have an "Arraylist" which includes some table values... What i want to ask is "I want to create a jsp page which will include
Image writing over URLConnection
Image writing over URLConnection  Hello, I am trying to write... problems trying to write an image I have succeeded in writing to the local HD using.... The problem is that when writing by ImageIO on URL what will the name of the file
writing a code - Java Beginners
writing a code  write a code for a class called display that will display your name and age onto the screen  Hi Friend, Try the following code: class display{ String name; int age; public display(String n,int
writing aprogram - Java Beginners
writing aprogram  Write a program to reverse any string  Hi Friend, Try the following code: import java.util.*; class StringReverse{ public static void main(String[]args){ Scanner input=new Scanner(System.in
student marks sheet genaration in struts frame work
student marks sheet genaration in struts frame work  Hi every body iam using struts frame work back end as oracle 10g xe i wanna urgent code for student marks genaration code please help me thanks in advance
Export data in excel sheet in java in struts - Struts
Export data in excel sheet in java in struts  Hello, All how can i export data in excel file i java  Hi friend, For solving the problem visit to : http://www.roseindia.net/jsp/excelfile.shtml Thanks
How to get data from Excel sheet - Struts
How to get data from Excel sheet  Hi, I have an excel sheet with some data(including characters and numbers). Now i want read the data from excel sheet and display in console first then later insert this data into database
Writing a trigger for an userdefined datatype
Writing a trigger for an userdefined datatype  i have a user defined datatype in EMP table like COLUMNNAME:ADDRS_TYPE where ADDRS_TYPE have the following columns DATATYPE :ADDRESS VARCHAR2(136) V_CODE VARCHAR2(8) T_CODE
Find Name of Excel Sheet
Find Name of Excel Sheet     ... sheet using POI3.0 API Event. The advantage of event API  is that you can... BoundSheetRecord extends Record. This is used to defines a sheet within a workbook
 

 

 

DMCA.com