package com.handson.dwrdemo;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
public class Service {
private List<Person> persons = new ArrayList<Person>();
{
persons.add(new Person(1, "Brady", "pass"));
persons.add(new Person(2, "Shingoo", "pass"));
persons.add(new Person(3, "Guojing Zhang", "123456"));
}
public Service() {
System.out.println("create an instance of Service.");
}
public String sayHello(String name) {
System.out.println("name:" + name);
return "Hello " + name + " !";
}
public boolean deleteById(int id) {
System.out.println("id:" + id);
return true;
}
public void test() {
System.out.println("test");
}
private void test2() {
System.out.println("test2");
}
public void test3(String name, String password, int age) {
System.out.println("name:" + name + ", password:" + password + ", age=" + age);
}
public Person findPersonById(int id) {
for(Person p : persons) {
if(p.getId() == id) {
return p;
}
}
return null;
}
public boolean addPerson(Person person) {
System.out.println("size before add:" + persons.size());
persons.add(person);
if(person != null) {
System.out.println("person.id:" + person.getId() + ", name:"
+ person.getName() + ", password:" + person.getPassword());
}
System.out.println("size after add:" + persons.size());
return true;
}
public void testRequest(int id, String name, HttpServletRequest request) {
System.out.println("id:" + id + ", name:" + name);
System.out.println("request:" + request.getRequestURI());
}
}
shingoo
- 粉丝: 0
- 资源: 6
最新资源
- java项目实战练习.zip
- java桌面小程序,主要为游戏.zip学习资料
- ember前端框架,一键部署到云开发平台.zip
- kero is a front-end model framework. - kero是一个前端模型框架,做为MVVM架构中Model层的增强,提供多维数据模型.zip
- PandaUi 是PandaX的前端框架,PandaX 是golang(go)语言微服务开发架构.zip
- v8垃圾回收机制 一篇技术分享文章
- libre后台管理系统前端,使用vue2开发.zip
- Java企业级快速开发平台 前后端分离基于nodejs+vue2+webpack+springboot.zip
- Java诊断工具.zip
- feHelper前端开发助手系统.zip开发
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈