java - How to include HTML in JSP? -


i've searched question, there answers, not question. here 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 username or password incorrect. please try again <br /> <br />");                         }     %>     <%@ include file="loginform.html" %> 

but instead of this, want include "loginform.html" in "else" block. how can it? of course doesn't work, you'll guess 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 username or password incorrect. please try again <br /> <br />");             include file="loginform.html" ;         }     %> 

i show way, try below. can try else instead if.

<body>         <%             int x = 10;             if(x>10) {         %>         <%@include  file="some.html" %>         <%             }         %>  </body> 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -