Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in JSP using Java beans  RSS feed

 
salmanhassan jaffery
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I m having a TRY and Catch error , when i try to call java beans from my JSP page ....TRY nad catch error occour.

The code of my JSP file is given below :

Authentic.jsp

<html>
<head>
<title>
Authentic
</title>
</head>
<body bgcolor="#0000ff">

<jsp:useBean id="authentic" class="authentication.authenticateBean" scope="session">

<%

String username = request.getParameter("username");
String password = request.getParameter("password");

if (username!=null) validate.checkUsername(username);

if(password!=null) validate.checkPassword(password);


%>

Please Login

<form action="abc.jsp" method="POST">

USERNAME: <input type="text" name="username" > <br>
PASSWORD: <input type="text" name="password" > <br>

<input TYPE="submit" value="Login">

</form>

</body>
</html>

authenticateBean.java

package authentication;

import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;


public class authenticateBean
implements SessionBean {
SessionContext sessionContext;


public void ejbCreate() throws CreateException {
}

public void ejbRemove() {
}

public void ejbActivate() {
}

public void ejbPassivate() {
}

public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
}

public void checkUsername(String username)
{

if(username.length() < 4 )
System.out.println("the password "+username+ "is too short");
}


public void checkPassword(String password)
{
if(password.length() < 4 )
System.out.println("the password "+password+ "is too short");
}
}

Can anyone tell what i am doing wrong?
Thanks,
SALMAN
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're aware that JavaBeans and EJB are two different technologies, aren't you? Are you using an EJB Container?

The useBean tag is for simple JavaBeans.
[ January 17, 2005: Message edited by: Ben Souther ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!