*   <useAttribute> should be used when you want to create a Java
      variable in the generated java file. <useAttribute> create a
      variable in a jsp scope due to the jsp mechanism used to
      initialize the java variable.
    *   <importAttribute> only import attribute in specified scope. So,
      if you don't need the java variable, you should better use
      <importAttribute>. In addition, <importAttribute> can import all
      tiles' attributes in one shoot, which can not be done with
      <useAttribute>.

  cedric


Holman, Cal wrote:

>Is there a preference between importAttribute and useAttribute?  Looks like
>I can create a variable with a specific class with useAttribute.
>
><tiles:useAttribute id="titleKey" name="title"/>
><title><bean:message name="titleKey" scope="page"/></title>
>
>Cal 
>
>http://www.calandva.com/      
>
>-----Original Message-----
>From: Michael [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, September 03, 2002 08:43
>To: 'Struts Users Mailing List'
>Subject: RE: Nesting tiles:getAsString with struts bean:message
>
>I just tried this again (I am using 1.1b2) and it worked:
>
><tiles:importAttribute/>
><bean:message name="title" scope="page" />
>
>I'm not sure why it didn't work before, but I had some other code in the
>JSP too so I suspect there was a conflict.
>
>Thanks!
>Michael
>
>  
>
>>-----Original Message-----
>>From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, September 03, 2002 2:33 PM
>>To: Struts Users Mailing List
>>Subject: Re: Nesting tiles:getAsString with struts bean:message
>>
>>
>>
>>The proposed solution should work with Struts1.1b2 (according to the
>>doc). It doesn't work with 1.0.x because the key attribute is
>>mandatory
>>in this version ;-(. I have no better solution than the one
>>proposed by
>>Joss when used with struts1.0.x.
>>
>>Cedric
>>
>>Joss Wright wrote:
>>
>>    
>>
>>>Cedric,
>>>
>>>I tried:
>>>
>>><tiles:importAttribute>
>>><bean:message name="title" scope="page" />
>>>
>>>but I got the following error:
>>>
>>>According to the TLD attribute key is mandatory for tag message
>>>
>>>Did you mean:
>>>
>>><bean:write name="title" scope="page" />
>>>
>>>If so then this does not get the key value from the Application
>>>Resources but just displays the key name. I am assuming Michael has
>>>the following in his tiles definition:
>>>
>>><definition name="site.main.layout"
>>>      
>>>
>>path="/layouts/siteLayout.jsp" >
>>    
>>
>>><put name="title" value="site.title" /> <put name="menu"
>>>value="site.menu.bar" /> <put name="body" value="/tiles/body.jsp" />
>>><put name="footer" value="/tiles/common/footer.jsp" />
>>></definition>
>>>
>>>where the value 'site.title' refers to a key in his Application
>>>Resources file.
>>>
>>>Regards,
>>>
>>>Joss
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>From: Cedric Dumoulin <[EMAIL PROTECTED]>
>>>>Reply-To: "Struts Users Mailing List"
>>>><[EMAIL PROTECTED]>
>>>>To: Struts Users Mailing List <[EMAIL PROTECTED]>
>>>>Subject: Re: Nesting tiles:getAsString with struts bean:message
>>>>Date: Tue, 03 Sep 2002 12:24:16 +0200
>>>>
>>>>
>>>>The preferred way is:
>>>>
>>>><tiles:importAttribute> <!-- import all tiles attribute in
>>>>        
>>>>
>>page scope
>>    
>>
>>>>-->
>>>><bean:message name="title" scope="page" />
>>>>
>>>>Cedric
>>>>
>>>>Joss Wright wrote:
>>>>
>>>>        
>>>>
>>>>>Micheal,
>>>>>
>>>>>I resolved this issue by doing the following:
>>>>>
>>>>><tiles:useAttribute name="title" classname="java.lang.String" />
>>>>><bean:message key="<%=title%>"/>
>>>>>
>>>>>It means having a scriplet in your jsp but it works.
>>>>>
>>>>>Regards,
>>>>>
>>>>>Joss
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>From: "Michael" <[EMAIL PROTECTED]>
>>>>>>Reply-To: "Struts Users Mailing List"
>>>>>><[EMAIL PROTECTED]>
>>>>>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>>>>>Subject: Nesting tiles:getAsString with struts bean:message
>>>>>>Date: Mon, 2 Sep 2002 17:43:54 +0200
>>>>>>
>>>>>>Is it possible to nest a tiles:getAsString tag inside a struts
>>>>>>bean:message tag? This is what I'm trying to do:
>>>>>>
>>>>>><definition name="plant_status_page" extends="default_layout"
>>>>>>            
>>>>>>
>>>>>><put name="body" value="plant_status_body"/>
>>>>>><put name="title" value="plant_status_page.title" />
>>>>>>            
>>>>>>
>></definition>
>>    
>>
>>>>>><title>
>>>>>><bean:message key="base.title"/> -
>>>>>><bean:message key="<tiles:getAsString name="title"/>"/> </title>
>>>>>>
>>>>>>I get:
>>>>>>
>>>>>>org.apache.jasper.compiler.ParseException:
>>>>>>/jsp/layouts/default_layout.jsp(8,53) Attribute title
>>>>>>            
>>>>>>
>>has no value
>>    
>>
>>>>>>I've tried several combinations including single quotes
>>>>>>            
>>>>>>
>>and double
>>    
>>
>>>>>>quotes, and escaping the quotes with backslashes, but
>>>>>>            
>>>>>>
>>none of them
>>    
>>
>>>>>>work. If I just do this:
>>>>>>
>>>>>><title>
>>>>>><bean:message key="base.title"/> -
>>>>>><tiles:getAsString name="title"/>
>>>>>></title>
>>>>>>
>>>>>>It does in fact work. So I think the problem is nesting the two
>>>>>>together.
>>>>>>
>>>>>>Michael
>>>>>>
>>>>>>
>>>>>>--
>>>>>>To unsubscribe, e-mail:
>>>>>><mailto:[EMAIL PROTECTED]>
>>>>>>For additional commands, e-mail:
>>>>>><mailto:[EMAIL PROTECTED]>
>>>>>>            
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>_________________________________________________________________
>>>>>MSN Photos is the easiest way to share and print your photos:
>>>>>http://photos.msn.com/support/worldwide.aspx
>>>>>
>>>>>
>>>>>--
>>>>>To unsubscribe, e-mail:
>>>>><mailto:[EMAIL PROTECTED]>
>>>>>For additional commands, e-mail:
>>>>><mailto:[EMAIL PROTECTED]>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><mailto:[EMAIL PROTECTED]>
>>>>For additional commands, e-mail:
>>>><mailto:[EMAIL PROTECTED]>
>>>>        
>>>>
>>>
>>>
>>>
>>>_________________________________________________________________
>>>Join the world's largest e-mail service with MSN Hotmail.
>>>http://www.hotmail.com
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>For additional commands, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>
>>>
>>>      
>>>
>>
>>--
>>To unsubscribe, e-mail:  
>><mailto:struts-user-> [EMAIL PROTECTED]>
>>For
>>additional commands,
>>e-mail: <mailto:[EMAIL PROTECTED]>
>>
>>    
>>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to