Home Answers Viewqa Hibernate-Interview-Questions Acess Record from database.

 
 


samar
Acess Record from database.
1 Answer(s)      2 years and 2 months ago
Posted in : Hibernate Interview Questions

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 Pages:
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
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
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
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
delete record
deleted from the database. In the database we have created three fields bookid...delete record  how to delete record using checkbox and button in php   We are providing you the jsp code that displays the database table
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
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
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
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
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
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
JDBC Insert Record
is processed. Finally the execute Query ( ) return you the record set from a table... JDBC Insert Record      ... Record. In this code we have a class JdbcInsertRecord.Inside this class
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
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
sort a record in jsp - JSP-Servlet
sort a record in jsp  hello, can i get a code that displays 10 records per page from a table student and when i click on the next button it displays the next 10 pages and so on. Im using jsp and mysql database. thx priya
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
Database
Database  I am working in jsf2.Fro a demo i created database in ms access.no wi want to retrive a record from database for a particular data.I need help as I am stuck
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
JDBC Select Record Example
JDBC Select Record Example  In this tutorial we will learn how select specific  record from table use mysql JDBC driver. This  select...; "SELECT * FROM user WHERE  user_id=1"  , if  
how to fetch the record using AJAX? - Ajax
how to fetch the record using AJAX?  Can anyone tell me how to fetch the records from database using Ajax
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
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
Edit the record.
Edit the record.  sir, I have a table consist of huge data.I have... to previous edited row or edit the previous record of the previously edited...,password); String query = "select * from employee"; st = con.createStatement
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
How to refresh a jTable On adding or deleting record ....
from database and displayed in panel... Now i have to add records in the database from same panel and i want jtable to be refreshed after every addition...How to refresh a jTable On adding or deleting record ....   Hii
Database Record findById
Database Record findById   ...). This method finds data by primary key. You need the following artifacts: Database... FROM Student st"), @NamedQuery(name="updateRecord",query="UPDATE Student st
Database Record findByName
Database Record findByName     ... your conditions. You need the following artifacts: Database table: student...") @NamedQueries({ @NamedQuery(name="readAllRecords",query="SELECT st 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- delete from employee where id='35'; Thanks
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
Jsp code for disabling record.
Jsp code for disabling record.  I want a Jsp and servlet code for the mentioned scenario. Q. A cross sign appears in front of each record, click to disable the record.System marks the record as disabled.The record
Mysql Last Record
Mysql Last Record       Mysql Last Record is used to the return the record using order by  from table. Understand with Example To grasp this example
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
record management application - Java Beginners
record management application  write a small record management application for a school.Tasks will be Add record, Edit record,Delete record, List records. Each record contains: name(max 100 char), Age,Notes(No Max.Limit
Mysql Last Record
Mysql Last Record       Mysql Last Record is used to return the last records from table... an example from 'Mysql Last Record'. To understand example we create a table
J2ME Record Listener
interface with the RecordStore class for receiving Record Changed, Added, Deleted events from a record store. The Record Listener interface having the following... J2ME Record Listener      
insert rows from browsed file to sql database
insert rows from browsed file to sql database  i need to insert rows from excel to database by browsing the file in jsp. by connecting both..., content of the file has to go to database. how can i insert record into database
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
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
Select data from Table in Database
. The syntax used to retrieve the record from database are as : The insert... Select data from Table in Database   ... the selected data from table in database. The select query in the database retrieve

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.