Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.srijit.finasoft.customer;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpSession;
- import org.apache.struts2.interceptor.ServletRequestAware;
- import com.opensymphony.xwork2.ActionSupport;
- import com.srijit.finasoft.dao.*;
- import java.sql.*;
- import java.util.ArrayList;
- import java.util.ListIterator;
- public class ACSummary extends ActionSupport implements ServletRequestAware{
- Connection con;
- int cid;
- ArrayList<ACModel> al=new ArrayList();
- public ArrayList getAl() {
- return al;
- }
- public void setAl(ArrayList al) {
- this.al = al;
- }
- public int getCid() {
- return cid;
- }
- public void setCid(int cid) {
- this.cid = cid;
- }
- public void setServletRequest(HttpServletRequest request)
- {
- HttpSession session=request.getSession();
- if (session.getAttribute("custid")!=null)
- {
- cid=(int) session.getAttribute("custid");
- }
- }
- public String execute()
- {
- if(cid!=0)
- {
- try {
- con=DBCon.getCon();
- PreparedStatement ps=con.prepareStatement("select a.acno,cd.fname,cd.lname,b.bname,a.acbal from custdetails cd,custac a,custacdetails d,branch_details b where d.custid=? and a.acno=d.acno and d.custid=cd.custid and a.branchid=b.bid");
- ps.setInt(1, cid);
- ResultSet rs=ps.executeQuery();
- while(rs.next()){
- ACModel obj = new ACModel();
- obj.setAcno(rs.getLong(1));
- obj.setAcname(rs.getString(2)+" "+rs.getString(3) );
- obj.setBranch(rs.getString(4));
- obj.setAcbal(rs.getDouble(5));
- al.add(obj);
- }
- }
- catch(Exception e){e.printStackTrace();}
- return "success";
- }
- else
- {
- return LOGIN;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement