• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Exception in JSP using Java beans

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 :


<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">




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?
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
    Bookmark Topic Watch Topic
  • New Topic