Struts2 and Hibernate Fetch Data Base Value

Struts2 and Hibernate Fetch Data Base Value

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");
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
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 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 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
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 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
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
Integrate Hibernate to struts2.
Integrate Hibernate to struts2.  How to Integrate Struts Hibernate
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
struts2+hibernate - Struts
struts2+hibernate  How to use hibernate 3 with struts 2 application? kindly reply with example
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
how to prepopulate data in struts2 - Struts
how to prepopulate data in struts2  I wanted to show the data from database using Struts 2
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 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
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 fetch data from servlet ????
how to fetch data from servlet ????  how to fetch data from servlet
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
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
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
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 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
File Upload in struts2 - Invalid field value for field
File Upload in struts2 - Invalid field value for field   Hi I am... : Invalid field value for field "upload". My webContents->Web-Inf->lib... value for field "upload". on jsp page but not in console Please guide I am stuck
Access value of array using OGNL in struts2.
Access value of array using OGNL in struts2. Here, you will see how to access value of  array in struts2 using OGNL.  1-index.jsp <%@taglib... value="name.size"/><br/> <p> access data of list
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
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 to store and retrieve image using struts2 and hibernate integration
how to store and retrieve image using struts2 and hibernate integration  how to store and retrieve image using struts2 and hibernate integration? plz help !! thanks in advance
struts2
struts2  how to read properties file in jsp of struts2   Hi, You can use the Properties class of Java in your action class.ADS... + " : " + p); Read complete example at Read the Key-Value of Property File in Java
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
Multi value data - JDBC
Multi value data  Hello, please help,how do i use Multi-value data with mysql database. thank you  Hi friend, Plz explain your problem in details what you want and visit to : http://www.roseindia.net/jdbc/jdbc
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
struts2  sir.... i am doing one struts2 application and i have to make pagination in struts2....how can i do
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
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
HQL Query in execute method of Struts2
HQL Query in execute method of Struts2  I am making login page in struts2 and using hibernate . Now I wants to pull user name and password from database and match the login password given by user. But I am not able to fetch
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> <
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
struts2
struts2  dear deepak sir plz give the struts 2 examples using applicationresources.properties file
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
Multi-value data - JDBC
Multi-value data  hey! actually am supposed to create this database that allows multi-value data.its supposedly going to become a very large database.only i dont know just how to begin creating it.what i need is mysql syntax
struts2
struts2  hi all i am going to run struts2.x program i got this error when server started java.lang.RuntimeException...: Struts2 Tutorials
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
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
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

Ads