tapestry5.0 下载本文

org.springframework.web.context.ContextLoaderListener

4.applicationContext.xml

xsi:schemaLocation=\

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd\ default-lazy-init=\

class=\nFactoryBean\

classpath:/**/*.hbm.xml

com.logcd.myapp.models.User

com.logcd.myapp.models

key=\

key=\

5.User类

package com.logcd.myapp.models;

import java.io.Serializable;

import javax.persistence.Column;

import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table;

import javax.persistence.Entity;

import org.apache.tapestry5.beaneditor.NonVisual; import org.apache.tapestry5.beaneditor.Validate;

@Entity

@Table(name = \

public class User implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @NonVisual

private Long id; private String userName; private String emailAddress; public User(){} @Column(name = \ public Long getId() { return id; } @SuppressWarnings(\ private void setId(Long id) { this.id = id; } @Column(name = \ public String getUserName() { return userName; } @Validate(value = \ public void setUserName(String userName) { this.userName = userName; } @Column(name = \ public String getEmailAddress() { return emailAddress; } @Validate(value = \ public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } }

6.页面java文件

package com.logcd.tapestry5.myapp.pages.user;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;

import com.logcd.myapp.dao.UserDao; import com.logcd.myapp.models.User;

public class CreateUser { private User user; @Inject

private UserDao userDAO; public CreateUser(){} public void setUser(User user) { this.user = user; } public User getUser() { return user; } Object onSuccess() { userDAO.save(user);

return CreateUser.class; } public List getUsers() { return userDAO.getAllUsers(); } }

? ? ? ? ?

09:49

浏览 (371)

论坛浏览 (1254) 评论 (3)

分类: Tapestry/Wicket/JSF2

2008-11-05 缩略显示

重定义wicket分页组件PagingNavigator