广西信息安全学会 2008-05-28
一直以来一直存在这样的疑问,作为成员变量,Action中的dao是否存在线程安全的问题,多线程同时访问是否存在安全性问题呢,path是否也存在线程安全问题呢
public class UserManagerAction extends Action { private UserDAO dao = new UserDAO(); private String path = ""; @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { path = request.getParameter("path"); String forward = "success"; if("add".equals(path)){ //业务代码.... } return mapping.findForward(forward); } }