tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Haines <shai...@ipnet-solutions.com>
Subject RE: <jsp:useBean ...> from a servlet
Date Fri, 12 May 2000 16:55:16 GMT
So now that we have identified this as a potential bug (unless there is some
kind of configuration we are missing that no one has shared with us), how do
we go about getting this fixed?? Is there a formal way to report tomcat
bugs??

-----Original Message-----
From: Jeff Holt [mailto:JeffH@vetsmart.com]
Sent: Thursday, May 11, 2000 3:37 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: <jsp:useBean ...> from a servlet


I am ready to go down that road( extract object manually out of request )
till I discover otherwise. Using Apache 1.3.12 and tomcat 3.1, JDK 1.2.2
from Sun on NT. 

Jeff

-----Original Message-----
From: Steve Haines [mailto:shaines@ipnet-solutions.com]
Sent: Thursday, May 11, 2000 3:33 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: <jsp:useBean ...> from a servlet


My code matches exactly.. My servlet sets an object to "companies" and then
the id of the bean is "companies".. 

What tomcat version are you using??  I have the 3.1 release build and I
haven't tested any of the nightly builds..

For now I have added two lines of Java code to extract the object from the
request object and set it to the page's bean, but I really don't want to do
this - it is a hole in my architecture that hampers my ability to let a web
design artist build the pages without my intervention..

Any other suggestions would be greatly appreciated!

Thanks,
Steve

-----Original Message-----
From: Dunkle, Ed
To: 'JeffH@vetsmart.com'
Cc: 'tomcat-user@jakarta.apache.org'
Sent: 5/11/00 3:13 PM
Subject: RE: <jsp:useBean ...> from a servlet
Importance: High

Jeff,
	My code is similar and working.  This is very important: the
request
attribute name must match the jsp id.  In your code:
"client" != "thisClient" 

Is this an actual code snippet??

Ed



-----Original Message-----
From: Jeff Holt [mailto:JeffH@vetsmart.com]
Sent: Thursday, May 11, 2000 3:56 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: <jsp:useBean ...> from a servlet


The redirect does the same thing on this end. I have not had any Null
pointers from all this.

Perhaps it is time to grab a Diet Dew and ponder...

Jeff

-----Original Message-----
From: Dunkle, Ed [mailto:Ed.Dunkle@ameriserve.com]
Sent: Thursday, May 11, 2000 1:31 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: <jsp:useBean ...> from a servlet


I need to do some more testing, but I thought I had it working by
forwarding
like this:
response.sendRedirect(request.getServletPath()+response.encodeURL("/some
JspP
age.jsp")); 

And I use type instead of class but maybe that doesn't matter.

I got a NullPointerException when I tried to go the dispatcher route,
but I
will try again and get back to you.

Ed

-----Original Message-----
From: Jeff Holt [mailto:JeffH@vetsmart.com]
Sent: Thursday, May 11, 2000 3:16 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: <jsp:useBean ...> from a servlet


I am stuck at the same point. Does anyone have the solution to this yet?

I get the following error with Apache 1.3.12 and tomcat 3.1, JDK 1.2.2
from
Sun on NT:

Undefined variable or class name: thisClient

Servlet code snippit:

Client myClient = new Client( request, conn );
request.setAttribute( "client", myClient );
getServletContext().getRequestDispatcher(
"/jsp/viewClient.jsp").forward(
request, response );

JSP code snippit:

<jsp:usebean id="thisClient" class="vetsmart.Client" scope="request" />

<%
  out.println( thisClient.get( "firstname" ));
%>

Any help would be appreciated.

Jeff Holt
VetSmart, Inc.




-----Original Message-----
From: Steve Haines [mailto:shaines@ipnet-solutions.com]
Sent: Thursday, May 11, 2000 10:58 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: <jsp:useBean ...> from a servlet


I have a servlet that sets an attribute in the request object containing
a
bean:

...
MyBean bean = new MyBean( mydata );
req.setAttribute( "mybean", bean );
...

And that gets forwarded to my JSP page:

...
RequestDispatcher dispatcher;
dispatcher = req.getRequestDispatcher( "/myjsppage.jsp" );
dispatcher.forward( req, res );
...

On the JSP page I unsuccessfully attempt to retrieve the bean using the
<jsp:useBean> tag, as follows:

myjsppage.jsp:
<jsp:useBean id="mybean" class="com.mypackage.MyBean" scope="request" />


It gives me the following error:

javax.servlet.ServletException: No bean "mybean" available for  tag.

Now, if I use JSP scriptlets to retrieve and display the bean, it is
there:

<%
MyBean bean = ( MyBean )request.getAttribute( "mybean" );
bean.doSomething();
%>


Do you have any idea why the JSP page cannot implicitly load the bean
from
the request??  From my understanding as long as the id of the bean
matches
the name of the request parameter (and it is of the proper type),
specifying
scope="request" should load the bean into my JSP page bean..

I am using JDK 1.2.2 and Tomcat 3.1 (release)..

Thanks!
Steve
	

------------------------------------------------------------------------
--
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

------------------------------------------------------------------------
--
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

------------------------------------------------------------------------
--
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

------------------------------------------------------------------------
--
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org



------------------------------------------------------------------------
--
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message