최근에 Struts2 UI 태그에 대한 튜토리얼을 살펴 보겠습니다. 그래서, 나는 그 예를 발견하고 완벽하게 그것을 실행합니다.Struts2 구성 이해하기
그러나 struts.xml 구성 파일에서 일부 OGNL 표현식을 이해할 수 없었습니다. 여기 쓰고 난 것이이 RegisterAction.java로 리디렉션 등) (내 수업의 방법을 채우는 실행 그래서 여기
<struts>
<package name="default" extends="struts-default">
<action name="*Register" method="{1}" class="nirmal.RegisterAction">
<result name="populate">/register.jsp</result>
<result name="input">/register.jsp</result>
<result name="success">/success.jsp</result>
</action>
</package>
</struts>
내가 다음 예와 같이, index.jsp가에서 populateRegier에 하나 개의 요청을 채우는 오전 :
RegisterAction.java
package nirmal;
import java.util.ArrayList;
import com.opensymphony.xwork2.ActionSupport;
public class RegisterAction extends ActionSupport {
private String userName;
private String password;
private String gender;
private String about;
private String country;
private ArrayList<Country> countryList;
private String[] community;
private ArrayList<String> communityList;
private Boolean mailingList;
public String populate() {
countryList = new ArrayList<Country>();
countryList.add(new Country(1, "India"));
countryList.add(new Country(2, "USA"));
countryList.add(new Country(3, "France"));
communityList = new ArrayList<String>();
communityList.add("Java");
communityList.add(".Net");
communityList.add("SOA");
community = new String[]{"Java",".Net"};
mailingList = true;
return "populate";
}
public String execute() {
return SUCCESS;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getAbout() {
return about;
}
public void setAbout(String about) {
this.about = about;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public ArrayList<Country> getCountryList() {
return countryList;
}
public void setCountryList(ArrayList<Country> countryList) {
this.countryList = countryList;
}
public String[] getCommunity() {
return community;
}
public void setCommunity(String[] community) {
this.community = community;
}
public ArrayList<String> getCommunityList() {
return communityList;
}
public void setCommunityList(ArrayList<String> communityList) {
this.communityList = communityList;
}
public Boolean getMailingList() {
return mailingList;
}
public void setMailingList(Boolean mailingList) {
this.mailingList = mailingList;
}
}
첫 번째 질문 : 여기() 메소드를 채울 exeucting 왜 나는 이해할 수 없었다?
두 번째 질문 : struts2.xml에서 method="{1}"
의 의미는 무엇입니까?
미리 감사드립니다 ...
명확한 설명을주십시오 – SMS