Configured like this in web.xml <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> Then use Struts2's tags in index.jsp <s:action name="getDataInfo" executeResult="true"></s:action> This tag will execute the action and return the result page.
Configured like this in web.xml <welcome-file-list> <welcome-file>welcome.jsp</welcome-file> </welcome-file-list> Then use the jsp built-in object to jump or forward in welcome.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <% /* response.sendRedirect("medicine/title"); //Redirect*/ request.getRequestDispatcher("medicine/title").forward(request,response);//转发%>
web.xml <welcome-file-list> <welcome-file>jump.jsp </welcome-file> </welcome-file-list> Access action' through this code in jump.jsp: <meta http-equiv='refresh' content='0;url=show.action'>
<welcome-file-list> <welcome-file>index.jsp </welcome-file> </welcome-file-list> index.jsp <jsp:forword page="show.action">