📄 cashow.java
字号:
/*
* CAShow.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;
/**
*
* @author Administrator
*/
public class CAShow extends Action {
String UserName,PKI,LN,LK;
private final static String SHOWSUCCESS = "CAShow";
private final static String SHOWERROR = "CAShow_error";
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors=new ActionErrors();
HttpSession s=request.getSession();
//CACheckActionForm caCheckActionForm=(CACheckActionForm)form;
String username=s.getAttribute("current_user").toString();
//username=(String)((CACheckActionForm)form).getUserName();
//处理字符格式
//username=new String(username.getBytes("ISO-8859-1"),"GB2312");
String sql="select UserName,LetterNum,LetterKey from Reginfo where UserName='"+username+"'";
boolean result=false;
try{
DataStore db=DataStore.getInstance();
ResultSet rs = db.read(sql);
rs.next();
LN=rs.getString("LetterNum");
LK=rs.getString("LetterKey");
if(LN==""||LK==""){
return mapping.findForward(SHOWERROR);
}else{
s.setAttribute("UserName",username);
s.setAttribute("LN",LN);
s.setAttribute("LK",LK);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
return mapping.findForward(SHOWERROR);
}
return mapping.findForward(SHOWSUCCESS);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -