进入JSP页面后如何立即输入Servlet?

问题描述 投票:0回答:1

进入JSP页面后如何立即输入Servlet?进入Servlet后,是否可以在当前页面中获取请求的参数?单击锚标记后,我想使用Servlet来获取当前JSP文件的信息。我该怎么办?转到所需页面之前,我必须在锚标记中添加什么?

当前页-Profile.jsp

<a href="Profile.jsp">View Profile</a>    
<a href="ReportGeneration.jsp">View Report Generation</a>
<a href="Contact.jsp">Contact Us</a>

所需页面-ReportGeneration.jspServlet-ReportProcess.java

当单击“查看报告生成”标记时,我想将信息从ReportProcess servlet打印到ReportGeneration.jsp。

java html jsp servlets
1个回答
0
投票

像这样将servlet结果包含在ReportGeneration.jsp中>]

<jsp:include page="/ReportProcess" /> 

这里ReportProcess认为是此区域中的servlet URL,您将在此标记区域中获得servlet输出

如果要在profile.jsp中输出servlet,则>

代替此

<a href="ReportGeneration.jsp">View Report Generation</a>

使用此

<jsp:include page="/ReportProcess" /> 
© www.soinside.com 2019 - 2024. All rights reserved.