Jsp Page session vaiable to java class and vise versa
Hi to all,
I am new to jsp, i have to programs, one jsp page and another java class. in jsp page i get the user data from html form and put the id in session. here i have to call the session vaiable to my java class where it (variable)initialize a file name.
and same i have to call the java class to jsp page which insert statements to sql server,
Please Help Me.
[389 byte] By [
kurra99a] at [2007-11-27 1:57:10]

# 6
//My Java Class file
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.http.HttpSession;
import java.sql.Statement;
public class StuInfo extends Object {
//main method begins execution of Java application
public static void main (String args[]){
String StuFile = "C://"+iD+".txt";// Here i have to get the session varaible.(ID)
try {
}
In my jsp Page i initilized session as
session.setAttribute("ID",StuId);
I am not able to understand where i have to declear the HTTPSession#getAttribute("ID");
# 9
Something like:MyClass myClass = new MyClass();
myClass.doSomething(session.getAttribute("name"));
?
Anyway: start off with the Java EE tutorial: http://java.sun.com/javaee/5/docs/tutorial/doc/
Servlets starts at chapter 3. JavaBeans starts halfway chapter 4.