解决方案 »
- iBatis嵌套查询问题
- JSP连接Oracle的更新问题(新手请教)
- 求救啊!眼看就要毕业答辩了,设计还没搞定啊!!!!
- 上网没有查到 请指教!
- ExtJS的饼状图能不能在扇形图上写字?
- 新闻系统中的连接字符串问题(急!!!)
- 好心人,帮帮忙,jsp找不到文件的问题,谢过!
- 用JSP在form中定义一些复选框,在服务器端怎么才能知道用户是否选择了某个复选框?
- 为什么 out.println()不会换行?谢谢
- 如何让Tomcat一启动就调用Servlet的Init方法?
- 各位大神好,小弟问一个关于jsp调用mysql时间类型值得问题
- spring我配置了classpath下的路径,为什么要找WEB-INF下的路径
while (answer.hasMoreElements()) {
String name = "";
String realName = "";
String allName = "";
String departmentName = "";
String userPrincipalName = "";
SearchResult sr = null;
try {
sr = (SearchResult) answer.next();
} catch (NamingException e1) {
e1.printStackTrace();
}
if (sr == null) {
continue;
}
Attributes attrs = sr.getAttributes();
if (attrs == null) {
continue;
}
try {
System.err.println("==================");
System.out.println("getname = " + sr.getName());
for (NamingEnumeration ne = attrs.getAll(); ne.hasMore();) { Attribute attr = (Attribute) ne.next();
// 读取属性ID值
attributeID = attr.getID().toString();
// 读取属性值
for (NamingEnumeration e = attr.getAll(); e.hasMore();) {
attributeValues = e.next().toString();
} if (attributeID.equals(ADProperty.UserLogonName)) {
userPrincipalName = attributeValues;
System.err.println("======getLdapUser userPrincipalName : "+userPrincipalName);
} if (attributeID.equals(ADProperty.UserLogonName_PRE_WIN2000)) {
name = attributeValues;
System.err.println("======getLdapUser name : "+name);
} if (attributeID.equals(ADProperty.FirstName)) {
realName = attributeValues;
} if (attributeID.equals(ADProperty.Department)) {
departmentName = attributeValues;
} if (attributeID.equals(ADProperty.AllName)) {
allName = attributeValues;
}
}
} catch (NamingException e) {
e.printStackTrace();
}
if (userPrincipalName == null || userPrincipalName.length() == 0) {
System.err.println("userPrincipalName is null ??????");
continue;
}
//添加部门
departmentNameList.add(departmentName);
if (realName == null || realName.length() == 0) {
realName = allName;
}
System.out.println("=======11111111="+userPrincipalName.split("@")[0]);
name=userPrincipalName.split("@")[0];
userList.add(new User(name, allName, departmentName,User.DominUser));
}