简体   繁体   English

从另一个jsp调用一个jsp中的方法

[英]calling method in one jsp from another jsp

I am completely new to jsp, and I have been stuck on this for quite a while. 我对jsp完全陌生,并且在这个问题上停留了很长时间。

I am developing a jsp page, a.jsp, in which I need to do some checking on a parameter x obtained from request.getHeader(). 我正在开发一个jsp页面a.jsp,在其中我需要对从request.getHeader()获得的参数x进行一些检查。 The method for checking is already written on b.jsp in <%...%> tags and I would like to somehow call that method on a.jsp. 检查方法已经写在b.jsp的<%...%>标记中,我想以某种方式在a.jsp上调用该方法。

I'm not sure what I can do here since I am not suppose to change b.jsp, just redevelop a.jsp. 我不确定在这里能做什么,因为我不打算更改b.jsp,只需重新开发a.jsp。 Is there any way I can call a method from b.jsp in a.jsp? 有什么方法可以从a.jsp中的b.jsp调用方法?

将b.jsp包含到a.jsp中,您可以访问所有方法。

<%@ include file="a.jsp"%>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM