ActFramework是一种简洁易用,具有强大表达力的Java MVC全栈框架:
csrf=true
一个返回HelloWorld的请求处理器(演示视频 : 7分钟):
@GetAction("/hello") public String sayHello() { return "Hello World!" }
7分钟):
package demo.helloworld;
import act.controller.Controller; import act.db.morphia.MorphiaAdaptiveRecord; import act.db.morphia.MorphiaDao; import org.mongodb.morphia.annotations.Entity; import org.osgl.mvc.annotation.*;
import java.util.Map;
import static act.controller.Controller.Util.notFoundIfNull;
@Entity(“user”) public class User extends MorphiaAdaptiveRecord {
@Controller("user") public static class Service extends MorphiaDao { @PostAction public User create(User user) { return save(user); } @GetAction public Iterable list() { return findAll(); } @GetAction("{id}") public User show(String id, Map data) { return findById(id); } @PutAction("{id}") public User update(String id, Map data) { User user = findById(id); notFoundIfNull(user); user.mergeValues(data); return save(user); } @DeleteAction("{id}") public void delete(String id) { deleteById(id); } }
}
联系方式:
QQ 群: 283919975