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



Home Answers Viewqa Struts Struts2 and Hibernate Fetch Data Base Value

Have Programming Question? Ask it here!
 
 
 


Rakesh K Prajapat
Struts2 and Hibernate Fetch Data Base Value
0 Answer(s)      10 months ago
Posted in : Struts


Hello Sir,

I am facing the problem while fetching the database value on jsp page while using struts2.0 and hibernate3.0 and MySql try to help me resolve this problem and try to tell me what should i do for fetch the database value and shown on jsp page.

AdminProvideLeave Pojo Class

package mypack;

> public class AdminProvideLeave {
> 
> private static long serialVersionUID =
> 1L;
> 
> private int rpl, rcl, rsl, rel,
> serial_no, rtotal_leave;
> 
> public AdminProvideLeave() { super();
> // TODO Auto-generated constructor
> stub }
> 
> public AdminProvideLeave(int rpl, int
> rcl, int rsl, int rel, int
> rtotal_leave, int serial_no) {
> super(); this.rpl = rpl; this.rcl =
> rcl; this.rsl = rsl; this.rel = rel;
> this.serial_no= serial_no;
> this.rtotal_leave= rtotal_leave; }
> 
> public static long
> getSerialVersionUID() { return
> serialVersionUID; }
> 
> public static void
> setSerialVersionUID(long
> serialVersionUID) {
> AdminProvideLeave.serialVersionUID =
> serialVersionUID; }
> 
> public int getRpl() { return rpl; }
> 
> public void setRpl(int rpl) { this.rpl
> = rpl; }
> 
> public int getRcl() { return rcl; }
> 
> public void setRcl(int rcl) { this.rcl
> = rcl; }
> 
> public int getRsl() { return rsl; }
> 
> public void setRsl(int rsl) { this.rsl
> = rsl; }
> 
> public int getRel() { return rel; }
> 
> public void setRel(int rel) { this.rel
> = rel; } public int getSerial_no() { return serial_no; }
> 
> public void setSerial_no(int serialNo)
> { serial_no = serialNo; }
> 
> public int getRtotal_leave() { return
> rtotal_leave; }
> 
> public void setRtotal_leave(int
> rtotalLeave) { rtotal_leave =
> rtotalLeave; }
> 
> 
> }
> 
//  AdminProvidLeaveAction Class package
> mypack;
> 
> import java.util.*; import
> java.util.List;
> 
> import
> com.opensymphony.xwork2.ActionSupport;
> 
> public class AdminProvideLeaveAction
> extends ActionSupport { private static
> final long serialVersionUID= 1L;
> public AdminProvideLeave apl; public
> List<AdminProvideLeave>apllist; Dao
> dao= new Dao(); public String
> execute() {
> 
> dao.save(apl); return "success"; }
> 
> public String fetch() {
> 
> apllist=dao.fetch1(); return
> "success"; }
> 
> public AdminProvideLeave getApl() {
> return apl; }
> 
> public void setApl(AdminProvideLeave
> apl) { this.apl = apl; } public
> List<AdminProvideLeave> getApllist() {
> return apllist; }
> 
> public void
> setApllist(List<AdminProvideLeave>
> apllist) { this.apllist = apllist; }
> 
> public static long
> getSerialversionuid() { return
> serialVersionUID; }
> 
> }

// Dao Class import java.util.ArrayList;
> import java.util.List; import
> org.hibernate.HibernateException;
> import org.hibernate.Query; import
> org.hibernate.Session; import
> org.hibernate.SessionFactory; import
> org.hibernate.Transaction; import
> org.hibernate.cfg.Configuration;
> 
> public class Dao {
> 
> public void save(Object O) {
> Configuration cfg = new
> Configuration().configure();
> SessionFactory f =
> cfg.buildSessionFactory(); Session
> session = f.openSession(); Transaction
> t = session.beginTransaction();
> session.save(O); t.commit();
> session.close(); }
> 
> @SuppressWarnings("unchecked") public
> List<AdminProvideLeave>fetch1()// for
> fetch the value from database on jsp
> page {
> 
> Configuration cfg = new
> Configuration().configure();
> SessionFactory f =
> cfg.buildSessionFactory(); Session
> session = f.openSession(); Transaction
> t = session.beginTransaction();
> List<AdminProvideLeave>apllist = new
> ArrayList<AdminProvideLeave>(); try {
> Query q = session.createQuery("from
> AdminProvideLeave"); apllist =
> q.list(); } catch (HibernateException
> he) { System.out.println(he); }
> t.commit(); session.close(); return
> apllist; }
> 
> @SuppressWarnings("unchecked")// For
> insert the value in database public
> List<AdminProvideLeave> apllist() {
> Configuration cfg = new
> Configuration().configure();
> SessionFactory f =
> cfg.buildSessionFactory(); Session
> session = f.openSession();
>   Transaction t =
> session.beginTransaction();
>   List<AdminLeavePojo> adlp = null;   
>   try {       Query q =
> session.createQuery("from
> AdminProvideLeave");      adlp =
> q.list();
>           } catch (HibernateException e) {        System.out.println(e);  }
>           t.commit();     session.close();
> 
>   return adlp; } }
// ----------------
> 
> Struts.xml  <action
> name="adminaddleave"
> class="mypack.AdminProvideLeaveAction"
> method="execute"> <result
> name="success">welcome2.jsp</result>
> <result name="success"
type="redirect">fetch</result>
</action> 
<action name="fetch" class="mypack.AdminProvideLeaveAction"
method="fetch"> <result name="success">viewleave.jsp</result>

// ViewLeave.jsp align="center">

<s:form theme="simple" method="post" name="rempleave">
<s:label>Employee Remaining Leave:</s:label>
<table border="" align="center" style="margin-top: 28px">
<s:iterator value ="apllist" var="empleave">
<tr>
<td>
<s:property value="rcl"/>
</td>
</tr>
</s:iterator>
<!--
<tr style="height: 40px">
<td style="width: 200px; text-align: center">
<b>Leave Type</b>
</td>
<td style="width: 100px; text-align: center">
<b>Leave</b>
</td>
</tr>
-->
<tr style="height: 40px">
<td style="width: 200px; text-align: center">
RPL
</td>
<td id="pl" style="text-align: center" name="rpl">
</td>
</tr>
<tr style="height: 40px">
<td style="width: 200px; text-align: center">
RCL
</td>
<td id="cl" style="text-align: center" name="rcl">
</td>
</tr>
<tr style="height: 40px">
<td style="width: 200px; text-align: center">
RSL
</td>
<td id="sl" style="text-align: center" name="rsl">                              
</td>
</tr>
<tr style="height: 40px">
<td style="width: 200px; text-align: center">
REL
</td>
<td id="el" style="text-align: center" name="rel">

</td>
</tr>
<tr style="height: 40px">
<td style="width: 200px; text-align: center">
RLWP
</td>
<td id="lwp" style="text-align: center" name= "rlwp">       
</td>
</tr>
<tr style="height: 40px">
<td style="width: 200px; text-align: center"> <input type="button" value="R Leave" onclick=Total();
</td>
<td id="total" style="text-align: center">
</td>
</table>
</s:form>`print("code sample");

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Struts2 and Hibernate Fetch Data Base Value
Struts2 and Hibernate Fetch Data Base Value  Hello Sir, I am... me what should i do for fetch the database value and shown on jsp page...") public > List<AdminProvideLeave>fetch1()// for > fetch the value from
Struts2 and Hibernate Fetch Data Base Value
Struts2 and Hibernate Fetch Data Base Value  Hello Sir, I am... me what should i do for fetch the database value and shown on jsp page...") public > List<AdminProvideLeave>fetch1()// for > fetch the value from
Advertisements
Struts2 and Hibernate
Struts2 and Hibernate  how to fetch database value from one page to another page in struts2 and hibernate
insert excel value in to oracle data base
insert excel value in to oracle data base  Hi All I am using this code for saving excel value to oracle database table. code is working properly but in table i am geting some diffrent type value like... o
Data fetch from multiple SQL tables - Hibernate
Data fetch from multiple SQL tables   I am in the process of writing my first hibernate application. I have a sql query that fetches data from multiple tables using left and right outer joins. I need to convert this JDBC data
how to fetch data fron facebbok using spring batch and hibernate ?
how to fetch data fron facebbok using spring batch and hibernate ?  how to fetch data from facebbok using spring batch and hibernate ? Means i have... details of data to local database and fetch all details if data
Struts2 and Hibernate
Struts2 and Hibernate  Sir/ madam, Can we use iterator tag in struts for fetch the database value and shown on form. if yes then how
data base
data base  how to connect coding in data base ?   The given code connects JSP page to database. You need to import the mysql connection jar file to jdk as well as to the lib of tomcat. Moreover you need to set classpath
DATA BASE
DATA BASE  Create a program to establish a connection to the PCTBC... the data using a J Table.   Here is a code that connects to MySql... main(String[] args) { Vector columnNames = new Vector(); Vector data = new Vector
how read excel data into database using struts2 with hibernate
how read excel data into database using struts2 with hibernate   hi friends, i am venkat i am started learning struts 2, please help me how to read excel data into database using struts2 with hibernate, please show me
Struts2 and Hibernate
Struts2 and Hibernate   I have a simple application in Struts2 and Hibernate which have simple form for entering contact information and after... it data saved and comes to the JSP. But initially No data shows. Please help me as i
Struts2 and Hibernate
Struts2 and Hibernate   I have a simple application in Struts2 and Hibernate which have simple form for entering contact information and after... database on to the JSP page when it initially loads. After Submitting it data
Struts2 and Hibernate
Struts2 and Hibernate  Hello Sir, I am trying to fetch database value from one page to another page. Means i am submiting the form value in database but i want to display that submit database value in another page while
SQL fetch value
SQL fetch value  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M
STRUTS2 Dynamic data is not updated
STRUTS2 Dynamic data is not updated  Hi All, I am new in struts and try to make an application in struts2. Need help on dynamic data content. In application i am tried to fetch data and save in variable and use set & get
STRUTS2 Dynamic data is not updated
STRUTS2 Dynamic data is not updated  Hi All, I am new in struts and try to make an application in struts2. Need help on dynamic data content. In application i am tried to fetch data and save in variable and use set & get
Integrate Hibernate to struts2.
Integrate Hibernate to struts2.  How to Integrate Struts Hibernate
Data base Connectivity
Data base Connectivity  How to configure JDBC connection for Oracle data base.In configuring it is asking select Data server name and TNS.I typed Oracle for Data Server Name and IN TNS what to type? I pulled the list for TNS
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.  <html> <...="Submit" value="Submit"></td> </tr> </table>
data insertion and fetch 1
data insertion and fetch 1  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <...; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ insert int data base @@@@@@@@@ import...;Gender</b><input type="radio" name="sex" value="male">Male
JSP data base validation
JSP data base validation  please explain how to validate form input string with database n also how its notify that entered data exists already...;td><input type="submit" value="submit"/></td> </tr> <
Hibernate Criteria Fetch Size Example
Hibernate Criteria Fetch Size Example  I want example of Hibernate Criteria Fetch Size. Share me the best example program and tutorial of Hibernate Criteria Fetch Size. Thanks   Best Example of Hibernate Criteria Fetch
Data base related question
Data base related question  sir my table has only one element(that is pno),i am using ms-access as backend. i put only one element i want to retrieve that element .how can i retrieve that element,using jdbc technology. please
Struts2 Spring Hibernate integration
Struts2 Spring Hibernate integration  How to integrate Struts2 Spring2.5 and Hibernate3 in a web application project?Could anyone give some example
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
how to fetch data from servlet ????
how to fetch data from servlet ????  how to fetch data from servlet
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
struts2+hibernate - Struts
struts2+hibernate  How to use hibernate 3 with struts 2 application? kindly reply with example
Data base - JDBC
Data base  I want to do this Inserting a record with Object type column using PreparedStatement but wht should b the column datatype this is te..."); con.close(); }//main }//class For this should i create a user defined data type
Hibernate Criteria Fetch Size
Hibernate Criteria Fetch Size Please consider the fetchSize example of hibernate criteria API CriteriaFetchSize.java package net.roseindia.main; import... as shown below: Hibernate: select this_.roll_no as roll1_0
struts2 with hibernate - Spring
struts2 with hibernate  hi can i use struts2 with spring i am a new user of spring please send me some tutorials of spring  Hi friend, I am sending you a link. This link will help you. Please visit for more
how to prepopulate data in struts2 - Struts
how to prepopulate data in struts2  I wanted to show the data from database using Struts 2
please send me the banking data base in swings
please send me the banking data base in swings  sir, please send me how to create the banking data base program in swings
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
for store data in data base - JSP-Servlet
for store data in data base  i want to a job site, in this site user can registered by a form.. in this form there are his information... i use..... and on 3rd form i use submit button... data of form 1 and 2 can also be store
Hibernate criteria example using struts2
Hibernate criteria example using struts2 This hibernate criteria example using struts2 is used for defining the basics of criteria. The hibernate criteria... create query without HQL. In this hibernate criteria example using struts2, we
Fetch the data from mysql and display it on php form
Fetch the data from mysql and display it on php form  when i press on login button, after succesful login the related data of that person should be display in other textbox
fetch data from ms acces - Swing AWT
fetch data from ms acces  How do i fetch back AUTO generated key from MS ACCESS table after inserting data through the java panel.... Please Help...(); ResultSet rs=st.executeQuery("select * from data "); while(rs.next
Retrive the data from the table in data base using jdbc
Retrive the data from the table in data base using jdbc  Retrive the data from the table in data base using jdbc   JDBC Tutorials
data base question - Java Interview Questions
data base question  first we create a table with out create primary kay,after that i want to create same record with primary key,but no duplicate record,no deletion and after creation.  Hi, Query to create
how to get time picker value in javascript of struts2
how to get time picker value in javascript of struts2  I am not able to get value of time picker in java script . my code is jsp java script var totime=dojo.widget.byId("totime").getValue(); how to get value please help me
Select tag to fetch data from oracle database
Select tag to fetch data from oracle database  I created a select box having more than one menus in the select box such as regnno, address and name of a student and when regnno is selected from the drop down list by a user
Fetch the data using jsp standard action
Fetch the data using jsp standard action  I want the code of fetch the data from the database & show in a jsp page using jsp:usebean in MVC model... that retrieves the data from the database through java bean and display it in jsp page
Online Cab Booking using Java (Struts2+Hibernate)
Online Cab Booking using Java (Struts2+Hibernate)  hi anyone send me the online cab booking(cab booking and canceling)using java+Struts2 its for my interview can u send as soon as possible.. thank u :) Surya
java code for threading example for connecting data base
java code for threading example for connecting data base  Write a program that has two threads First thread queries the database and fetches all the employee records from the emp table. Stores the employee objects
when refreshing the page the data is stored in data base again
when refreshing the page the data is stored in data base again  Hi, In my application, I am adding form data in database on click of submit button.But the problem is, when user refreshes the page, the data added one more time
retrive data from data base and print it in every page until logout
retrive data from data base and print it in every page until logout  suppose that a user login your website through user name & password. now after completion of login he goto home page.inside home page i want to print
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one combo box is there and another filed is version of the server(like 1.0,2.0) like
data fecth from data base in( sql 2000) htmlform and jsp
data fecth from data base in( sql 2000) htmlform and jsp  hi iam using jsp and html form data fecth from database display the textbox help me i... () { var value = $('#projectname').val(); var vv=$("#projectid
how to know which jList is selected and according to that fetch the value
is selected) to fetch data from database using selected employee id from selected...how to know which jList is selected and according to that fetch the value ... , jList4) in 4 different tabs in frame. Each List has the value of employee_id
 

 

 

DMCA.com