RE: How to implements JavaBean in Tomcat 4.1.x in Win 2000 and solaris

2003-04-01 Thread graghupathy
remove the constructor and initialize the variable to null  and try ...

should be 

package userinfo;
import java.io.*;

public class FormBean implements Serializable

  private String name = null;
  private String email = null;

  public void setName(String name)

   this.name = name;
  }
  public String getName()

   return name;
  }
  public void setEmail(String email)

   this.email = email;
  }
  public String getEmail()

   return email;
  }
}



-Original Message-
From: Carlos Alberto Peláez Ayala [mailto:[EMAIL PROTECTED]
Sent: 01 April 2003 18:00
To: [EMAIL PROTECTED]
Subject: How to implements JavaBean in Tomcat 4.1.x in Win 2000 and
solaris


Hello Friends,
Iam a beggining in the use of javabeans and jsp pages.
I try to run this example:

The file login7.jsp:
jsp:useBean id=FormBean class=userinfo.FormBean/
jsp:setProperty name=FormBean property=*/
HTML
HEAD
TITLEForm Example/TITLE
/HEAD
BODY BGCOLOR=#cc
% if (request.getParameter(name)==null
  request.getParameter(email) == null) { %
CENTER
H2User Info Request Form /H2
form method=GET action=process2.jsp
P
Your name: input type=text name=name size=27
p
Your email: input type=text name=email size=27
P
input type=submit value=Process
/FORM
/CENTER
% } else { %
P
BYou have provided the following info/B:
P
BName/B: jsp:getProperty name=FormBean property=name/
P
BEmail/B: jsp:getProperty name=FormBean property=email/
% } %
/BODY
/HTML


and the file FormBean.java:

package userinfo;
import java.io.*;

public class FormBean implements Serializable

  private String name;
  private String email;
  public FormBean()

   name = null;
   email = null;
  }
  public void setName(String name)

   this.name = name;
  }
  public String getName()

   return name;
  }
  public void setEmail(String email)

   this.email = email;
  }
  public String getEmail()

   return email;
  }
}



When i try to run the login7.jsp in my browser, appear the follow error:

HTTP Status 500 -




type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

org.apache.jasper.JasperException: userinfo.FormBean
at
org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:18
3)
at
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:69
1)
at org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:552)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at
org.apache.jasper.compiler.Generator.generate(Generator.java:1871)
at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:238)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:4
74)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:1
84)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:493)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok

RE: How to implements JavaBean in Tomcat 4.1.x in Win 2000 and solaris

2003-04-01 Thread Carlos Alberto Peláez Ayala
Hello friend, thanks for help me. I try with your idea, but appear the same
problem.

-Mensaje original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Enviado el: martes, 01 de abril de 2003 12:03
Para: [EMAIL PROTECTED]
Asunto: RE: How to implements JavaBean in Tomcat 4.1.x in Win 2000 and
solaris


remove the constructor and initialize the variable to null  and try ...

should be

package userinfo;
import java.io.*;

public class FormBean implements Serializable

  private String name = null;
  private String email = null;

  public void setName(String name)

   this.name = name;
  }
  public String getName()

   return name;
  }
  public void setEmail(String email)

   this.email = email;
  }
  public String getEmail()

   return email;
  }
}



-Original Message-
From: Carlos Alberto Peláez Ayala [mailto:[EMAIL PROTECTED]
Sent: 01 April 2003 18:00
To: [EMAIL PROTECTED]
Subject: How to implements JavaBean in Tomcat 4.1.x in Win 2000 and
solaris


Hello Friends,
Iam a beggining in the use of javabeans and jsp pages.
I try to run this example:

The file login7.jsp:
jsp:useBean id=FormBean class=userinfo.FormBean/
jsp:setProperty name=FormBean property=*/
HTML
HEAD
TITLEForm Example/TITLE
/HEAD
BODY BGCOLOR=#cc
% if (request.getParameter(name)==null
  request.getParameter(email) == null) { %
CENTER
H2User Info Request Form /H2
form method=GET action=process2.jsp
P
Your name: input type=text name=name size=27
p
Your email: input type=text name=email size=27
P
input type=submit value=Process
/FORM
/CENTER
% } else { %
P
BYou have provided the following info/B:
P
BName/B: jsp:getProperty name=FormBean property=name/
P
BEmail/B: jsp:getProperty name=FormBean property=email/
% } %
/BODY
/HTML


and the file FormBean.java:

package userinfo;
import java.io.*;

public class FormBean implements Serializable

  private String name;
  private String email;
  public FormBean()

   name = null;
   email = null;
  }
  public void setName(String name)

   this.name = name;
  }
  public String getName()

   return name;
  }
  public void setEmail(String email)

   this.email = email;
  }
  public String getEmail()

   return email;
  }
}



When i try to run the login7.jsp in my browser, appear the follow error:

HTTP Status 500 -




type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

org.apache.jasper.JasperException: userinfo.FormBean
at
org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:18
3)
at
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:69
1)
at org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:552)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at
org.apache.jasper.compiler.Generator.generate(Generator.java:1871)
at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:238)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:4
74)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:1
84)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:493)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at