struts2, jsp 및 표준 서블릿으로 작성된 간단한 웹 응용 프로그램을 업데이트하려고합니다. URL을 특정 작업으로 리디렉션하려고하지만 올바르게 작동하지 않는 것처럼 보입니다. 예를 들어, 올바른 URL이 : 여기 struts 액션 및 리디렉션 문제가 있습니다.
http://localhost:8080/theapp/lookup/search.action
내 web.xml에 있습니다 :
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration
2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
: 여기
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>
<display-name>theapp</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
그리고 나의 struts.xml입니다
지수
<default-action-ref name="search" />
<action name="search" method="search" class="com.theapp.SearchAction" >
<result>index.jsp</result>
<result name="input" >index.jsp</result>
<result name="error" type="redirect">site_locator_mobile/error.action</result>
</action>
여기서 문제는 내가 위에서 올바른 URL을 지정하지 않은 경우, 나는 단지의 index.jsp 파일을 얻을 수 있다는 것입니다하지만 없이 속성. jsp는 정보가 서블릿에 포함되어 있기 때문에 처리됩니다.
누군가가 방금 입력 한 경우입니다 싶습니다 무엇 :
http://localhost:8080/theapp/lookup/
그들로 이동하는 것보다 :
http://localhost:8080/theapp/lookup/search.action
감사
음 .. 같은 코드 블록에 모두 있기 때문에 위의 게시물에서 xml을 수정하는 방법을 잘 모르겠습니다. – Casey