0

Hello i am currently picking up jsp to extend my knowledge of web languages. I am currently trying to connect to a database but i keep getting a weird error on the index page where i verify conditions for the authentication.jsp page.
Parts of Code Below:
index.jsp

<div id="sidebar">
    <%
        if(request.getParameter( "login" ) == null){
    %>
            <%@ include file="includes/authenticate.jsp" %>
        }
    <%
        else{
            out.println("<h2>Welcome</h2>");
    %>
            <%@ include file = "includes/menu.jsp" %>
    <%
        }
    %>
</div>

authenticate.jsp

if(request.getParameter("login") == null){
    %>
        <form action="authenticate.jsp" method="POST">
        <table align="center">
            <tr>
                <td align="center" colspan="2">Authenticate</td>
            </tr>
            <tr>
                <td align="right">Username:</td><td><input type="text" name="username" size="9"></td>
            </tr>
            <tr>
                <td align="right">Password:</td><td><input type="password" name="pass" size="9"></td>        
            </tr>
            <tr>
                <td  align="center" colspan="2"><input type="submit" value="Log in" name="login"></td>
            </tr>
        </table>
        </form>
    %<
    }   
    else
        ProcessForm();

    %>

i get this error though

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 65 in the generated java file
Syntax error, insert "}" to complete ClassBody

An error occurred at line: 32 in the jsp file: /jsp/index.jsp
Syntax error, insert "}" to complete Statement
29:                         <%
30:                             if(request.getParameter( "login" ) == null){
31:                         %>
32:                                 <%@ include file="includes/authenticate.jsp" %>
33:                             }
34:                         <%
35:                             else{

An error occurred at line: 252 in the generated java file
Syntax error, insert "else Statement" to complete IfStatement

An error occurred at line: 252 in the generated java file
Syntax error, insert "}" to complete Block

An error occurred at line: 263 in the generated java file
Syntax error on token "}", delete this token

I feel the error has to do with the syntax for the include, but i dont see another way of doing it. I was positive that closing the regular jsp field and inputing the import jsp field then opening another regular field would work.

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by SagarSe7en
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.