将Netbeans与Java EE和JSP一起使用时遇到问题。
我有一个登录表单,当我登录后,我转发到页面LoginSucessful.jsp
。我有另一页(ListeArticleInventaire.jsp
),其中列出了我的文章。
我的问题是:
我想将我的ListeArticleInventaire.jsp
链接到我的java类ListeArticleAction.jsp
,以便在请求页面时执行java类。
我的struts-config.xml:
<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
<action input="/loginForm.jsp" name="UserLoginActionForm" path="/login" scope="session" type="com.myapp.struts.UserLoginAction">
<forward name="success" path="/displayList.do"/>
<!-- <forward name="success" path="/displayList.do"/> -->
</action>
<action input="/ListeArticleInventaire.jsp" name="listArticle" path="/displayList" scope="session" type="com.myapp.struts.ListeArticleAction">
<forward name="display" path="/ListeArticleInventaire.jsp"/>
</action>
<action forward="/loginOut.jsp" path="/logout"/>
ListeArticleAction.java:
public class ListeArticleAction extends org.apache.struts.action.Action {
/* forward name="success" path="" */
private static final String DISPLAY = "display";
/**
* This is the action called from the Struts framework.
*
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
*/
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
System.out.println("it works!");
return mapping.findForward(DISPLAY);
}
}
问题仅在于链接。当我的ListeArticleInventaire
被请求时,我看不到输出结果!#39;这意味着该类没有被调用。