writing in Excek sheet

writing in Excek sheet

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
writing characters
writing characters  how to write a group of characters to a string ... i mean for writing single character using charAt in java
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
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
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
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
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
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
writing plugin - WebSevices
writing plugin  can anyone help me in writing plugin for internet explorer browser using c++ in .net environment
writing HTML entirely by hand
writing HTML entirely by hand  How comfortable are you with writing HTML entirely by hand
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
ModuleNotFoundError: No module named 'db-sheet'
ModuleNotFoundError: No module named 'db-sheet'  Hi, My Python...-sheet' How to remove the ModuleNotFoundError: No module named 'db-sheet... to install padas library. You can install db-sheet python with following
ModuleNotFoundError: No module named 'db-sheet'
ModuleNotFoundError: No module named 'db-sheet'  Hi, My Python...-sheet' How to remove the ModuleNotFoundError: No module named 'db-sheet... to install padas library. You can install db-sheet python with following
ModuleNotFoundError: No module named 'sample-sheet'
ModuleNotFoundError: No module named 'sample-sheet'  Hi, My Python... 'sample-sheet' How to remove the ModuleNotFoundError: No module named 'sample-sheet' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sheet-disk'
ModuleNotFoundError: No module named 'sheet-disk'  Hi, My Python... 'sheet-disk' How to remove the ModuleNotFoundError: No module named 'sheet-disk' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'time_sheet'
ModuleNotFoundError: No module named 'time_sheet'  Hi, My Python... 'time_sheet' How to remove the ModuleNotFoundError: No module named 'time_sheet' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'db-sheet'
ModuleNotFoundError: No module named 'db-sheet'  Hi, My Python...-sheet' How to remove the ModuleNotFoundError: No module named 'db-sheet... to install padas library. You can install db-sheet python with following
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
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.
writing webservices in php
writing webservices in php  How to write a simple web service in PHP
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
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
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 create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
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 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
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
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
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
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
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
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
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
Version of com.gordonwong>material-sheet-fab dependency
List of Version of com.gordonwong>material-sheet-fab dependency
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
ModuleNotFoundError: No module named 'mara-google-sheet-downloader'
ModuleNotFoundError: No module named 'mara-google-sheet-downloader'  ...: No module named 'mara-google-sheet-downloader' How to remove the ModuleNotFoundError: No module named 'mara-google-sheet-downloader' error
ModuleNotFoundError: No module named 'openerp-hr-timesheet-sheet'
ModuleNotFoundError: No module named 'openerp-hr-timesheet-sheet'  Hi...: No module named 'openerp-hr-timesheet-sheet' How to remove the ModuleNotFoundError: No module named 'openerp-hr-timesheet-sheet' error? Thanks
ModuleNotFoundError: No module named 'qt-style-sheet-inspector'
ModuleNotFoundError: No module named 'qt-style-sheet-inspector'  Hi...: No module named 'qt-style-sheet-inspector' How to remove the ModuleNotFoundError: No module named 'qt-style-sheet-inspector' error? Thanks  
ModuleNotFoundError: No module named 'smart-sheet-pp'
ModuleNotFoundError: No module named 'smart-sheet-pp'  Hi, My... named 'smart-sheet-pp' How to remove the ModuleNotFoundError: No module named 'smart-sheet-pp' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Sprite-sheet-project'
ModuleNotFoundError: No module named 'Sprite-sheet-project'  Hi...: No module named 'Sprite-sheet-project' How to remove the ModuleNotFoundError: No module named 'Sprite-sheet-project' error? Thanks   Hi
ModuleNotFoundError: No module named 'mara-google-sheet-downloader'
ModuleNotFoundError: No module named 'mara-google-sheet-downloader'  ...: No module named 'mara-google-sheet-downloader' How to remove the ModuleNotFoundError: No module named 'mara-google-sheet-downloader' error
ModuleNotFoundError: No module named 'mara-google-sheet-downloader'
ModuleNotFoundError: No module named 'mara-google-sheet-downloader'  ...: No module named 'mara-google-sheet-downloader' How to remove the ModuleNotFoundError: No module named 'mara-google-sheet-downloader' error
ModuleNotFoundError: No module named 'odoo11-addon-hr-timesheet-sheet'
ModuleNotFoundError: No module named 'odoo11-addon-hr-timesheet-sheet' ...: ModuleNotFoundError: No module named 'odoo11-addon-hr-timesheet-sheet' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-hr-timesheet-sheet' error
ModuleNotFoundError: No module named 'odoo12-addon-hr-timesheet-sheet'
ModuleNotFoundError: No module named 'odoo12-addon-hr-timesheet-sheet' ...: ModuleNotFoundError: No module named 'odoo12-addon-hr-timesheet-sheet' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-hr-timesheet-sheet' error
ModuleNotFoundError: No module named 'openerp-project-issue-sheet'
ModuleNotFoundError: No module named 'openerp-project-issue-sheet'  ...: No module named 'openerp-project-issue-sheet' How to remove the ModuleNotFoundError: No module named 'openerp-project-issue-sheet' error? Thanks
ModuleNotFoundError: No module named 'qt-style-sheet-inspector'
ModuleNotFoundError: No module named 'qt-style-sheet-inspector'  Hi...: No module named 'qt-style-sheet-inspector' How to remove the ModuleNotFoundError: No module named 'qt-style-sheet-inspector' error? Thanks  
ModuleNotFoundError: No module named 'qt-style-sheet-inspector'
ModuleNotFoundError: No module named 'qt-style-sheet-inspector'  Hi...: No module named 'qt-style-sheet-inspector' How to remove the ModuleNotFoundError: No module named 'qt-style-sheet-inspector' error? Thanks  

Ads