我想从Hyperlink导航到JSP页面点击Stucts flow: 从My Jsp Page调用Struts Config文件到超链接:
<a href="userAction.do?page=user">User Creation</a><br />
在Struts-config.xml中: 我将我的动作类映射如下:
<action-mappings>
<action name="loginForm" path="/login" scope="request" type="com.soc.app.login.action.LoginAction" validate="false" parameter="page">
<forward name="failure" path="/jsp/index.jsp" />
<forward name="sessionexpired" path="/jsp/error.jsp" />
<forward name="success" path="/jsp/home.jsp" redirect="false"/>
</action>
<action path="/userAction" type="com.soc.app.users.action.userAction" scope="request" parameter="page" validate="false">
<forward name="user" path="user"/>
</action>
userAction类:
public userAction()
{
System.out.println("inside userAction !!!!!!!!!!!!!!");
logger = Logger.getLogger("AdminLog");
relativeURL="http://localhost:8080/xyz/";
}
public ActionForward user(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
System.out.println("inside UserAction");
HttpSession session = (HttpSession)request.getSession();
String url = "";
LinkedHashMap<String,String> links = (LinkedHashMap<String,String>)session.getAttribute("links");
String requestURL= request.getRequestURL().substring(request.getRequestURL().lastIndexOf("/")+1) ;
System.out.println("Link value in admin acton requestURL!!!!!!!!!"+requestURL);
if(request.getQueryString()!=null && !("").equals(request.getQueryString())){
url = relativeURL+requestURL+"?"+request.getQueryString();
}else{
url = relativeURL+requestURL+"?"+request.getQueryString();
}
System.out.println("url : "+url);
if(links!=null && links.get("user")== null ){
links.put("user",url);
//session.setAttribute("links", links);
}
return mapping.findForward("user");
}
我可以登录,LoginAction工作正常,但如果我点击超链接,它会显示:
“HTTP状态500 - 无法创建路径/ userAction的操作实例”