User.java.svn-base
资源名称:cindyblog.rar [点击查看]
上传用户:cdpainuo
上传日期:2022-07-12
资源大小:5257k
文件大小:1k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.appspot.cindyblog.common;
- import java.io.File;
- import org.dom4j.Document;
- import org.dom4j.DocumentException;
- import org.dom4j.Element;
- import org.dom4j.io.SAXReader;
- public class User {
- private String username = null;
- private String password = null;
- public static User user = null;
- private User(){
- try {
- Document document = new SAXReader().read(new File("WEB-INF/userinfo.xml"));
- Element root = document.getRootElement();
- this.username = root.selectSingleNode("username").getStringValue();
- this.password = root.selectSingleNode("password").getStringValue();
- } catch (DocumentException e) {
- e.printStackTrace();
- }
- }
- public String getUsername() {
- return username;
- }
- public String getPassword() {
- return password;
- }
- public static synchronized User getUser() {
- if(user == null){
- user = new User();
- }
- return user;
- }
- }