📄 usermanageaction.java
字号:
package com.stsc.archive.manage;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import java.util.Properties;
import org.apache.struts.util.MessageResources;
import com.stsc.util.STPoolDataSet;
import com.stsc.util.STResultSet;
public final class UserManageAction extends Action
{
/**
@param mapping The ActionMapping used to select this instance
@param form The optional ActionForm bean for this request (if any)
@param req The non-HTTP request we are processing
@param res The non-HTTP response we are creating
@return Return an ActionForward instance describing where and how
control should be forwarded, or null if the response has already
been completed.
*/
public ActionForward perform(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
if(!Constants.hasPopedom(req, 1))
{
System.out.println("不能进入:你没有系统管理员这个权限!");
return mapping.findForward("newWelcome");
}
System.out.println("Start perform(" + form + ") . . ." );
Properties dbBase = new Properties();
dbBase.setProperty("dsJndiName", Constants.ARCHIVE_DBSOURCE_KEY);
STPoolDataSet data = new STPoolDataSet();
String[] strValues = req.getParameterValues("enterName");
if( (strValues != null) && (strValues.length > 0) )
{
String delSql = "DELETE FROM fUserName WHERE EnterName='" + strValues[0] + "'";
String popedomSql = "DELETE FROM fUserRole WHERE EnterName='" + strValues[0] + "'";
System.out.println(strValues[0]);
int iLeng = strValues.length;
for(int i=1; i<iLeng; i++)
{
delSql += " OR EnterName='" + strValues[i] + "'";
popedomSql += " OR EnterName='" + strValues[i] + "'";
System.out.println(strValues[i]);
}
data.executeSQL(delSql, dbBase);
data.executeSQL(popedomSql, dbBase);
}
CommonSql comsql = new CommonSql();
comsql.ToUserManager(form, req);
/**
String sql = "SELECT * FROM fUserName ORDER BY EnterName";
STResultSet rs = data.getSTResult(sql, dbBase);
UserList userList = new UserList();
while(rs!=null && rs.next())
{
User user = new User();
user.setEnterName(rs.getString("EnterName"));
user.setUserName(rs.getString("UserName"));
user.setDepartment(rs.getString("Department"));
userList.addUser(user);
}
// Save our logged-in user in the session
HttpSession session = req.getSession();
session.setAttribute(Constants.USER_MANAGE_KEY, userList);
// Remove the obsolete form bean
if (mapping.getAttribute() != null)
{
if ("request".equals(mapping.getScope()))
req.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}
*/
return mapping.findForward("userManage");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -