Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

internal error report  RSS feed

 
joseph okon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi rangers

i want to use a jsp page to authenticate a user

this is the code i wrote

<%@ page language="java" %>
<%@ page import"java.util.*,java.sql.*,javax.sql.*" %>

<%
String username =request.getParameter("username");
String password= request.getParameter("loginpassword");
%>

<%!
private String dbUserName = "root";
private String dbPassword = "idoreyin";
private String dbUrl = "jdbc:mysql://localhost:3306/filesdb";

Connection conn;
String loginName;
String loginpassword;
%>

<%

String sqlquery="SELECT * FROM login";
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println(JDBC driver loaded");
conn = DriverManager.getConnection(dbUrl,dbUserName,dbPassword);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sqlquery);
while (rs.next()) {
loginName = rs.getString("username");
loginpassword = rs.getString("password");

if(username.equals(loginName) && password.equals(loginpassword)) {
%>

<html>
<body><table>
<tr><td>Click Here Store files:</td><td><input type="Submit" value="<jsp:include page="/StoreFilePage.jsp" />"></td></tr>
<tr><td>Retrieve Your files Here:</td><td><input type="Submit" value="<jsp:include page="/RetrieveFilePage.jsp" />"></td></tr>
</table>
</body></html>
<%
}
else {
%>
<jsp:forward page="/ErrorPage.jsp" />
<%
}
rs.close();
conn.close();

}
catch(ClassNotFoundException cnfe) {
cnfe.printStackTrace();

}
%>

and this is the error i get

org.apache.jasper.JasperException: /AuthenticatePage.jsp(1,15) equal symbol expected
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:49)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:383)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:81)
at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:124)
at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:91)
at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:104)
at org.apache.jasper.compiler.ParserController.figureOutJspDocument(ParserController.java:222)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:132)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:111)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:536)

Please can somebody help me out?thanks joseph
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the syntax of your import.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!