📄 adminindex.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.guestbook.action.admin;
import java.util.*;
import com.guestbook.sys.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.guestbook.sys.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
import java.sql.*;
import org.apache.commons.logging.*;
/**
* MyEclipse Struts
* Creation date: 09-21-2007
*
* XDoclet definition:
* @struts.action scope="request" validate="true"
*/
public class adminindex extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
if( request.getSession().getAttribute( "loginSuccess" ) == null )
{
return mapping.findForward( "notLogin" );
}
try
{
request.setAttribute( "dynamicParameter", SysInfo.getInstance().getDynamicParameter() );
request.setAttribute("adminInfo", getTable() );
//request.setAttribute("notes", hashtable );
}catch(Exception ex){
logger.error(" equest.setAttribute(\"adminindex\", adminindex() ERROR!");
logger.error(ex.getMessage());
}
return mapping.findForward("/admin/adminindex");
}
//获得管理员列表
private Hashtable getTable(){
Hashtable tables=new Hashtable();
try
{
logger.error(" start !");
Connection con=DataBaseConnection.getConnection();
CallableStatement cstm=con.prepareCall("{call pkg_guestadmin.p_getadmininfo(?)}");
cstm.registerOutParameter(1,OracleTypes.CURSOR);
cstm.execute();
ResultSet rs=((OracleCallableStatement) cstm).getCursor(1);
if(rs.next()){
tables.put("id", rs.getInt(1));
tables.put("name", rs.getString(2));
}
cstm.close();
con.close();
}
catch(Exception ex){
logger.error("\n Get Admininfo ERROR!\n");
logger.error(ex.getMessage());
}
return tables;
}
private static Log logger=LogFactory.getLog(adminindex.class);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -