struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Struts v1.1, Tiles, Bean property question...
Date Mon, 17 Apr 2006 20:11:32 GMT
I assume this is part of the transition process between the perl app and 
the struts app - it is a somewhat unconventional approach!

As such I haven't tried it before, but the <tiles:insert> tag is looking 
for a template or jsp, not just a string. Put those beanName and 
beanProperty  attributes on the <put> in the xml and use 
<tiles:useAttribute name="body"/> in your jsp. You're passing in the raw 
string of output, not the actual jsp.


Alan Treece on 17/04/06 19:56, wrote:
> Yes... I'm using a tiles-defs.xml. Let me rephrase the question...
> 
> Here's my tiles-defs.xml:
> 
> <definition name=".site.mainLayout" path="/jsp/tiles/layout.jsp">
>      <put name="body"        value="" type="string" />
> </definition>
> 
> My action uses a DynaActionForm and one of the form properties  will 
> return a string like "<center><h1>This is a test</h1></center>".
This 
> string needs to be inserted into the "body" attribute of the tile and 
> rendered as html code.
> 
> I was thinking that using the following in my JSP would take care of 
> this, but it doesn't. Here's the JSP line:
> 
> <tiles:insert attribute="body" beanName="showForm" beanProperty="target" 
> flush="true" />
> 
> 
> Any clues what I'm doing wrong?
> Thanks, ajTreece
> 
> 
> 
> On Apr 17, 2006, at 4:50 AM, Adam Hardy wrote:
> 
>> Alan Treece on 17/04/06 07:11, wrote:
>>> I'm working on the layout with Tiles and having a difficult time 
>>> getting past this one issue. The Perl code has various header and 
>>> footer pieces of code based on whether a use id logged on or not and 
>>> whether the user is accessing what is termed an external or internal 
>>> facing web site. The Perl code determines which header and footer to 
>>> use and then reads in the data from various fragmented files... 
>>> massages it a little then writes it out to the display.
>>> I'm thinking I could to the same thing initially with an action for 
>>> the header and footer that will make the determination, read in the 
>>> data, massage it as required and then pass it back out as a bean 
>>> property. I can't seem to find the correct syntax and Tiles tag to 
>>> insert/put the bean property into a Tiles definition. I've tired 
>>> <tiles:insert ... /> and <tiles:put ... /> with no success.
>>
>> Hi Alan,
>>
>> one of the best ways of getting tiles to work is literally just to 
>> copy from the example application that you should be able to find on 
>> the struts website.
>>
>> however it seems you've got quite far already, but the technique 
>> you're using isn't quite crystal clear to me - if you are putting data 
>> into an attribute on the request in your action and you want to read 
>> it in your tile JSP, you don't need any tiles tag for that, you just 
>> pull it out of the request.attributes collection.
>>
>> Perhaps we're talking at cross-purposes though - are you using a 
>> tiles-defs.xml to define your tiles?
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message