I set up a JSP page that retrieves values from the URL and save them in a database.
so I break my code and I created a class to connect to the database and executes the JSP request, however, it doesn't work.
Here is the code of the class knowing that I tested and it works
here is my jsp page that calls the method getMyConnection() in my class Connect.java
and this is the error
i tried this to but it doesn't work
and this this the related error
please help me
Jeanne Boyarsky wrote:Connect.getMyConnection is a static method. This means you don't need jsp:useBean. That would be for an instance method.
Did you import the connection class on the top of your JSP? This should look like
<%@ page import="com.database.Connect" %>
no it doesn't work i can't import the class Connect but i can import the whole package that contains the Connect class
what's wrong with my first code??
it works perfectly with eclipse but when i decided to execute the URL directly in my browser it generates the error above.
i copied the project from my eclipse workspace into webapps of tomcat but it doesn't work.
Java code in classes is usually easier to write and debug than obsolete scriptlets placed in JSPs.