Acess Record from database.

Acess Record from database.

How to access records from database and how to display it on view page, with the help of hibernate?

View Answers

March 9, 2011 at 5:43 PM

Hi Friends, With the help of this code you can access data from database and how to display on view page it

Action class
package net.roseindia.action;

import java.util.List;

import net.roseindia.Model.AddInformation;
import net.roseindia.dao.InformationDAO;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class InformationAction extends ActionSupport implements ModelDriven {
    private AddInformation obAddInfo;
    private List infoList;
    private int id1;
    private InformationDAO obDao = new InformationDAO();

    @Override
    public String execute() throws Exception {
        this.infoList = obDao.list1();
        return SUCCESS;
    }

}
Mapping file (struts.xml)

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<package name="default" namespace="/" extends="struts-default">
<action name="index" class="net.roseindia.action.InformationAction">
    <result name="input">AddInforForm.jsp</result>
    <result name="success">AddInforForm.jsp</result>
</action>
</package>
</struts>
View page : 
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="/struts-dojo-tags" prefix="sx"%>
<html>
<head>
<title>Information data </title>
<s:head/>
</head>
<body>
<table border="1">
<caption style="color: green;">Information Added by user</caption>
<tr><th>First Name</th>
<th>Last Name</th>
<th> Gender</th>
<th>Age</th>
<th>Address</th>
<th>Delete</th>
</tr>
<s:iterator value="infoList" var="obAddInfo" >
<tr>
<td><s:property value="firstname"/> </td>
<td><s:property value="lastname"/></td>
<td><s:property value="gender"/></td>
<td><s:property value="age"/></td>
<td><s:property value="address"/></td>
</tr>
</s:iterator>
</table>
</body>
</html>









Related Tutorials/Questions & Answers:
Acess Record from database.
Acess Record from database.  How to access records from database and how to display it on view page, with the help of hibernate
Load Coursenames from MS Acess Database to JComboBox - Java Beginners
Load Coursenames from MS Acess Database to JComboBox  Hello sir, I want to Load/add Course names which stored in Ms Acess 2007 Database, plz help... name from course"); jc.addItem("Select"); while(rs.next()){ jc.addItem
Advertisements
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  //this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  //this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
retrive record from the text field and insert into to database
retrive record from the text field and insert into to database  the following code is inserting values in the my sql database but i want to insert the data into oracle database , i want what changes i have to make
Loading a jsp page (with record from database) from another jsp page
Loading a jsp page (with record from database) from another jsp page  ... with records from database(against Serial no and year).That is, as soon as Getdata.jsp will be loaded, it will show the first record. How can I do
fetch record from oracle database using jsp-servlet?
fetch record from oracle database using jsp-servlet?  how can i fetch data from oracle database by using jsp-servlet. i'm using eclipse, tomcat server and oracle database and creating jsp pages and also using servlet
How to retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  Am using phpMyAdmin Database.In mysql database having 10 records. The field... record based on username and password. I dont know how to retrive in php with mysql
Fetched Record from database show into text field of html page
Fetched Record from database show into text field of html page  hi, i have a database with field merchant_code, merchant_name, city, region, and also have html page with all above mentioned field i have submit 20 record from
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST,please send answer as soo as possible
How to solve concurrency issue when an application is running on two machine to fetch record from one database
to fetch record from one database  I have developed an application in java to run on two machines. Program will fetch a record from database and process... are not fetching/processing same record at the same time. for example: if one machine fetches
retrieve record from table
retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually
add record to database - JDBC
add record to database  How to create program in java that can save record in database ?  Hi friend, import java.io.*; import java.sql....); if(i!=0){ out.println("The record has been inserted
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  In this code how i will use arraylist(which store all my records in index form) to show next data on button click,so that it will goes
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  In this code how i will use arraylist(which store all my records in index form) to show next data on button click,so that it will goes
retrieve record from the field table
retrieve record from the field table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
How to retrieve record from table
How to retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
hibernate record not showing in database - Hibernate
hibernate record not showing in database  session =sessionFactory.openSession(); //inserting rocords in Echo Message table...)); //It showing on console Records inserted 21 But not showing in database
JSP Delete Record From Table Using MySQL
JSP Delete Record From Table Using MySQL This tutorial explains you that how to write a JSP for deleting a record from database table. In this section you.... In this tutorial you will learn that how to delete a record of a database table in JSP
HTML & MYSQL - retrieve record from table
HTML & MYSQL - retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field
fetch record from MYsql table query
fetch record from MYsql table query  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
MYSQL retrieve record from Data table
MYSQL retrieve record from Data table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field
retrieve record from table and show it in HTML
retrieve record from table and show it in HTML  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
Write a query to delete a record from a table
Write a query to delete a record from a table  Write a query to delete a record from a table   Hi, The query string for the delete operation is as follows-ADS_TO_REPLACE_1 delete from employee where id='35'; Thanks
retrive data from database
retrive data from database   hi.. i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in database access sheet i want to view it at any another
Write records into text file from database
Write records into text file from database You have already learnt how to insert records from text file to database. But here we are going to retrieve records from database and store the data into the text file. For this purpose, we have
connect to the database from JSP
connect to the database from JSP  How do you connect to the database from JSP?   A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets
How to update record to database? I have trouble with the following code
How to update record to database? I have trouble with the following code ... the record,what is the missing of the following code ?I need help,thankyou <?php mysql<em>selectdb($database_con, $connection); $emailAddress=$_POST
download code from database
download code from database  how to download files from database
How i upload file and save that record in database using JSP?
How i upload file and save that record in database using JSP?  Hi All, I m the beginner in JSP and I want to upload the file and store that file and some other form data in MySQL database. Ex. There is one employee detail form
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend, -------------------------------------------- Visit for more information
How To Insert A New Record to MS Access table database in GUI
How To Insert A New Record to MS Access table database in GUI  Hello... that involves inserting a record into a 6-column table in my MS Access database table. I'm..._UPDATABLE); String sql = "select * from DonorTable"; rs
delete an item from database
delete an item from database  how to delete an item from the database using jsp
Check Whether Record is already Exists or Not with Database Connectivity - Java Beginners
Check Whether Record is already Exists or Not with Database Connectivity ... in the database with Swing Application ,if It is Already Exists then I want To Show MsgBox else that will Store in Database. plz Help Me Sir  Hi Friend, Try
Fetching image from database
Fetching image from database  I have uploaded image path and image name in database so, now how can i display that image using JSP or HTML page... in database is:E:\1003\54175\20110407121554 image name i have stored
ACCESS DATABASE FROM HTML
ACCESS DATABASE FROM HTML  I want to access sql 2008 database in html page without help of ADODB connection.. because if access through ADODB means there is a security problem. so, Access database in html page(client side
selecting data from database
selecting data from database  how to select data from database using Dao in struts   Hi, You have to load the data from database using hibernate and send the data in a Java file object to jsp page.ADS_TO_REPLACE_1
retrive data from database?
retrive data from database?  hellow i have a database sheet name as db1. it's contain sixty(60) sn,name ,rollno(primary key),father's name etc... from db1 and enter value in text box according there name,rollno and save
searching from database
searching from database  how to search data from data base throug search...such as contact no./lastname /firstname should give whole information from database...   Please visit the following link: Servlet search
get information from database
get information from database  get information from database   Please visit the following links: http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml http://www.roseindia.net/sql/mysql-example/select
Delete points from database
Delete points from database  I have a polygon on a web page and a delete button. The polygon is saved in the database in one table and in another... in database. However the points are not getting deleted. I used this code
Update Database from jsp
Update Database from jsp   I want to update my oracle database column from a text box ,so whenever I input some text value in the text box and click UPDATE button the database field should be updated . I have a drop down menu
Displaying file from database
Displaying file from database  I have list of files in my database. I... that corresponding file from database. I have list of file id related to search. I want... * from file"; ResultSet rs = stmt.executeQuery(strQuery); while(rs.next
search from database
); }   i want to retrieve values from database and display them in my...search from database  DBUtil util = new DBUtil(); try { JOptionPane.showMessageDialog(null, "Connection Opened!"); Connection con
retrieve from database........
retrieve from database........  <p>hi i am not able to retrieve string from database to a text box in web page my code is as follows:-</p>...("username"); re=stmt.executeQuery("select * from userreg where username='"+username
line chart from database in jsp
line chart from database in jsp  how can i create line chart from database in jsp code
fetch data from database in javascript
fetch data from database in javascript   How to fetch data from database in JavaScript when it is a leap year
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database

Ads