컨벤션 플러그인 Struts2로 응용 프로그램을 실행하려고했습니다. 응용 프로그램은 다음과 같이 구성 struts.xml
으로 괜찮다고 : struts2 규약 플러그인이 제대로 작동하지 않습니다.
<struts>
<package name="struts2demo" extends="struts-default">
<action name="hey" class="action.CountryAction" method="get">
<result name="success">/index.jsp</result>
</action>
<action name="add" class="action.CountryAction" method="add">
<result type="redirect" name="success">hey</result>
</action>
<!-- Add your actions here -->
</package>
</struts>
가 지금은
struts.xml
것을 제거하고이 같은 일부 주석 추가 :
@Namespace("/")
@ResultPath(value="/")
public class CountryAction extends ActionSupport implements ModelDriven<Country>{
private List<Country> worldCountry;
private Country country = new Country();
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
// HttpServletRequest request;
@Action(value="/hey",results={@Result(name="success",location="/index.jsp")})
public String get() throws SQLException
{
CountryService cs = new CountryService();
setWorldCountry(cs.getCountry());
// System.out.println(getWorldCountry());
return SUCCESS;
}
public List<Country> getWorldCountry() {
return worldCountry;
}
public void setWorldCountry(List<Country> worldCountry) {
this.worldCountry = worldCountry;
}
@Override
public Country getModel() {
return country;
}
}
하지만 응용 프로그램을 실행하려고 할 때 내가 다음 무엇입니까를 오류 :
메시지 :
There is no Action mapped for namespace [/] and action name [hey] associated with context path [/JustStruts2].
내가 잘못하고있는 중이 야
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts.devMode</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
는, 어떤 도움이 이해할 수있을 것이다 :
내 web.xml
이있다.
감사합니다.
asm-commons.jar 이것을 해결하려면 – Aadam