spring2.5 Demo

http://code.google.com/p/springside/  spring学习网

 

两种显示方式:spring2.5---petstore   (2)struts1.2---action

PetStoreFacade 类的使用,很有用,以及BaseAction extends Action

public abstract class BaseAction extends Action {

  private PetStoreFacade petStore;

 public void setServlet(ActionServlet actionServlet) {
  super.setServlet(actionServlet);
  if (actionServlet != null) {
   ServletContext servletContext = actionServlet.getServletContext();
   WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
   this.petStore = (PetStoreFacade) wac.getBean("petStore");
  }
 }

 protected PetStoreFacade getPetStore() {
  return petStore;
 }

}

非常有用。

 

以及PetStoreImpl

public class PetStoreImpl implements PetStoreFacade, OrderService {

 private AccountDao accountDao;

 private CategoryDao categoryDao;

 private ProductDao productDao;

 private ItemDao itemDao;

 private OrderDao orderDao;

.....}

可以借鉴,是与多个表的操作有关。

public class SqlMapOrderDao extends SqlMapClientDaoSupport implements OrderDao {

  private SqlMapSequenceDao sequenceDao;

。。}

可以获取一个id.

 自已对这个Demo的看法:

    用到了对角色的控制,以及Action的继承。一个字牛。BaseAction ,SecureBaseAction对安全的控制。

    用到了抽象方法。使我对抽象方法加深了解。还有struts-config.xml中的global-forwards的使用。

 

 

------------------------

Error creating bean with name 'UserDAO' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/l?????

 包有重复的,版本不同。asm.jar

你可能感兴趣的:(spring,Hibernate,bean,xml,struts)