• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Where do i place the .class files?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am beginner for JSP and I just tried a simple problem which needs 3 Files:
1. An HTML File which acts as a form to accept details from user
2. A JSP file to pass on the details to the java bean (.class file)for further verification
3.A java file wheich basically is a bean, that checks if the details entered are existing in the back-end(sql table)
I am using j2sdkee1.3.1 and jdk1.3.1_07
I have placed the .jsp and .htm files in the public_html folder but do not know where should I place the .class file. In the previous versions of j2sdkee, the .class files had to be placed inn the /lib/classes folder. In the version that I am using there is no such folder in the lib dir.
Pls help me with this problem
Regards
Reena
 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which application server r u using?
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't matter which Application Server you are running. The J2EE standard states that the classes should be in the WEB_INF/classes directory in your Web Application or in the WEB_INF/lib directory if they have been packaged into JAR files.
HTH
 
Reena Angane
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am giving my program codes below:
1. Form.htm
<html>
<head><title>User Validation</title></head>
<body>
<form method="post" action="Validate.jsp">
<center>
<table border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2"><font face="Arial" size="2"><b>Please Fill Up The Details</b></font></td>
</tr>
<tr>
<td><font face="Arial" size="2">Account ID:</font></td>
<td><input type="text" name="accid" size="10"></td>
</tr>
<tr>
<td><font face="Arial" size="2">Pin No:</font></td>
<td><input type="text" name="pin" size="10"></td>
</tr>
<tr>
<td colspan="2"><font size="1" face="verdana"> </font></td>
</tr>
<tr>
<td><input type="submit" value="SUBMIT"></td>
<td><input type="reset" value="RESET"></td>
</tr>
</table>
</center>
</form>
</body>
</html>
2.Validate.jsp
<%@ page language="java" %>
<jsp:useBean id="VA" scope="application" class="Validate" />
<jsp:setProperty name="VA" property="accid" param="accid" />
<jsp:setProperty name="VA" property="pin" param="pin" />
<html>
<head><title>Status</title></head>
<body>
<%
String accid=VA.getAccID();
String pin=VA.getPin();
boolean valid=VA.validDetails();
if(valid==true)
{
out.println("Valid Details Entered!!!");
}
else
{
out.println("Invalid Details Entered...");
}
%>
</body>
</html>
3.Validate.java
import java.io.*;
import java.sql.*;
public class Validate
{
private String accid="";
private String pin="";
Connection connect=null;
Statement stat=null;
ResultSet result=null;
public void setAccID(String accid)
{
this.accid=accid;
}
public void setPin(String pin)
{
this.pin=pin;
}
public String getAccID()
{
return accid;
}
public String getPin()
{
return pin;
}
public Validate() throws ClassNotFoundException
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
public boolean validDetails()
{
boolean valid=false;
String pinNo="";
try
{
accid=getAccID();
pin=getPin();
connect =DriverManager.getConnection("jdbc dbc SN","sa","");
String str="select vPinNo from login where vAccountNo='"+accid+"'";
stat=connect.createStatement();
ResultSet result=stat.executeQuery(str);
while(result.next())
{
pinNo=result.getString(1);
}
pinNo=pinNo.trim();
pin=pin.trim();
if(pinNo.equals(pin))
{
valid=true;
}
}
catch(Exception e)
{
}
return valid;
}
}
Pls tell me how would u execute this program?
 
reply
    Bookmark Topic Watch Topic
  • New Topic