Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 8:12:18 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

March 2003
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Feb   Apr

Get Firefox!

Thursday, March 06, 2003

"Why is my <bean:write> tag not writing?"

If you are building BC4J applications with JSP pages as your "view" layer, you're bound to ask yourself this question sooner or later. You have a page with a <bean:write> or <bean:message> struts tag to add some data value to your page, but when your page appears, you don't see the data you're expecting. What gives?

Long before tag libraries existed, JSP 1.0 pages were born. In a JSP page, you can include any kind of literal text (typically HTML tags) with snippets sprinkled in there. If you were careful, you could also use JSP 1.0 to create XML documents by just changing the literal text in your page to have tags like <Customer> and <Address> instead of <table> and <span>. Since JSP allowed any literal text, nothing prevented you from using JSP to generate XML documents that used namespaces, too. Your literal text in the page could include tags like <myprefix:Customer>, in other words. No problem. Since JSP just treated it all as literal text, you just had to be careful that what you put in your page would make sense to the client receiving the literal characters.

With the advent of tag libraries, certain literal text in the page like <bean:write> began to take on special meaning to the JSP page compiler. Rather than "passing through" the literal angle brackets and bean:write tag-name text, the page compiler would recognize the <bean:write> as a "tag" rather than just text, and furthermore would use the "bean:" prefix to identify what tag library the bean was referring to. At page compilation time, literal text recognized in the JSP page as tag library tags are converted into calls to the tag library implementation code, following a particular contract that the JSP Tag Library spec outlines. However, this tag recognition process depends on the existence of the tag library declaration at the top of the JSP page like this:

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

If this taglib declaration is missing (perhaps forgotten by accident, we're all human!), then the JSP page compiler cannot recognize the 12 sequential characters "<bean:write>" as a tag in a tag library, so by the JSP 1.0 semantics it must pass that text through "raw" to the client. Net net, if your tag library tags are not working as expected, double-check that you remembered to include an appropriate tag library declaration at the top of your page.


4:23:21 PM    



© Copyright 2008 Steve Muench.