我已经搜索过这个问题,有一些答案,但不完全是我的问题。所以,这是我的jsp代码:
<body>
<%
if (manager.isValid(request.getParameter("username"),request.getParameter("password"))){
out.print("<h1> Welcome ");
out.print(request.getParameter("username") + "</h1>");
} else {
out.print("<h1> Please Try Again </h1> <br />");
out.print("Either your username or password is incorrect. Please Try again <br /> <br />");
}
%>
<%@ include file="LoginForm.html" %>
但不是这个,我只想在“else”块中包含“loginForm.html”。我该怎么做?当然这不起作用,但你会猜到我想要什么:
<%
if (manager.isValid(request.getParameter("username"),request.getParameter("password"))){
out.print("<h1> Welcome ");
out.print(request.getParameter("username") + "</h1>");
} else {
out.print("<h1> Please Try Again </h1> <br />");
out.print("Either your username or password is incorrect. Please Try again <br /> <br />");
include file="LoginForm.html" ;
}
%>