📄 modifypopedomuseraction.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 ModifyPopedomUserAction extends Action
{
public ActionForward perform(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
System.out.println("starting ModifyPopedomUserAction......");
System.out.println("mapping.getAttribute(): = " + mapping.getAttribute());
System.out.println("mapping.getScope(): = " + mapping.getScope());
Properties dbBase = new Properties();
dbBase.setProperty("dsJndiName", Constants.ARCHIVE_DBSOURCE_KEY);
STPoolDataSet data = new STPoolDataSet();
String roleid = req.getParameter("roleid");
System.out.println("roleid=" + roleid);
int iRoleId = Integer.parseInt(roleid);
String delSql = "DELETE FROM fUserRole WHERE RoleID=" + iRoleId;
data.executeSQL(delSql, dbBase);
String[] strValues = req.getParameterValues("enterNames");
if( (strValues != null) && (strValues.length > 0) )
{
System.out.println(strValues.length);
int iLeng = strValues.length;
for(int i=0; i<iLeng; i++)
{
String addSql = "INSERT INTO fUserRole(EnterName, RoleID) VALUES('" + strValues[i] + "'," + iRoleId + ")";
data.executeSQL(addSql, dbBase);
}
}
CommonSql comsql = new CommonSql();
comsql.ToViewPopedom(form, req, iRoleId);
/**
//----------------------------------------------------------------------------------------
String sql = "SELECT EnterName,UserName FROM fUserName where EnterName IN (SELECT EnterName from fUserRole WHERE RoleID=" + iRoleId + ")";
System.out.println("begin viewPopedomAction db...");
STResultSet rs = data.getSTResult(sql, dbBase);
System.out.println("viewPopedomAction db end");
PopedomUserList users = new PopedomUserList();
while(rs!=null && rs.next())
{
User user = new User();
user.setEnterName(rs.getString("EnterName"));
user.setUserName(rs.getString("UserName"));
users.addUser(user);
}
users.setRoleid(iRoleId);
HttpSession session = req.getSession();
session.setAttribute("popedomUsers", users);
//--------为隐藏域所用------------------------
RoleUser roleuser = new RoleUser();
roleuser.setRoleid(iRoleId);
session.setAttribute("ROLEID", roleuser);
//============================================
String strRole = "";
sql = "SELECT Role FROM fRole WHERE RoleID=" + iRoleId;
rs = data.getSTResult(sql, dbBase);
while(rs!=null && rs.next())
{
strRole = rs.getString("Role");
}
session.setAttribute("role", strRole);
System.out.println(strRole);
//========================================================================================
*/
System.out.println("end ModifyPopedomUserAction......");
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -