I've searched for this question, there are some answers, but not exactly as my question. So, here is my jsp code:
<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" %>
but instead of this, I want to include "loginForm.html" only in "else" block. How can I do it? Of course this doesn't work, but you'll guess what I want:
<%
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" ;
}
%>
I would like to show you a way, try like below. You can try with else instead with if
.
<body>
<%
int x = 10;
if(x>10) {
%>
<%@include file="some.html" %>
<%
}
%>
</body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With