-1

I am trying to make a visitor counter that uses an SQL database to store the number. I am writing JSP to do so. I am using an Apache httpd server that hosts my localhost. I am trying to store the number and will need an import to java.sql. I was told that this will do the import.

<html>
<% page import = "java.sql*." %>
<head>

Google Chrome's inspect gave me this.

Uncaught SyntaxError: Unexpected token <

I have tried putting <script> marks in the ends and putting it in the first line. Neither worked.

I don't understand, nor how this happened. Please help. Also, I'm quite a beginner for this, please forgive.

John Hao
  • 39
  • 7

1 Answers1

1

If you want to import all classes in package you should add * sign after the dot. Because you can't import multiple packages in single statement:

  <%@  page import = "java.sql.*" %>

Also if you use only few classes inside package consider importing only them, for example:

<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.Connection" %>
Ori Marko
  • 56,308
  • 23
  • 131
  • 233