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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -