public class MyAnimalList{
private Animal[] animals = new Animal[5];
private int nextIndex = 0;
public void add(Animal a){
animals[nextIndex] = a;
nextIndex++;
}
}
public class AnimalTestDrive{
public static void main(String [] args){
MyAnimalList list = new MyAnimalList();
Dog a = new Dog();
Cat c = new Cat();
list.add(a);
list.add(c);
}
}
=======================================================================================
public class User
{
private String[] user;
public void setUser(String[] user)
{
this.user=user;
}
public String[] getUser()
{
return this.user;
}
}
when i submit the form can i get all values of user in the form of String[] wthout doing anything
controller
***********
public ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object cmd,
BindException errors) throws Exception {
User myObjectVO = (User) cmd;
}
===============================
public class CupidUser {
private String userName;
private String firstName;
private String lastName;
private String employeeId;
private String email;
private String role;
private String[] branches;
public String[] getBranches() {
return this.branches;
}
public void setBranches(String[] branches) {
this.branches = branches;
}
'나 어제 배웠다 > JAVA[Tip]' 카테고리의 다른 글
정규식 표현 (0) | 2015.12.07 |
---|---|
StringTokenizer (0) | 2015.06.04 |
iBatis IN 구문 구현 방법 (0) | 2010.12.07 |
예외 처리(Exception) (0) | 2010.11.26 |
Exception in finally Test (0) | 2010.08.30 |