Home Tutorialhelp Comment Want to Retrieve CSV from a table using Struts2

 
 

Comment

Srivatsan
Want to Retrieve CSV from a table using Struts2,
January 24, 2008 at 5:15 PM

Hi,
Please help me in code, i want to get CSV using struts2 application! The thing is that i able to compile the java application but i couldnot run the file in the browser windows.Here by i attache the java file please refer it and do the needful. Bye!

package com.stocksim;
import java.sql.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.ActionSupport;
public class Stock extends ActionSupport{
private HttpServletRequest request;
private static String REAL_PATH = null;
private HttpServletResponse response;
public void setServletRequest( HttpServletRequest request ) {
this.request = request;
REAL_PATH = this.request.getRealPath( "/" );
}

public void setServletResponse( HttpServletResponse response ) {
this.response = response;
}
public String execute() throws Exception{
StringBuffer sb=new StringBuffer();
try {
System.out.println("Hello World");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:College");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from stud");
ResultSetMetaData mdata=rs.getMetaData();
sb.append("StudentNumber,StudentName,StudentDegree,StudentGrade,StudentPercentage,\n");
while(rs.next()) {
sb.append(rs.getString(1)+","+rs.getString(2)+","+rs.getString(3)+","+rs.getString(4)+","+rs.getString(5)+",\n");}
System.out.println("Employ-Details" + sb.toString());
//response.setContentType("text/html");
//response.setHeader("cache-control","no-control");
response.getWriter().println(sb.toString());
stmt.close();
con.close();


}
catch( Exception e ) {
e.printStackTrace();
}
return null;

}
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Struts Questions

using displaytag with struts2 - Struts
using displaytag with struts2   Hi, i am using struts2 framework... they were using this to display the data of List(arraylist/arrty), for sorting purpose while clicking on table column name, for exporting that data in pdf, xml, csv 

Struts-Tutorials

Struts Projects
learning easy Using Spring framework in your application Project in STRUTS Framework using MYSQL database as back end Struts Projects are supported be fully... Struts Projects Easy Struts Projects to learn and get into development 

Struts Questions

struts2 - Struts
struts2  how to pre populate the fields using struts2 from the database 

Struts Questions

Struts2 - Struts
Struts2  Hi, I am using doubleselect tag in struts2.roseindia is giving example of it with hardcoded values,i want to use it with dynamic values. Please give a example of it. Thanks 

Framework Questions

STRUTS2
STRUTS2  sir but my question is using ApplicationResources.properties in STRUTS 2.i cant get the values into my application.but in the exmple given... along with properties file but i can't get the values from the properties file.plz 

Struts Questions

Struts insert & retrieve
Struts insert & retrieve  Give a struts prg to insert and retrieve data from mysql db using the struts tags(no jsp scriplets and expressions) following mvc arch. i.e. model containing db connectivity, form containing get & 

Struts Questions

how to prepopulate data in struts2 - Struts
how to prepopulate data in struts2  I wanted to show the data from database using Struts

Struts Questions

struts2 - Struts
struts2  hello, am trying to create a struts 2 application that allows you to upload and download files from your server, it has been challenging for me, can some one help  Hi Friend, Please visit the following 

Development process Questions

csv file download
csv file download  Hello Every one, when user clicks download button I want to retrieve data from mysql database table in csv format using java.if... the following link: JSP Retrieve data from MySQL Database 

Struts Questions

tree tag in struts2 - Struts
tree tag in struts2  I have an arraylist of values retrieved from the database and i want all the values in the arraylist to be viewed in a subtree... want COUNTRYLIST as the root and INDIA,UK,USA as the sub childs at 1st level 

Struts Questions

Struts
Struts  I want to get the data from database into text box in a jsp page by using struts and javascript If I click on go button it will display all the values and from that i need to select the required value and i should store 

Struts Questions

Struts2 - Struts
Struts2  S:select tag is being used in my jsp, to create a drop down... weird, meaning that the drop down wen clicked it just jumps out from the first row... in Mozilla displays very well. Im trying to figure out from a long time, not succesful 

Struts Questions

struts2
struts2  dear deepak sir plz give the struts 2 examples using applicationresources.properties file 

Struts Questions

i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse  please help me i have to submit this soon 

Struts Questions

struts
struts  <p>hi here is my code in struts i want to validate my... rs=st.executeQuery("select seq.nextval from dual"); while(rs.next... }//execute }//class struts-config.xml &lt;struts 

Struts Questions

Migrating from struts1to struts2 - Struts
Migrating from struts1to struts2  Hi, I have found the best tutorial for struts in this Roseindia site. So thank you very much for your... that application to struts2? If you can provide the source code it will be great. Regards 

Struts Questions

Struts2
Struts2  Hi I am using struts 2,In struts2 architecture ,I couldn't understand the purpose of ActionMapper and ActionProxy.My Question is,when the request comes into the picture,the filterdispatcher consult the ActionMapper 

Java Code Examples

Export Database table to CSV File
Export Database table to CSV File In this tutorial, you will learn how to retrieve data from database and save it to CSV File. The Comma-separated values... created a database connection and fetch the records from the table using 

Struts Questions

struts - Struts
struts  Hi, i want to develop a struts application,iam using eclipse... functionality u want to use in your project. There is no standard list of jar files as such. Moreover war files are the compressed form of your projects 

Struts Questions

Struts
Struts   How to retrive data from database by using Struts 

Struts Questions

to retrieve from radiobox and comparing with a string - Struts
to retrieve from radiobox and comparing with a string  im creating a exam application in jsp which makes students to attend java questions.. created... a table ans(ques,op1,op2,op3,op4,op5,ans) in the mysql database and try 

Struts Questions

struts2 folder struture - Struts
struts2 folder struture  Hi, I just want to know the exact folder structure required for the struts2 application? Its urgent 

Ajax Questions

retrieve in xml file in struts2
retrieve in xml file in struts2  i am using struts2 and trying to populate the text box for the corresponding number entered by retrieving it from properties file using ajax. i now put the values from properties file to map 

Struts Questions

Struts2 UI - Struts
Struts2 UI  Can you please provide me with some examples of how to do a multi-column layout in JSP (using STRUTS2) ? Thanks 

Struts Questions

I want Image Album like -orkut and Facebook Using Struts 1.2
I want Image Album like -orkut and Facebook Using Struts 1.2  photo... to display all the images from the folder and i want to display it on JSP. like... in a database. it is neccessary..... I am using a link "Photo Gallery" to show 

Struts Questions

Struts
Struts   How will you retrieve a collection of records from business logic to presentation logic in framework 

Framework Questions

struts
struts   Hi how struts flows from jsp page to databae and also using validation ? Thanks Kalins Naik 

Struts Questions

query on struts2 - Struts
query on struts2  I am using struts2 for my application.i have a form that contains 'select' tag, for this i am getting values form DB. The problem is after i am submitting the form it is giving the following error 

Struts Questions

contains for list in struts2 - Struts
contains for list in struts2  Is there any way to check in the list or for existence of an enum ? Something like list.contains(string). iterating over list I want to do something like Display x display y 

JSP Servlet Questions

retrieve record from table
for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single values like...retrieve record from table  Hi. I have a field in database named 

Struts Questions

Struts
Struts  Am newly developed struts applipcation,I want to know how to logout the page using the strus   Please visit the following link: Struts Login Logout Application 

Struts Questions

Struts2 blank application - Struts
Struts2 blank application  Hi I am new to struts2 and i am trying to run the strutsblank application by following the following Link; http... application) when i am trying to open the application by using the link http 

Struts Questions

struts2 - Struts
Struts2 and Ajax Example  how to use struts2 and ajax 

Struts Questions

struts
struts   i have one textbox for date field.when i selected date from datecalendar then the corresponding date will appear in textbox.i want code for this in struts.plz help me 

Struts Questions

using struts1 and struts2 in one application - Struts
using struts1 and struts2 in one application  My Application is in Struts 1.0 and all further enhancements to the application must be struts 2.0. and in future we will migrate entire application to struts 2.0.Is it possible 

Java Beginners

Java Struts
Java Struts  Hi my name is arun I want to add country name into combo box from the database. I am using struts2 and want to use select tag of it on the JSP page. please help me with this. Thanks in advance 

Struts Questions

Struts2 ComponentTagSupport - Struts
Struts2 ComponentTagSupport   I am working on struts2 custom tags using ComponentTagSupport. I am referring to this link http://joshuajava.wordpress.com/2008/12/27/creating-custom-components-with-struts-2/ I made example 

Struts Questions

Help in Struts2
Help in Struts2  Hi, in struts 2 how to get the values from db and show in jsp page using display tag or iterator tag thanks in advance 

Struts Examples

What is Struts - Struts Architecturec
small and big software projectsStruts is an open source framework used... model we want to choose. The view of the Struts architecture is given below... What is Struts - Struts Architecture    

Struts and Hibernate Integration Tutorial

Hibernate criteria example using struts2
Hibernate criteria example using struts2 This hibernate criteria example using... create query without HQL. In this hibernate criteria example using struts2, we will see how to access records from database using criteria. Syntax of criteria 

Struts Questions

procedures to create struts projects?
procedures to create struts projects?  i am new to learn in struts. i am start to learn struts program, How to create a struts projects explain with step by step procedure.   Please visit the following link: Struts 

Struts Questions

struts
the checkbox.i want code in struts...struts  I have no.of checkboxes in jsp.those checkboxes values came from the databases.we don't know howmany checkbox values are came from 

Struts Questions

Struts - Struts
Struts  hi sir Is it necessary to learn struts 1 for struts 2.with out struts 1 cant we learn struts 2.x.presently i want to learn struts.i know little bit abt struts 1.x.presently which struts version is using in industry 

Java Beginners

retrieve multiple columns values from multiple csv files in java
retrieve multiple columns values from multiple csv files in java  Suppose there is folder in C:\fileupload which contains these two csv files...)///// here VendorID is corresponding to file1.csv i want to retrive data from 

Struts Questions

Achor tag. Struts2 code - Struts
Achor tag. Struts2 code  Hi All, How to send the values form one jsp page to another using anchor tag (or any which is similar to achor) in Struts? Please help me. I am waiting for the answer. Regards, Sandeep 

Struts Questions

Internationalization using struts - Struts
Internationalization using struts   Hi, I want to develop a web application in Hindi language using Struts. I have an small idea... to convert hindi characters into suitable types for struts. I struck here please 

Java Beginners

Exporting data from mysql into csv using jsp
Exporting data from mysql into csv using jsp  Hi friends.... I want to export the data from mysql to csv file using... i am having 30 columns in my..... but i want the csv file to be in the order like text1,text2,text3 should 

Struts Questions

Struts
Struts  I want to create tiles programme using struts1.3.8 but i got jasper exception help me out 

Struts Questions

struts
struts   how to display data from database on jsp using struts1.0 

Struts Questions

struts
struts   <p>hi here is my code can you please help me to solve...=st.executeQuery("select type from userdetails1 where username=\'"+uname...; <h1></h1> <p>struts-config.xml</p> <p> 

Struts Questions

Reg: Tree view in Struts using ajax - Struts
Reg: Tree view in Struts using ajax  HI all, Can you figure... in all struts tld file.. please help me if you know thanks in advance?  Hi friend, For struts2 Name of jar struts2-core-2.0.6.jar For using 

Struts Questions

Achor tag. Struts2 code - Struts
Achor tag. Struts2 code  Hi All, How to send the values form one jsp page to another using anchor tag (or any which is similar to achor) in Struts? Please help me. I am waiting for the answer. Regards, Sandeep   

Struts-Tutorials

Struts Articles
experience using Struts in a Servlet environment and that you want to take advantage... to learn a great deal from Struts projects. I see JSF becoming a dominant...) framework, and has proven itself in thousands of projects. Struts was ground-breaking 

Struts Questions

Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2  Hi, I am working in a Struts 2 project where in the jsp i am showing the list using a displaytag.Each row in the list has a checkbox 

Struts Questions

Struts Code - Struts
Struts Code  Hi I executed "select * from example" query... using struts . I am placing two links Update and Delete beside each record . Now I want to apend the id of the record with the Url using html:link Update 

Struts Questions

creating list in dropdown using struts - Struts
using struts : In action class list.add(new LabelValueBean("ID","Name... and setter for selectedItem. query : Now I want to retrieve ID and Name both in action class.I am able to retrieve ID,But i want to retrieve both 

Struts Questions

STRUTS-display search results - Struts
STRUTS-display search results  Hii, I am a beginner in struts..I want to retrieve few records from database and display in jsp page.First i tried... them in jsp.. Search Results 

JSP Servlet Questions

How to retrieve record from table
,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single values...How to retrieve record from table  Hi. I have a field in database 

JSP Servlet Questions

retrieve record from the field table
,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single...retrieve record from the field table  Hi. I have a field in database 

Hibernate Questions

Retrieve Value from Table - Hibernate
Retrieve Value from Table   Hai friend, I need help, How can i retrieve values From database using hibernate in web Application. As I new to hibernate I couldn't find solution for this problem.. Can anyone help please..  

Framework Questions

Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example... text field using struts and hibernate. Regards Subrat   The given... from the dropdown, related data will get displayed on the textboxes. Here we have 

Struts Questions

Struts - Struts
Struts  how to set value in i want to set Id in checkBox from the struts action.  Hi friend, For more information,Tutorials and Examples on Checkbox in struts visit to : http://www.roseindia.net 

JSP Servlet Questions

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 

Struts Questions

Struts to database connection first example. - Struts
Struts to database connection first example.  Hi All, I am new to Struts technology. I want to retriew the values of database to the browser page using struts2. Please help me. I am waiting for the answer. Regards 

Struts Questions

Highlight a corresponding table row - Struts
Highlight a corresponding table row  I have 2 jsps... the table being displayed with rows having links in them(paged display of the table due to huge data) 2.wen klik on the link it leads to Return.jsp 3.now wen 

Struts Questions

Need acode for struts implementation - Struts
Need acode for struts implementation  I want a code to generate dynamic table with a text field and a drop down list and to retrieve that data in the action class and store in the data base 

Java Server Faces Questions

retrieve data from database using jsf
retrieve data from database using jsf  Hello I want an example of source code to retrieve data from database i have a database (oracle) name as db1...),, name ,and city I want after enter value in textbox according idauthor i retrieve 

Free Programming books

Struts Books
-Controller (MVC) design paradigm. Want to learn Struts and want get... established. Struts-based web sites are built from the ground up... for applying Struts to J2EE projects and generally accepted best practices as well 

Struts Questions

struts - Struts
struts  we are using Struts framework for mobile applications,but we are not using jsps for views instead of jsps we planning to use xhtmls.In struts... to write and how to get the attributes from java(means how to write javacode 

Struts Questions

struts - Struts
struts  we are using Struts framework for mobile applications,but we are not using jsps for views instead of jsps we planning to use xhtmls.In struts... to write and how to get the attributes from java(means how to write javacode 

Struts 1 Tutorials

Struts 1 Tutorial and example programs
and struts2    Introduction to the Apache Struts... of the Struts Framework.    Using Struts... struts ActionFrom class and jsp page.    Using 

Struts Questions

Java Example projects about STRUTS
Java Example projects about STRUTS  Hai... I completed MCA but i have no job in my hands. But i do some small projects about STRUTS. Please send me some example projects about STRUTS.   Please visit the following link 

JSP Tutorials

Retrieve Data from CSV file in JSP
Retrieve Data from CSV file in JSP       CSV file : A CSV file is commonly known as a Comma... a Page ("ReadCsvFile.jsp") to retrieve the data from CSV file " 

Struts Questions

Struts2 And Hibernate Configuration
Struts2 And Hibernate Configuration  Sir, I am new to struts2, I am trying to write a program using struts2 and hibernate. I want to know how.... Bachan Sahoo   Struts Hibernate Integration 

Struts Questions

Struts2 connection pooling - Struts
Struts2 connection pooling  Dear Friends , How to make connection pooling in "Struts

Struts Questions

Struts2 connection pooling - Struts
Struts2 connection pooling  Dear Friends , How to make connection pooling in "Struts

Struts Questions

struts2+hibernate - Struts
struts2+hibernate  How to use hibernate 3 with struts 2 application? kindly reply with example 

Struts Questions

Struts - Struts
Struts  Hello ! I have a servlet page and want to make login page in struts 1.1 What changes should I make for this?also write struts-config.xml...=connection.createStatement(); rst=stmt.executeQuery("select * from login where username 

Struts Questions

struts2
struts2   Sir when i have run my struts 2 web application,every time i get error " request resources is not available",,,what is this,,,plz help me 

Struts Questions

tags in struts2
tags in struts2  Hello I am using simple tags in struts2. Like..." pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts..." method="post" validate="true"> <table align="center" border="0"> 

SQL Question

retrieve the records from one table to another table by using cursors
retrieve the records from one table to another table by using cursors   Hi I'm fresher to backend(mysql),my requirement is retrieve the records from one table to another table by using cursors.The following is my procedure 

JSP Servlet Questions

Retrieve data from databse using where in JSP
Retrieve data from databse using where in JSP  Hi, can somebody help me? I have a jsp page. in that i want to get data from the database where... INCORRECT SQL SYNTAX <html> ..... <body> <% //table 

Struts Questions

select tag in Struts2 to handle Enums - Struts
select tag in Struts2 to handle Enums  I have an java enum in my object. I am trying to set its values from struts2 select tag. I tried with "#list... to handle enums in struts2 select tag ?   Hi friend, Code to solve 

Struts Questions

Struts2
Struts2  Hi, I need a solution for displaying success message in same page in struts2. how to redirect same page in struts2.Please help me.   hi friend, To know how redirect action can be done in struts 2 you can go 

Struts Questions

Code Problem - Struts
Code Problem  i want to insert multiple row values (from html table which is in jsp) into oracle database using struts.for example oracle table... values.now i want to insert these 10 row values into databse usinf struts form 

Framework Questions

Struts 2
Struts 2   I am just new to struts 2 and need to do the task. I have a requirement like this : when i click on link like Customer , this will display all the customers , address from a database table using jdbc and the screen 

Struts Questions

Struts2
Struts2  i want select multiple items from select list in struts2.when i did like that the two selected values must saved into databse in two diffirent rows.pls provide any one code for this i am new to Struts2 

Struts Examples

Struts1 vs Struts2
. Developer can access the Action properties from the web page using the taglibs... into views Struts 1 binds objects into the page context by using the standard... Struts1 vs Struts2    Struts2 is more 

Java Beginners

Retrieve multiple data from database into Table.....
Retrieve multiple data from database into Table.....   hi........... I want to Retrieve multiple data from database into Table but i am not able... it wil give (2,3,.........,1,2005) but only for 2005 , i want to retrieve 

Struts Questions

dwr with struts2 - Struts
dwr with struts2  CAn u help me how to use dwr with struts2 

Struts Questions

Struts
Struts  Why struts rather than other frame works?   Struts is used into web based enterprise applications. Struts2 cab be used with Spring... used struts2 in telecom, e-Learning and banking domain etc. Struts2 reduces 

Struts-Tutorials

Struts 2, JPA and Hibernate Training
focuses on how to develop an application by using struts 2. Struts2 is used... applications Read data from and write it to a relational database using JDBC Talk... Struts 2, JPA and Hibernate Training       

Struts Examples

Struts 2 Training
to develop an application by using struts 2. Struts and webwork has joined... Struts 2 Training       The Struts 2 Training for developing enterprise applications with Struts 2 framework. Course 

Struts-Tutorials

Struts 2 - History of Struts 2
; Strut2 contains the combined features of Struts Ti and WebWork 2 projects... Struts 2 History       Apache Struts... taken over by the Apache Software Foundation in 2002. Struts have provided 

JSP Servlet Questions

retrieve record from table and show it in HTML
retrieve record from table and show it in HTML  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values 

Struts Questions

JSP - Struts
JSP  am using struts frame work for my project, my requirement is 1.in jsp page Class(drop down list) will take all classes in school from database... another list of values of students names. 3.when we select any student i want 

Struts Questions

JSP - Struts
JSP  am using struts frame work for my project, my requirement is 1.in jsp page Class(drop down list) will take all classes in school from database... another list of values of students names. 3.when we select any student i want 

Struts Questions

JSP - Struts
JSP  am using struts frame work for my project, my requirement is 1.in jsp page Class(drop down list) will take all classes in school from database... another list of values of students names. 3.when we select any student i want 

Development process Questions

struts
struts shopping cart project in struts with oracle database connection  shopping cart project in struts with oracle database connection   Have a look at the following link: Struts Shopping Cart using MySQL 

JSP Servlet Questions

HTML & MYSQL - retrieve record from table
HTML & MYSQL - retrieve record from table  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single 

Advertisements Advertisements
 

 

 

DMCA.com