•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 392,088 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,931 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 8330 | Replies: 11 | Solved
![]() |
•
•
Join Date: Jan 2006
Posts: 18
Reputation:
Rep Power: 3
Solved Threads: 0
im creating a website that deals with the monthly reminders (extracted from Oracle) for my members for a school project. Should I create a login page using JSP or servlets? I am unfamiliar in both the languages.
Will I need to establish my connection for each page if I use JSP instead of servlets?
Im confused, please advice.
Will I need to establish my connection for each page if I use JSP instead of servlets?
Im confused, please advice.
•
•
Join Date: Jul 2004
Posts: 28
Reputation:
Rep Power: 5
Solved Threads: 2
Hi...you can JSP and Servlets or simple Java Classes as normal easy way.
But i would sugeest you to have it done by using Struts......thats the best way out.
You need require to establish connection each time in any of the above cases.
Just have one Java class which will do that for you and let the other classes call the method of that class.
cheers
But i would sugeest you to have it done by using Struts......thats the best way out.
You need require to establish connection each time in any of the above cases.
Just have one Java class which will do that for you and let the other classes call the method of that class.
cheers
•
•
Join Date: Jan 2006
Posts: 18
Reputation:
Rep Power: 3
Solved Threads: 0
I understand jsp codes get compiled into servlets at the backend. But, for the purpose of my project, I would either script in JSP or manually create Servlets..
Member details will be housed in my db. This is what Im not sure about: The login page takes the user's info and see if it exists in the db. After that the next few pages should use the same user info and track down his set reminders. For that information to be retained in the front-end for JSP usage, should I use sessions??
Thank you very much.
Member details will be housed in my db. This is what Im not sure about: The login page takes the user's info and see if it exists in the db. After that the next few pages should use the same user info and track down his set reminders. For that information to be retained in the front-end for JSP usage, should I use sessions??
Thank you very much.
Hi. I don't mean to be a sponger, but I think his project is similar to mine. I am creating a Movie Theatre site for my Web Apps project. I have almost everything done, but I cant figure out how to create a login page. I was told to try a SELECT query and compare them with the data entered, but that isn't working. Here's the code:
When i run it, Tomcat says :
I'm not sure where i'm going wrong but i would greatly appreciate your help. I was fortunate enough to stumble across your site. Thanks in advance.
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String url = "jdbc:odbc:userDSN";
String username="";
String password="";
Connection conn=null;
String classPath = "sun.jdbc.odbc.JdbcOdbcDriver";
String usernm = username;
String passwrd = password;
try{
Class.forName(classPath);
conn = DriverManager.getConnection(url,username,password);
}catch(Exception exc){
out.println(exc.toString());
}
%>
<%
Statement stm=null;
ResultSet rst=null;
stm= conn.createStatement();
String query= "SELECT userID, password FROM user WHERE userID =" +usernm;
rst = stm.executeQuery(query);
%>
<%= rst.getString("userID") %>
<%= rst.getString("password") %>
<%
if (usernm.equals(userID) && passwrd.equals(password)) { %>
<jsp:forward page = "index.jsp"></jsp:forward>
<% } else { %>
<jsp:forward page = "login_handle.jsp"></jsp:forward>
<% }
rst.close();
stm.close();
conn.close();
%>
</body>
</html>When i run it, Tomcat says :
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 46 in the jsp file: /login_handle.jsp
Generated servlet error:
C:\Documents and Settings\Kemar\.netbeans\5.5.1\apache-tomcat-5.5.17_base\work\Catalina\localhost\Web_Project\org\apache\jsp\login_005fhandle_jsp.java:94: cannot find symbol
symbol : variable userID
location: class org.apache.jsp.login_005fhandle_jsp
if (usernm.equals(userID) && passwrd.equals(password)) {
^I'm not sure where i'm going wrong but i would greatly appreciate your help. I was fortunate enough to stumble across your site. Thanks in advance.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
Similar Threads
Other Threads in the JSP Forum
- Previous Thread: how to activate jsp in apacha tomcat
- Next Thread: conenction to databse pool


Linear Mode