You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by James Carroll <ji...@microbrightfield.com> on 2003/09/23 22:50:14 UTC

RE: simplest page parameters? (wicked newbie) SOLVED!

>> My preference has been to keep all non-UI specific items in the 
>> specification rather than in the template. That way the 
>> templates are 
>> not cluttered and there is a clean separation.

I would much rather have just two layers: presentation in the 
template.html, and control in the .java than have a third layer
inbetween that has to wire everything together.  If I want to
hide any complexity, I'll have more .jwc components.  But when
I look at the .html of the web component, I want to see 
exactly what's happening without looking back and forth between
the .html and the .page files.  I'm sure as my application gets
bigger, I'll put some options in the .page file so that I can
change look of many little components by changing one parameter
in the .page file.  

Thanks Chris and Howard.  (Chris, did you used to work at
ilovermont.com?)

And the winning combination is:

Home.page ----------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<page-specification class="tt.Home">
</page-specification>

Home.html ---------------------------------

<SPAN jwcid="border@Border" pageTitle="The Real Page Title Yeah Baby!">
    <P>Welcome to your first <b>Tapestry Application</b>.
    <p>The date is:<span jwcid="@Insert"
value="ognl:currentDate">01/01/2003</span>
    <p>Click <a jwcid="@PageLink" page="Home">here</a> to refresh.
</SPAN>

Home.java ----------------------------------

package tt;

import java.util.Date;
import org.apache.tapestry.html.BasePage;

public class Home extends BasePage
{
  public Date getCurrentDate()
  {
    return new Date();
  }
}

Border.jwc ---------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE component-specification
    PUBLIC "-//Apache Software Foundation//Tapestry Specification
3.0//EN"
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<component-specification allow-body="yes"
allow-informal-parameters="yes">
    <parameter name="pageTitle" direction="in" type="java.lang.String"
/>
</component-specification>

Border.html excerpt --------------------------------

<html> <head> <title><span jwcid="@Insert"
value="ognl:pageTitle">MicroBrightField Database</SPAN></title> </head>
<body jwcid="@Body" bgcolor="#312E69" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">

        <font face="Arial, Helvetica, sans-serif" size="+2"
color="WHITE">
        <SPAN jwcid="@Insert" value="ognl:pageTitle">
            Template Title
        </SPAN>
        </font>

Hello.application ----------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
  "-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
  "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<application
  name="Hello World Tutorial"
  engine-class="org.apache.tapestry.engine.SimpleEngine">

  <page name="Home" specification-path="/tt/Home.page"/>
  <component-alias type="Border" specification-path="//Border.jwc"/>
</application>

-----------------------------------------------------




> -----Original Message-----
> From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
> Sent: Tuesday, September 23, 2003 4:29 PM
> To: Tapestry users
> Subject: Re: simplest page parameters? (wicked newbie)
> 
> 
> Anything that effects the visual appearance of a component I 
> consider as 
> UI specific, like for example a dynamic CSS class value, 
> dynamic table 
> attributes, dynamic image sizes etc. Anything else goes in the 
> specification.
> 
> -Harish
> 
> Chris Norris wrote:
> 
> >How do you define something as being "non-UI specific"?  I'm 
> just wondering
> >because this seems like a good idea, but it's hard for me to 
> differentiate
> >between what's UI specific and what's not.  But it is a good 
> idea.  Many of
> >my .html files are kinda cluttered now.
> >
> >-chris
> >
> >-----Original Message-----
> >From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
> >Sent: Tuesday, September 23, 2003 3:11 PM
> >To: Tapestry users
> >Subject: Re: simplest page parameters? (wicked newbie)
> >
> >
> >
> >-Harish
> >
> >Chris Norris wrote:
> >
> >  
> >
> >>Oh, you still need a Home.page file.  I was just saying that those 
> >>things in particular could be done in the .html template.  
> I have lots 
> >>of .page files that are very empty now because much of the 
> component 
> >>definition is now in the .html template.  Some are just the page 
> >>specification and nothing else.
> >>
> >>-chris
> >>
> >>-----Original Message-----
> >>From: James Carroll [mailto:jim@microbrightfield.com]
> >>Sent: Tuesday, September 23, 2003 2:56 PM
> >>To: Tapestry users
> >>Subject: RE: simplest page parameters? (wicked newbie)
> >>
> >>
> >>
> >>Hi Chris,  Without the Home.page file, how
> >>do you do the equivalent of:
> >>  <page-specification class="tt.Home">
> >>
> >>(binding it to the class?)
> >>
> >>Thanks,
> >>-Jim
> >>
> >>
> >>
> >>
> >> 
> >>
> >>    
> >>
> >>>-----Original Message-----
> >>>From: Chris Norris [mailto:CNorris@widen.com]
> >>>Sent: Tuesday, September 23, 2003 3:21 PM
> >>>To: 'Tapestry users'
> >>>Subject: RE: simplest page parameters? (wicked newbie)
> >>>
> >>>
> >>>You can do this all in the html.  We do something like this:
> >>>
> >>><div jwcid="border@Border" pageTitle="Title of Page">
> >>>	<div jwcid="@Insert" value="ognl:components.border.pageTitle" />
> >>>
> >>>The insert will display "Title of Page".  To get a 
> paramater to the 
> >>>border component, your border.jwc needs something like this:
> >>>
> >>><parameter name="pageTitle" direction="in" 
> type="java.lang.String" />
> >>>
> >>>I hope that helps a little.
> >>>
> >>>-chris
> >>>
> >>>-----Original Message-----
> >>>From: James Carroll [mailto:jim@microbrightfield.com]
> >>>Sent: Tuesday, September 23, 2003 2:16 PM
> >>>To: Tapestry users
> >>>Subject: simplest page parameters? (wicked newbie)
> >>>
> >>>
> >>>
> >>>Hi,  I want to have a name, value pair in the .page file,
> >>>and to have that show up in the .html file.  Easy, no?
> >>>
> >>>I'm trying
> >>>
> >>>.html:
> >>>
> >>>  <span jwcid="pageTitle">The template Title</span>
> >>>
> >>>.page:
> >>>
> >>> <component id="pageTitle" type="Insert">
> >>>   <static-binding name="pageTitle" value="the real title" />  
> >>></component>
> >>>
> >>>But it tells me that my static binding needs a 'value' attribute 
> >>>(which is obviously there)
> >>>
> >>>The reason I'm not putting this in the page itself is 
> because I want 
> >>>to have a Border.html that shows a different title for 
> each page.  I
> >>>already have the Border.jwc and Border.html 
> >>>kinda working, but I can't figure out how to get a parameter
> >>>to the Border component.
> >>>
> >>>Thanks,
> >>>-jim
> >>>
> >>>-----------------------------------------------------------
> ----------
> >>>To unsubscribe, e-mail: 
> tapestry-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >>>
> >>>-----------------------------------------------------------
> ----------
> >>>To unsubscribe, e-mail: 
> tapestry-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >>>
> >>>
> >>>   
> >>>
> >>>      
> >>>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >>
> >>
> >> 
> >>
> >>    
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >
> >
> >  
> >
> 

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