* List 형식으로 넘기기
- controller
HashMap<String, String> data = new HashMap<String, String>();
List<HashMap<String, String>> login = new ArrayList<HashMap<String, String>>();
data.put("id", "namju");
data.put("password", "1234");
login.add(data);
return new ModelAndView( "logins/login", "login", login);
- jsp page
<c:forEach items="${login}" var="login">
${login.id}<br>
${login.password}<br>
</c:forEach>
* domain 객체에 값을 설정하여 넘기기
- domain
package kr.actsoft.dlms.login.domain;
import java.util.List;
import kr.actframeworks.commons.BaseObject;
public class Login extends BaseObject {
private String id;
private String password;
public Login() {
super();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
- controller
Login login = new Login();
login.setId("namju");
login.setPassword("1234");
return new ModelAndView( "logins/login", "login", login);
- jsp page
${login.id}<br>
${login.password}<br>
* domain 객체에 String, List 객체를 넣어서 값 넘기기
- domain
package kr.actsoft.dlms.login.domain;
import java.util.List;
import kr.actframeworks.commons.BaseObject;
public class Login extends BaseObject {
private String id;
private String password;
private List list;
public Login() {
super();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void setList(List list) {
this.list = list;
}
public List getList() {
return list;
}
}
- controller
Login login = new Login();
login.setId("namju");
login.setPassword("1234");
HashMap<String, String> data = new HashMap<String, String>();
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
data.put("id", "namju");
data.put("password", "9994");
list.add(data);
login.setList(list);
- jsp page
${login.id}<br>
${login.password}<br>
<c:forEach items="${login.list}" var="list">
${list.id}<br>
${list.password}<br>
</c:forEach>
'programming > spring_framework' 카테고리의 다른 글
Spring Framework 구조도 (0) | 2012.03.21 |
---|---|
‘/home.html’ 에 대한 요청 처리 과정 (0) | 2012.03.21 |
MyEclipse에서 Spring Beans Graph로 보기 (0) | 2012.03.21 |
MyEclipse를 이용하여 Spring Project 적용하기 (0) | 2012.03.21 |
ANT를 이용한 테이블 생성 (0) | 2012.03.21 |