Deploy problem ..

this is my main jsp page

<html>

<head><title>Welcome to login screen</title></head>

<body>

<form method = post action ="Usebean.jsp">

<table>

<tr>

<td>Login</td>

<td><input type = text name = login></td>

</tr>

<tr>

<td>Password</td>

<td><input type = password name = password></td>

</tr>

<tr>

<td><input type = hidden name="action" value ="save"></td>

<td><input type = submit value ="Submit"></td>

</tr>

</table>

</form>

</body>

</html>

Usebean.jsp

from this jsp i am connecting to another one..

<%@ page language ="java" %>

<jsp:useBean id ="main" scope ="session"class ="Main.MainBean" />

<jsp:setProperty name ="main" property ="*" />

<html>

<head><title>Validating the login</title></head>

<body>

<%

String log = main.getlogin();

String pass = main.getpassword();

String act = main.getaction();

boolean validate = main.AccountValidate();

if(validate ==true)

{

out.println("Inserted successfully !!");

out.println("Login name : " + log);

}

else

{

out.println("Insertion failed !!");

}

%>

</body>

</html>

this jsp is connecting it a bean named Mainbean in package....

MainBean.java

package Main;

import java.io.*;

import java.sql.*;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.rmi.PortableRemoteObject;

publicclass MainBean

{

private String login ="";

private String password ="";

private String action="";

private Account account;

private AcHome accountHome;//home interface

//set

publicvoid setlogin(String log)//setXXX(setlogin) ,XXX is the property name as in usebean.jsp

{

this.login = log;

}

publicvoid setpassword(String pass)//setXXX(setpassword) ,XXX is the property name as in usebean.jsp

{

this.password = pass;

}

publicvoid setaction(String action)

{

this.action = action;

}

//get

public String getlogin()//getXXX

{

return login;

}

public String getpassword()//getXXX

{

return password;

}

public String getaction()

{

return action;

}

public MainBean()throws ClassNotFoundException

{

try

{

Context ic =new InitialContext();

java.lang.Object objref = ic.lookup("java:comp/env/ejb/Account");

accountHome = (AcHome) PortableRemoteObject.narrow(objref,AcHome.class);

}

catch(Exception e1)

{

}

}

publicboolean AccountValidate()

{

boolean validate =false;

try

{

login = getlogin();

password = getpassword();

if(action.equals("save"))

{

account = accountHome.create(login,password);

validate =true;

}

}

catch(Exception e)

{

validate =false;

}

return validate;

}

}

this bean passes login and password into a home interface..

AcHome.java

package Main;

import java.rmi.RemoteException;

import javax.ejb.*;

publicinterface AcHomeextends EJBHome

{

public Account create(String login,String password)throws CreateException,RemoteException;

}

it will goto ejbCreate() that is in AcEJB

AcEJB.java

package Main;

import java.sql.*;

import javax.sql.*;

import java.util.*;

import javax.ejb.*;

import javax.naming.*;

publicclass AcEJBimplements EntityBean

{

//private String login="";

//private String password="";

publicvoid ejbCreate(String login,String password)throws CreateException,SQLException

{

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:MyDataSource","sa","");

PreparedStatement prepstmt = con.prepareStatement("insert into login values(?,?)");

prepstmt.setString(1,login);

prepstmt.setString(2,password);

prepstmt.executeUpdate();

prepstmt.close();

}

catch(Exception e)

{

thrownew EJBException("ejbcreate : " + e);

}

}

public AcEJB(){}

publicvoid ejbRemove(){}

publicvoid ejbActivate(){}

publicvoid ejbPassivate(){}

publicvoid setEntityContext(EntityContext context){}

publicvoid unsetEntityContext(){}

publicvoid ejbStore(){}

publicvoid ejbLoad(){}

}

and finally the remote interface is

package Main;

import javax.ejb.EJBObject;

import java.rmi.RemoteException;

publicinterface Accountextends EJBObject

{

}

Remember all the java files i am using inside a package..called Main..

The problem is when i tried t o insert login and username into database its showing insert failed as user defined(i proved insert failed in Usebean.jsp)...

I put the 2 jsp file in docroot folder and all java file i put it in a package named main and put it in lib/classes/main..

Would anybody please tell what might be the problem happened here...

Thanx...

[10920 byte] By [Reona] at [2007-11-27 11:33:01]
# 1

Do you have a stack trace from the application server?

uvneta at 2007-7-29 16:48:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Actually from the usebean.jsp file i'm returning a boolean value...

How can i add a String to print the printStackTrace() method..

Reona at 2007-7-29 16:48:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...