Actually, no, it looks like I was mistaken.  Looking again at the error
message, it does seem like the seemingly malformed tag is understood to be a
JSP expression tag and the generated servlet code is correctly set to
"out.print( FormBean.getUserName() );"  Sorry, don't know what the problem is
then.



                                                                                       
                               
                    jeff.guttadauro@                                                   
                               
                    abbott.com              To:     "Tomcat Users List" 
<[EMAIL PROTECTED]>              
                                            cc:                                        
                               
                    07/11/02 11:47          Subject:     Re: Cannot use bean from jsp, 
but servlet ok. I'm dying!     
                    AM                                                                 
                               
                    Please respond                                                     
                               
                    to "Tomcat Users                                                   
                               
                    List"                                                              
                               
                                                                                       
                               
                                                                                       
                               





I think it is just a simple syntax error.  The JSP expression tag on your
userName text field is incorrect - needs to be <%= without the space.  You
have a scriptlet with =FormBean.getUserName() trying to be executed.  It's
interesting to see that it looks like Tomcat equates an equals sign before a
class as an out.print on that class.

HTH,
-Jeff




                    "eric"

                    <edahnke@eart        To:
<[EMAIL PROTECTED]>
                    hlink.net>           cc:

                                         Subject:     Cannot use bean from
jsp, but servlet ok. I'm dying!
                    07/11/02

                    11:43 AM

                    Please

                    respond to

                    "Tomcat Users

                    List"







Help. Absolutely stuck. Tomcat cannot find my bean classes no matter what
when called from jsp pages. From within servlets no problem.

Here is the jsp
---------------
<%@ include file="pub_hdr.html" %>
<jsp:usebean id="FormBean" class="beans.FormBean" scope="request" />
<form>
<input type="text" name="userName" value="<% =FormBean.getUserName() %>">
<%= FormBean.getErrorMsg("userName") %>
</form>
<%@ include file="pub_ftr.html" %>

Here is the bean
----------------
package beans;
import java.util.*;
import java.io.Serializable;
public class FormBean implements Serializable {
  public String userName;
  public FormBean() {}

  public String getUserName() {
    return this.userName;
  }
  public void setUserName(String uname) {
    this.userName = uname;
  }
}

NO MATTER WHAT, as soon as I access the jsp page. This error comes up.
Generated servlet error: C:\jwsdp-1_0\work\Standard
Engine\localhost\messagesmith\en\users$jsp.java:126: Undefined variable or
class name: FormBean out.print( FormBean.getUserName() );

It certainly seems that TC cannot find the FormBean class which lives here:
C:\jwsdp-1_0\webapps\project\WEB-INF\classes\beans.
I've changed that scope attribute to application or page, but it doesn't
change.
With TC3.x I had to do some configuration in the conf/server.xml file, but
this doesn't seem necessary w/ TC4. All the same I've adding the following
context to the server.xml, but it doesn't help.
<Context path="/project"
  docBase="webapps/project"
  debug="0"
  reloadable="true" />

Anyone have any ideas? It is killing me. Again, I can instantiate the
FormBean class from within servlets, but not from JSP.

Env:
====
Win2k Server, jdk1.4.0_01, TC4.0
Classpath=.;C:\jwsdp-1_0\common\lib\servlet.jar;C:\jwsdp-1_0\webapps\project
\WEB-INF\classes;C:\jfreechart-0.9.1\jars\jcommon-0.6.3.jar;C:\jfreechart-0.
9.1\jars\jfreechart-0.9.1.jar;
TOMCAT_HOME=C:\jwsdp-1_0
CATALINA_HOME=C:\jwsdp-1_0
JAVA_HOME=C:\j2sdk1.4.0_01






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to