> -----Original Message----- > From: Andy Engle [mailto:[EMAIL PROTECTED] > Sent: Friday, August 13, 2004 12:05 PM > To: [EMAIL PROTECTED] > Subject: Displaying bean values within tiles > > > Hi all, > > I hate to ask a real, boring, non-OT question on a Friday, but I am > working with a Struts application in which I am using tiles > to organize > my views. What I want to be able to do is pass in a bean > with a String > (or, "string beans" for all you farmer types out there) into my tiles > setup and have that value displayed in my view. > > I have my tiles definitions in tiles-defs.xml, and of course I have a > file template.jsp which handles my layout. > > I have horsed around with using the <tiles:useAttribute> tag with the > String value, but I can't seem to get that to work -- for the page I > want to display it on, it either displays the default value for the > page as I have it set in tiles-defs.xml, or it doesn't print anything > at all. I suppose my question could/should be how and where would I > use this useAttribute tag, as it seems to be the solution to my > problem.
useAttribute: Declare a Java variable, and an attribute in the specified scope, using tile attribute value. Java variable and attribute will have the name specified by 'id', or the original name if not specified. So I believe for tiles def: <definition name="paymentHistory" extends="mainLayout"> <put name="title" value="Payment History"/> <putList name="centerList"> <add value="/searchBySsn.jsp"/> <add value="/paymenthistory.jsp"/> </putList> </definition> In the jsp page: <tiles:useAttribute id="javaVariable" name="title"/> Will allow <c:out value="${javaVariable}"/> And yes, for this example I could have used <tile:getAsString name="title"/>. :) Not sure what you mean by pass in a bean to your tiles setup though. > > Thanks for your help, and I look forward to receiving your responses. > > > Best Regards, > Andy > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]