I'm making a webpage using JSP and I'd like to be able to print to the
webbrowser in my class. Below is what i think is the relevant part of
my class. I believe I have included the right packages and I believe
everything else is correct but for some reason I get an error when I
try to compile my class. Anyone know what coudl be the problem?
The error message i get when i try to compile the class is:
============================================================
DbClass.java:9: cannot resolve symbol
symbol : class JspWriter
location: class bkwrmspackage.DbClass
public int verifyUser(String username, String password, JspWriter
out) {
^
my class:
=============================================================
package bkwrmspackage;
import java.sql.*;
import java.lang.*;
import java.io.*;
public class DbClass {
public int verifyUser(String username, String password, JspWriter
out) {
Connection dbconn;
PreparedStatement sql;
out.println("hahahaha\n");
.......<snip>.........
}
}
Thanks in advance,
--Lucas
Tor Iver Wilhelmsen - 18 Apr 2005 08:07 GMT
> import java.sql.*;
> import java.lang.*;
> import java.io.*;
You also need to import JspWriter - it's not in any of those packages,
keep looking. :)
LMachado1@gmail.com - 18 Apr 2005 15:19 GMT
> > import java.sql.*;
> > import java.lang.*;
> > import java.io.*;
>
> You also need to import JspWriter - it's not in any of those packages,
> keep looking. :)
I'm kind of a java newbie (even more so to JSP), but I could have sworn
I was including the right packages...Am I reading the Java API wrong?
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/JspWriter.html
--Lucas
Tor Iver Wilhelmsen - 19 Apr 2005 08:34 GMT
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/JspWriter.html
This path indicates you need
import javax.servlet.jsp.JspWriter;
LMachado1@gmail.com - 19 Apr 2005 17:08 GMT
When I try ti import this i get:
DbClass.java:4: package javax.servlet.jsp does not exist
import javax.servlet.jsp.JspWriter;
^
DbClass.java:8: cannot resolve symbol
symbol : class JspWriter
location: class bkwrmspackage.DbClass
public static int verifyUser(String username, String password,
JspWriter out) {
^
2 errors
How is this possible if I have no problem using the out JspWriter in my
JSP pages?
Tor Iver Wilhelmsen - 19 Apr 2005 22:25 GMT
> DbClass.java:4: package javax.servlet.jsp does not exist
> import javax.servlet.jsp.JspWriter;
You need to add a jar file containing the class when compiling. E.g.
"tomcat.jar" or whatever - it should be somewhere in your app-server's
libraries.
> How is this possible if I have no problem using the out JspWriter in my
> JSP pages?
Because the JSP pages are "compiled" by the JSP container, not your
IDE or equivalent.
Arnaud Berger - 18 Apr 2005 08:07 GMT
Hi,
Is the JspWriter class in the same package as DbClass (i.e bkwrmspackage)?
If not, then your imports statements are missing the import for JspWriter.
Regards,
Arnaud
> I'm making a webpage using JSP and I'd like to be able to print to the
> webbrowser in my class. Below is what i think is the relevant part of
[quoted text clipped - 34 lines]
> Thanks in advance,
> --Lucas