我可以在点击html页面中的html链接时调用Struts2操作

Dho*_*ora 1 html java struts struts2

我希望在点击html页面中的html链接时执行Struts2操作.我的第一个问题是,是否可以在html页面(而不是JSP)中执行Struts2操作?如果是,请查看下面的代码:

home.html的

HREF = "home.action"


在struts.xml

action name ="home"class ="com.struts.action.HomeAction"

      result name="Success">loginJSP.jsp
Run Code Online (Sandbox Code Playgroud)

*****web.xml*****我做了过滤映射,以便所有内容都转到Struts2

sjt*_*sjt 7

你试过这个吗?

<a href="<s:url action="actionName"/>">click here</a>
Run Code Online (Sandbox Code Playgroud)

或这个?

<a href="/abc/actionname.action">Click here</a><br />
Run Code Online (Sandbox Code Playgroud)

另请参阅:http://struts.apache.org/2.x/docs/url.html

只是好奇才知道,为什么你不能使用JSP?