⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 caview.java

📁 是一个用VB编写得银行ATM机交易的程序
💻 JAVA
字号:
/*
 * CAView.java
 *
 * Created on 2008年2月22日, 下午5:50
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package BankCheck.bean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import com.mysql.jdbc.Driver;
import java.sql.*;
import java.sql.ResultSet;
import com.myapp.struts.DataStore;
import BankCheck.bean.CACheckActionForm;

public class CAView extends Action { 
 String UserName,PKI,email;
 int CardState;
 private final static String VIEWSUCCESS = "CAView"; 
  private final static String VIEWERROR = "CAView_error"; 
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        ActionErrors errors=new ActionErrors();
        HttpSession s=request.getSession();
        String username=s.getAttribute("current_user").toString();  
        String sql="select ui.UserName,ui.email,ui.PKI,ci.CardState from Reginfo ui,Cardinfo ci where (ui.UserName='"+username+"' or ui.UCardID='"+username+"') and ui.UserName=ci.UserName";
        boolean result=false;
        try{
            DataStore db=DataStore.getInstance();
            ResultSet rs = db.read(sql);  
            rs.next();   
            email=rs.getString("email");
            PKI=rs.getString("PKI");
            s.setAttribute("UserName",username);                                             
            s.setAttribute("PKI",PKI); 
            s.setAttribute("email",email); 
             CardState=rs.getInt("CardState");  
               if(CardState==0||CardState==1||CardState==4)
                 {
                   return mapping.findForward(VIEWERROR);  
                 }      
                 else if(CardState==2)
                 {
                     s.setAttribute("CardState","有效");
                 }
                 else if(CardState==3)
                 {
                     s.setAttribute("CardState","冻结");
                 }               
        }                
     catch(Exception e)
        {
            e.printStackTrace();
           return mapping.findForward(VIEWERROR);
        }
      return mapping.findForward(VIEWSUCCESS);        
    }
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -