tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ranko Bijelonic" <ra...@dietsmart.com>
Subject RE: aaargh..
Date Thu, 16 Nov 2000 19:15:10 GMT
Its all of because where your code gets placed.
That is, the useBean tag is translated into code which comes before any of
the <% %> code in the body of JSP.
So when you use setProperty it is transalted into code that comes before
your <% %> code but there is no bean at that point.

Instead of changing the bean, you could put initialization code inside the
useBean tag.

<jsp:useBean id="mybean" scope="myscope" class="myclass">
<%
	...any java code....
%>
</jsp:useBean>

This way, the code you include will be placed at the right point when your
JSP is turned into a servlet.
The setProperty tags will get transalted into code that comes after this.

I hope this helps.

>just for arguments sake, why does then usebean tag need to create a bean
before i can use set-
>and getProperty on it?

thnx,
-Alexander.



Mime
View raw message