Java 将一个jsp页面链接到另一个jsp页面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20256261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 00:37:40  来源:igfitidea点击:

linking one jsp page to another jsp page

javahtmljspservletsanchor

提问by user3044023

This is a very simple question, but as I am a newbie...

这是一个非常简单的问题,但由于我是新手......

I have two files: login.jsp and report.jsp they are both within the same WebContent folder.

我有两个文件: login.jsp 和 report.jsp 它们都在同一个 WebContent 文件夹中。

I want a link on report.jsp that when clicked, will take me to login.jsp

我想要一个关于 report.jsp 的链接,点击后会带我到 login.jsp

The jsp part of the page looks like:

页面的 jsp 部分如下所示:

Connection conn = (Connection)session.getAttribute("conn"); //retrieves the connection from the session

String lot_id = request.getParameter("lotnum");
session.setAttribute("lot_id",lot_id);

out.print("Report on Lot Number: ");
out.print(request.getParameter("lotnum")+"<br>");


//<a href="login.jsp">Click here to go to login page</a>
// this is supposed to be an anchor tag linking this page to login.jsp, and where I am getting my error... 

Statement sql = conn.createStatement();  //create statement using the connection

//... ... code for the rest of the page goes here...

thank you,

谢谢你,

much appreciated

非常感激

采纳答案by Baby

try put your folder name:

尝试输入您的文件夹名称:

out.print("<a href='/foldername/login.jsp'>Click here to go to login page</a>");