hiii... i am writing an application in jsp to create a login form. but it shows an error : string not properly closed at line 7.

also the java script included doesnot show any error message ...

here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>REQUIRED FIELD SCRIPT</title>
<SCRIPT LANGUAGE="javascript">
<!-
function isempty(theField)
{
 if(thefield.value=="") 
 {
 return true;
 }
 else {
 return false;
 }
} 
 function isRequired(thisForm)
 { var Empty= false;
 if(isEmpty(thisform.loginid))
  {
  alert("THIS FIELD IS REQUIRED. PLEASE FILL IT!!");
  Empty = true;
  }
  if (Empty== false && isEmpty(thisForm.password)== true)
  {
  alert("THIS FIELD IS REQUIRED. PLEASE FILL IT!!");
  Empty = true;
  }
  if(Empty== false)
  {
   document.thisForm.submit();
  }
 }
 //->
 </SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 24px;
	font-weight: bold;
	color: #FF3300;
}
.style4 {
	font-size: 36px;
	color: #FF0000;
}

</style>
</head>

<body>
<form name="thisForm" method="post" action="">
  <table width="1646" height="120" border="1">
    <tr>
      <td width="1636" height="114" bordercolor="#31CEAE" bgcolor="#31CEAE"><table width="1218" height="49" border="0" bordercolor="#00CCFF">
        <tr>
          <td width="116" bgcolor="#00CCFF"><input name="imageField" type="image" src="file:///K|/project/Iocl_logo.jpg" width="100" height="100" border="0"> </td>
          <td width="1092" bgcolor="#31CEAE"> <blockquote>
            <blockquote>
              <blockquote class="style3 style4">INDIAN OIL COOPERATION </blockquote>
            </blockquote>
          </blockquote></td>
        </tr>
      </table></td>
    </tr>
  </table>
  <table width="1642" border="0" bordercolor="#31CEAE">
    <tr>
      <td width="403" height="255" bgcolor="#31CEAE"><blockquote>
        <blockquote>
          <blockquote>
            <blockquote>
              <p><a href="file:///K|/project/IOCL%20PROJECT%20PAGE/newuser.htm" title="newuser" class="style3">New User?</a></p>
            </blockquote>
          </blockquote>
        </blockquote>
      </blockquote></td>
      <td width="1229" bgcolor="#31CEAE"><table width="573" border="0">
        <tr>
          <td width="88" height="48">&nbsp;</td>
          <td width="222"><blockquote>
            <p><strong>LOGIN ID </strong></p>
          </blockquote></td>
          <td width="249"><p>
                <input name="loginid" type="text" id="loginid">
            </p></td>
        </tr>
        <tr>
          <td height="28"><blockquote>&nbsp;</blockquote>            <blockquote>
              <p>&nbsp;              </p>
            </blockquote></td>
          <td height="28"><blockquote>
            <p><strong>PASSWORD</strong></p>
          </blockquote></td>
          <td height="28"><p>
                <input name="password" type="password" id="password">
            </p></td>
        </tr>
        <tr>
          <td height="29" colspan="2">&nbsp;</td>
          <td height="29">&nbsp;</td>
        </tr>
        <tr>
          <td height="57">&nbsp;</td>
          <td><blockquote>
            <blockquote>
              <p>
                  <input name="Reset" type="reset" value="RESET">
              </p>
            </blockquote>
          </blockquote></td>
          <td><blockquote>
            <blockquote>
              <p>
                  <input name="login" type="submit" id="login" value="LOGIN" onClick="isRequired(this.Form)">
              </p>
            </blockquote>
          </blockquote></td>
        </tr>
      </table></td>
    </tr>
  </table>
  <table width="1642" height="2327" border="1">
    <tr>
      <td width="1632" height="2321" bordercolor="#31CEAE" bgcolor="#31CEAE">&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>

Javascript is case-sensitive script language. theField and thefield, thisForm and thisform.

function isempty(theField)
 {
   if(theField.value=="") 
   {
    return true;
    }
else {
    return false;
 }
} 
function isRequired(thisForm)
{ var Empty= false;
if(isEmpty(thisForm.loginid))
{
alert("THIS FIELD IS REQUIRED. PLEASE FILL IT!!");
Empty = true;
}
if (Empty== false && isEmpty(thisForm.password)== true)
{
alert("THIS FIELD IS REQUIRED. PLEASE FILL IT!!");
Empty = true;
}
if(Empty== false)
{
document.thisForm.submit();
}
}

Duplicate thread:
<URL SNIPPED>

well i cant find any case sesitive error can you point out specifically!!

Why you don't look at line 7

error : string not properly closed at line 7.

I think it should <!--
You missed one -

hey rizza-f thanks for ur obsevation.

but its still not working... but error it shows is
The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /chklogin.jsp(29,23) equal symbol expected
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
    org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:199)
    org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:154)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1250)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1462)
    org.apache.jasper.compiler.Parser.parse(Parser.java:137)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Edited 3 Years Ago by Reverend Jim: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.