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

时间:2013-11-28 01:35:52

标签: java html5 jsp servlets anchor

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

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

我想在report.jsp上找到一个链接,点击后会将我带到login.jsp

页面的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...

谢谢,

非常感谢

1 个答案:

答案 0 :(得分:2)

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

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