You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joe Andolina <jo...@andomation.com> on 2005/01/11 08:20:06 UTC

Param Passing and Runtime Order

Hello,
    Its been smooth sailing for a while but I hit a snag. My .page is 
including a search listing component. None of the params are getting 
from the page to the component.

My .page has the following lines

<component id="productList" type="SearchResult">
        <binding name="productType" expression="page.productType" />
        <binding name="searchString" expression="page.searchString" />
</component>

My .jwc has the following lines:

<parameter name="productType" type="java.lang.String" required="yes" 
direction="in"/>
<parameter name="searchString" type="java.lang.String" required="yes" 
direction="in"/>

The parameters are serviced by abstract functions that seem to be 
getting created properly. My issue is that I have put a Sys.out in the 
pages getPropertyType method and I dont see that in the server console 
till after a get a stacktrace complaining about nulls when I try to 
reference the params.

When is 3.1 being released?

Joe

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


Re: Param Passing and Runtime Order

Posted by Douglas Hubler <dh...@pingtel.com>.
Joe Andolina wrote: 

>    Its been smooth sailing for a while but I hit a snag. My .page is 
> including a search listing component. None of the params are getting 
> from the page to the component.

Are you trying to access your parameters in "pageBeginRender" or 
"prepareForRender"?  If so, you must use "prepareForRender" and you must 
call super.prepareForRender as first line in method body.  I have to 
thank my co-worker for finding this and Howard's book for mentioning it.

Declaring auto may also work, but my objects were not primative types 
and I didn't want to write my own binding for such a simple requirement.



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


Re: Page redirecting on client side

Posted by kranga <kr...@k2d2.org>.
Thanks - should be simple to introduce a helper method into my page base
class. I tried using the ExternalPage service, but then I'd be forced to
make everything an external class. This is a better solution. I didn't want
my entire application to refer to the login URL!!!

----- Original Message ----- 
From: "Paul Ferraro" <pm...@columbia.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, January 11, 2005 9:00 PM
Subject: Re: Page redirecting on client side


> Throwing PageRedirectException sure seems to be throwing a lot of
> confusion...
> PageRedirectException is caught in AbstractEngine.service().  When
> caught, it performs a requestCycle.activate() on the specified page,
> discards any existing output, and then renders that page.
> To perform a client-side redirect, you need to throw a
> RedirectException.  Since RedirectException is constructed with a full
> URL, you'll need to generate the appropriate Tapestry URL manually.
>
> e.g. To perform a redirect to a page:
>
> String page = // Page to which I'd like to redirect
> String url =
>
requestCycle.getEngine().getService(Tapestry.PAGE_SERVICE).getLink(requestCy
cle,
> requestCycle.getPage(), new String[] { page }).getURL();
> throw new RedirectException(url);
>
> This is an area that I hope to streamline in 3.1.
>
> Paul
>
> kranga wrote:
>
> >I thought throwing a PageRedirectException() will cause  a client-side
> >redirect. Is that true? I'm not seeing that. If not, how do I do a
> >client-side URL to a valid Tapestry page using the target page's name?
> >
> >Thanks
> >
> >
> >---------------------------------------------------------------------
> >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


Re: Page redirecting on client side

Posted by Paul Ferraro <pm...@columbia.edu>.
Throwing PageRedirectException sure seems to be throwing a lot of 
confusion...
PageRedirectException is caught in AbstractEngine.service().  When 
caught, it performs a requestCycle.activate() on the specified page, 
discards any existing output, and then renders that page.
To perform a client-side redirect, you need to throw a 
RedirectException.  Since RedirectException is constructed with a full 
URL, you'll need to generate the appropriate Tapestry URL manually.

e.g. To perform a redirect to a page:

String page = // Page to which I'd like to redirect
String url = 
requestCycle.getEngine().getService(Tapestry.PAGE_SERVICE).getLink(requestCycle, 
requestCycle.getPage(), new String[] { page }).getURL();
throw new RedirectException(url);

This is an area that I hope to streamline in 3.1.

Paul

kranga wrote:

>I thought throwing a PageRedirectException() will cause  a client-side
>redirect. Is that true? I'm not seeing that. If not, how do I do a
>client-side URL to a valid Tapestry page using the target page's name?
>
>Thanks
>
>
>---------------------------------------------------------------------
>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


Re: Page redirecting on client side

Posted by Jonathan Millett <jo...@millett.net>.
PageRedirectException just activates a new page internally within the 
current request cycle.
Try throwing a RedirectException instead.  Pass a url that starts with 
"/" or contains "://" to generate a temporary redirect (3xx) response to 
the browser.
You can generate the url using PageService.getLink() method.

For Example:
Object[] parameters = {"MyPage"};
throw new RedirectException(engine.getService("page").getLink(cycle, 
this, parameters).getAbsoluteURL());

Cheers,
Jon

kranga wrote:

>I thought throwing a PageRedirectException() will cause  a client-side
>redirect. Is that true? I'm not seeing that. If not, how do I do a
>client-side URL to a valid Tapestry page using the target page's name?
>
>Thanks
>


Page redirecting on client side

Posted by kranga <kr...@k2d2.org>.
I thought throwing a PageRedirectException() will cause  a client-side
redirect. Is that true? I'm not seeing that. If not, how do I do a
client-side URL to a valid Tapestry page using the target page's name?

Thanks


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


Re: property spec

Posted by Paul Ferraro <pm...@columbia.edu>.
If setX() is never called then you don't need to specify a 
property-specification at all.

Paul

Alexey Romanchuk wrote:

>Hello guys!
>
>when i use property-specification i must implement (or leave abstract)
>both   getter   and  setter. is there simple way to write just getter?
>example:
>
>i wanna write just:
>public Integer getX() {
>       //some code
>       return x;
>}
>
>but i must write:
>public Integer getX() {
>       //some code
>       return x;
>}
>
>public setX(Integer i) {
>       //blank
>}
>
>
>---------------------------------------------------------------------
>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


property spec

Posted by Alexey Romanchuk <ui...@gorodok.net>.
Hello guys!

when i use property-specification i must implement (or leave abstract)
both   getter   and  setter. is there simple way to write just getter?
example:

i wanna write just:
public Integer getX() {
       //some code
       return x;
}

but i must write:
public Integer getX() {
       //some code
       return x;
}

public setX(Integer i) {
       //blank
}


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


Re: @MultipleCheckBox

Posted by Paul Ferraro <pm...@columbia.edu>.
Check out contrib:MultiplePropertySelection.

Paul

sarah.simbad@women-at-work.org wrote:

>Hi there!
>
>I am after a simple component that can be used in a single line of
>code within html template that will produce a multiple checkbox.
>
>For instance like:
>
><span jwcid="@MultipleCheckbox" value="ongl:chosenItems"
>source="ognl:allItems" columns="3"/>
>
>so that you can do:
>
>- setChosenItems (List list)
>- List getChosenItems
>
>
>and produce html like that:
><table border=0>
><tr>
><td>
><input type="checkbox" name="bla" value="1">Salami
></td>
><td>
><input type="checkbox" name="bla" value="32">Pilze
></td>
><td>
><input type="checkbox" name="bla" value="211">Sardellen
></td>
></tr>
><tr>...
>
>
>How would I start doing that? Who gives the checkbox a name?
>And how would I find out which values have been selected?
>
>---------------------------------------------------------------------
>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


@MultipleCheckBox

Posted by sa...@women-at-work.org.
Hi there!

I am after a simple component that can be used in a single line of
code within html template that will produce a multiple checkbox.

For instance like:

<span jwcid="@MultipleCheckbox" value="ongl:chosenItems"
source="ognl:allItems" columns="3"/>

so that you can do:

- setChosenItems (List list)
- List getChosenItems


and produce html like that:
<table border=0>
<tr>
<td>
<input type="checkbox" name="bla" value="1">Salami
</td>
<td>
<input type="checkbox" name="bla" value="32">Pilze
</td>
<td>
<input type="checkbox" name="bla" value="211">Sardellen
</td>
</tr>
<tr>...


How would I start doing that? Who gives the checkbox a name?
And how would I find out which values have been selected?

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


Re: Param Passing and Runtime Order

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 11, 2005, at 12:07 PM, Joe Andolina wrote:

> Thanks! That was it!
> Now why do those params need "auto" when all the other params in my 
> system are "in"?

Would you be satisfied if I said "just because"?!  :)   Parameter 
directions are going away in Tapestry 3.1.

The trickier answer is that 'auto' parameters are set for a longer 
scope than in parameters, and you were surely trying to use an 'in' 
parameter out of its cope.

	Erik

>
> Joe
>
> Erik Hatcher wrote:
>
>>
>> On Jan 11, 2005, at 2:20 AM, Joe Andolina wrote:
>>
>>> My .jwc has the following lines:
>>>
>>> <parameter name="productType" type="java.lang.String" required="yes" 
>>> direction="in"/>
>>> <parameter name="searchString" type="java.lang.String" 
>>> required="yes" direction="in"/>
>>
>>
>> Try changing direction to "auto".
>>
>>> The parameters are serviced by abstract functions that seem to be 
>>> getting created properly. My issue is that I have put a Sys.out in 
>>> the pages getPropertyType method and I dont see that in the server 
>>> console till after a get a stacktrace complaining about nulls when I 
>>> try to reference the params.
>>
>>
>> I presume you meant getProductType method?
>>
>> In what method are you getting an exception?
>>
>>> When is 3.1 being released?
>>
>>
>> Who knows?!   Howard posted a tentative timeline the other day 
>> (probably on the -dev list, -user/-dev blur together for me).  The 
>> -dev list and the wiki are the places where this information is 
>> disseminated.  3.1 is far from ready - it'll be months.
>>
>>     Erik
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: Param Passing and Runtime Order

Posted by Joe Andolina <jo...@andomation.com>.
Thanks! That was it!
Now why do those params need "auto" when all the other params in my 
system are "in"?

Joe

Erik Hatcher wrote:

>
> On Jan 11, 2005, at 2:20 AM, Joe Andolina wrote:
>
>> My .jwc has the following lines:
>>
>> <parameter name="productType" type="java.lang.String" required="yes" 
>> direction="in"/>
>> <parameter name="searchString" type="java.lang.String" required="yes" 
>> direction="in"/>
>
>
> Try changing direction to "auto".
>
>> The parameters are serviced by abstract functions that seem to be 
>> getting created properly. My issue is that I have put a Sys.out in 
>> the pages getPropertyType method and I dont see that in the server 
>> console till after a get a stacktrace complaining about nulls when I 
>> try to reference the params.
>
>
> I presume you meant getProductType method?
>
> In what method are you getting an exception?
>
>> When is 3.1 being released?
>
>
> Who knows?!   Howard posted a tentative timeline the other day 
> (probably on the -dev list, -user/-dev blur together for me).  The 
> -dev list and the wiki are the places where this information is 
> disseminated.  3.1 is far from ready - it'll be months.
>
>     Erik
>
>
> ---------------------------------------------------------------------
> 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


Re: insert example with format

Posted by Alexey Romanchuk <ui...@gorodok.net>.
thanx!
it works fine now
> I think you have an extra dot after Home
> @blah.blah.pages.Home.@DATE_FORMAT
>
> Have you tried
>   @blah.blah.pages.Home@DATE_FORMAT
> ?
>


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


Re: insert example with format

Posted by Shing Hing Man <ma...@yahoo.com>.
I think you have an extra dot after Home
@blah.blah.pages.Home.@DATE_FORMAT

Have you tried 
  @blah.blah.pages.Home@DATE_FORMAT
?

Shing 


 --- lesha <ui...@gorodok.net> wrote: 
> i try to realize example in insert component with
> date format.
> and i have an error when try to pass formatter as
> static member
> using "@" character.
> and i have exception:
> 
> Unable to parse expression
> '@blah.blah.pages.Home.@DAE_FORMAT'.
> Malformed OGNL expression:
> @blah.blah.pages.Home.@DATE_FORMAT
> Encountered "@" at line 1, column 41. Was expecting:
> <IDENT> ...
> 
> here is my .page
> 
> <component id="insert2" type="Insert">
>          <binding name="value" expression="date"/>
>          <binding name="format"
>             
> expression="@blah.blah.pages.Home.@DATE_FORMAT"/>
> </component>
> 
> here is part from Home.java
> 
> public static final SimpleDateFormat DATE_FORMAT =
> new SimpleDateFormat(
>              "dd MMM yyyy");
> 
> 
> any ideas?
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
>  

=====
Home page :
  http://uk.geocities.com/matmsh/index.html


	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

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


insert example with format

Posted by lesha <ui...@gorodok.net>.
i try to realize example in insert component with date format.
and i have an error when try to pass formatter as static member
using "@" character.
and i have exception:

Unable to parse expression '@blah.blah.pages.Home.@DATE_FORMAT'.
Malformed OGNL expression: @blah.blah.pages.Home.@DATE_FORMAT
Encountered "@" at line 1, column 41. Was expecting: <IDENT> ...

here is my .page

<component id="insert2" type="Insert">
         <binding name="value" expression="date"/>
         <binding name="format"
             expression="@blah.blah.pages.Home.@DATE_FORMAT"/>
</component>

here is part from Home.java

public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
             "dd MMM yyyy");


any ideas?

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


Re: Param Passing and Runtime Order

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 11, 2005, at 2:20 AM, Joe Andolina wrote:
> My .jwc has the following lines:
>
> <parameter name="productType" type="java.lang.String" required="yes" 
> direction="in"/>
> <parameter name="searchString" type="java.lang.String" required="yes" 
> direction="in"/>

Try changing direction to "auto".

> The parameters are serviced by abstract functions that seem to be 
> getting created properly. My issue is that I have put a Sys.out in the 
> pages getPropertyType method and I dont see that in the server console 
> till after a get a stacktrace complaining about nulls when I try to 
> reference the params.

I presume you meant getProductType method?

In what method are you getting an exception?

> When is 3.1 being released?

Who knows?!   Howard posted a tentative timeline the other day 
(probably on the -dev list, -user/-dev blur together for me).  The -dev 
list and the wiki are the places where this information is 
disseminated.  3.1 is far from ready - it'll be months.

	Erik


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