shale-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvanma...@comcast.net (Gary VanMatre)
Subject RE: Clay jsfid="form" not working
Date Fri, 01 Jun 2007 14:31:10 GMT
>From: "JS Portal Support" <support@jsportal.com> 
>
> Gary, 
> 
> Your comments made give another closer look at the components on my pages 
> that did not work. It turned out that a mall formatted object and embed tag 
> for a flash file caused the problem. I had the following ugly tag that 
> worked before I used clay. (There must be better ways but when I build it I 
> just stuck with what worked): 
> 
>  <param name="movie" value="<h:outputText value="
>   #{webappLabels['imagePath.public.home.flash']}"/>" />>
> 
> Now, however, I have an equally ugly solution that works: 
> 
><param name="movie" value="<span jsfid="outputText" value="
>#{webappLabels['imagePath.public.home.flash']}" allowbody="false"></span>"
>/>
> 
> Is there a more elegant way to use EL in clay outside the known components, 
> or would I need to build my own component? 
> 

Have you tried just dropping in the EL?  This will probably work 
because clay loads markup that it can not map to a JSF component 
in an outputText component. This is like an implicit f:verbatim.  It 
scans the "value" looking for EL.  If the value, containing markup 
contains EL, it creates a value binding to resolve the expression.

Consider:
<param name="movie" 
  value="#{webappLabels['imagePath.public.home.flash']}"/>


Another option, if you didn't want to create your own component,  
would be to use the "shapeValidator" method binding event callback 
on the clay component.  This option allows you to build the config
beans used to shape the subtree under the clay component.  One
example of this is the "clayOut".  Consider the following XML
definition:


<component jsfid="clayOut" extends="clay">
    <description>
       This component is similar to the c:out tag.  The value can be 
       processed for special XML characters.  It can be used for
       inline html.
    </description>
    <attributes>
      <set name="shapeValidator" bindingType="MB" 
                                 value="#{ClayAmalgam.clayOut}">
        <description>A runtime callback event that takes the 
          value attribute and sets it to the value attribute of a 
           verbatim component (outputText).  
        </description>
      </set> 
      <set name="value" bindingType="None">
        <description>The string content that will populate 
          the value of a verbatim component. The value is 
          decoded from escaped symbols depending on the 
          escapeXml attribute.
        </description>
      </set>
      <set name="excapeXml" bindingType="None" 
                                    value="true">
        <description>A boolean flag that determines if the 
           string content of the value attribute will be processed 
           for special symbols.  A false value will trigger converting html 
           symbols into the character equivalence.  A true value will 
           escape the special html characters into corresponding symbols.
        </description>
      </set>
    </attributes>
  </component>	


The value of the "shapeValidator" method binding event, 
"#{ClayAmalgam.clayOut}", binds to the "clayOut" method on the
"ClayAmalgam" managed bean [1]. 
 
In some cases, it is more smiple to create a JSF component.  There 
are a couple examples of some simple components in the clay 
use cases, table pager [2], column sorter [3].

There renderers are in the same package [5] but if you are not trying to win
style points, you could generate the markup from the component.   

Next, register them in the faces-config.xml [6] and then in the 
clay-config.xml [7]

 <component jsfid="headerSorter"
      componentType="org.apache.shale.HeaderSorter">
  <attributes>
       <set name="sortBy" bindingType="VB" />
       <set name="ascImage" bindingType="VB" />
       <set name="descImage" bindingType="VB" />
       <set name="isFocus" bindingType="None" />
       <set name="value" bindingType="VB" />
  </attributes>
 </component>
 <component jsfid="clay:headerSorter" extends="headerSorter" />
 <component jsfid="webPager"
        componentType="org.apache.shale.WebPager">
  <attributes>
      <set name="prevPageStyleClass" bindingType="VB"
          value="linkPrev" />
      <set name="pageLinksStyleClass" bindingType="VB"
          value="links" />
      <set name="nextPageStyleClass" bindingType="VB"
          value="linkNext" />
      <set name="captionStyleClass" bindingType="VB"
          value="caption" />
  </attributes>
 </component>
 <component jsfid="clay:webPager" extends="webPager" />

 

[1] http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java?view=markup


[2] http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-usecases/src/main/java/org/apache/shale/usecases/rolodex/WebPager.java?view=markup


[4] http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-usecases/src/main/java/org/apache/shale/usecases/rolodex/HeaderSorter.java?view=markup


[5] http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-usecases/src/main/java/org/apache/shale/usecases/rolodex/

[6] http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/faces-config.xml?view=markup

[7] http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/clay-config.xml?view=markup



> Thanks, 
> Joost 


Gary

> -----Original Message----- 
> From: Gary VanMatre [mailto:gvanmatre@comcast.net] 
> Sent: Friday, June 01, 2007 2:15 AM 
> To: user@shale.apache.org 
> Subject: RE: Clay jsfid="form" not working 
> 
> >From: "JS Portal Support" 
> > 
> > The s in s:form here is the myfaces sandbox, not shale, as you probably 
> > already guessed. 
> > 
> 
> My guess is that it has to do with command components you are using 
> within the form. The "form" jsfid is the default JSF runtime component 
> where "s:form" is enhanced to work with all the tomahawk bells-and- 
> whistles. 
> 
> I'm not sure how it's related to the maven managed builds. Maybe it's 
> a difference in the tomahawk or myfaces jar since maven will pull the latest 
> snapshot? 
> 
> 
> Gary 
> 
> > -----Original Message----- 
> > From: JS Portal Support [mailto:support@jsportal.com] 
> > Sent: Thursday, May 31, 2007 3:31 PM 
> > To: user@shale.apache.org 
> > Subject: Clay jsfid="form" not working 
> > 
> > Hi, 
> > 
> > I just transitioned my projects over to use Maven. All works quite well 
> and 
> > I'm happy. However, I have a Clay form 
> > allowbody="true"> in which all links end up coming back to the page the 
> form 
> > resides on. When I change to use jsfid="s:form", all works fine. Can this 
> be 
> > due to a missing Maven dependency on the core JSF jar? I used the 
> > maven-myfaces-archetype to generate the project and thought that should 
> > setup the dependencies properly. Or could it be due to the clay config 
> > files? 
> > 
> > Does anyone have a clue what might cause this behaviour? 
> > 
> > Thanks, 
> > Joost 
> > 
> > 
> > 
> 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message