How to redirect to another jsp page in Struts2 by using JavaScript function

前端 未结 2 1094
野的像风
野的像风 2021-01-16 11:59

I want to redirect my jsp to another jsp page by using JavaScript function when I open the BeforeLogin page. But I got below error message.

2条回答
  •  [愿得一人]
    2021-01-16 12:27

    This error is created because you're calling a JSP that is trying to use Struts tags without having passed through an action first, and hence not finding the required underlying structure.

    Struts2 is an MVC framework, which design implies that a new request must pass through a (C)ontroller (the action) and then be rendered through a (V)iew (the JSP).

    You must avoid calling JSPs directly, you must instead call the login action, that after its execution will dispatch the login JSP.

    window.open("login.action");
    

提交回复
热议问题