You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Matt Raible <ma...@raibledesigns.com> on 2004/08/03 02:46:53 UTC
DirectLink on a button and success messages
The DirectLink is handy component, but I'd like to use it the URL in an
onclick handler of a <button>. Is this easy to do - or do I need to
create a custom component? Is there a way to easily calculate the URL
to use in an onclick handler? Maybe something like:
<button onclick="location.href='calculate this'">Add New</button>
I can't find anything in the documentation on setting and retrieving
success messages. What is the communities consensus on a best practice
for adding/displaying success messages.
Thanks,
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Matt Raible <li...@raibledesigns.com>.
Got it working:
<span jwcid="@Block">
<a jwcid="addUserLink@DirectLink" listener="ognl:listeners.add">Link
Label</a>
</span>
<button jwcid="@Any" href="ognl:addLink"
onclick="location.href=this.href">Add User</button>
This seems like quite a hack to just get a link on a button. I guess I
need to research more on creating custom components.
Matt
On Aug 3, 2004, at 6:47 AM, Matt Raible wrote:
> Boy this seems like a lot of work to get a simple URL. Nevertheless,
> I tried it and got the following:
>
> Unable to parse expression ''location.href=\''+addLink+\'''. I tried
> onclick="ognl:addLink" and this puts the proper value - but I can't
> seem to get it work work right with the location.href in there too.
>
> .html
>
> <span jwcid="@Block">
> <a jwcid="addUserLink@DirectLink" listener="ognl:listeners.add">Link
> Label</a>
> </span>
>
> <button jwcid="@Any" onclick="ognl:'location.href=\''+addLink+\''">Add
> User</button>
>
> .java
>
> public String getAddLink() {
> IComponent directLinkComponent = getComponent("addUserLink");
>
> IEngineService service =
> getPage().getEngine().getService(Tapestry.DIRECT_SERVICE);
> ILink link =
> service.getLink(getPage().getRequestCycle(),
> directLinkComponent, null);
> return link.getURL();
> }
>
> Thanks,
>
> Matt
>
>
>
> On Aug 2, 2004, at 7:42 PM, Michael Henderson wrote:
>
>> Hi,
>>
>> I have not done exactly this yet but I have played around with
>> generating service URLs in code to do redirects to switch form HTTPS
>> to HTTP and back.
>>
>> There may be some whizz-bang javascript component in contrib that
>> will do it. otherwise, you need to make the URL string yourself and
>> make it part of the javascript via an ognl expression:
>>
>> <button jwcid="@Any"
>> onclick="ognl:'location.href=\''+targetURL+\''">Add New</button>
>>
>> The DirectLink you want to go to has to be on the same page or in the
>> same component somewhere, in a block to prevent rendering:
>>
>> <span jwcid="@Block">
>> <a jwcid="myLink@DirectLink"
>> listener="ognl:listeners.doMyThing">Link Label</a>
>> </span>
>>
>> with a method on the component:
>>
>> public String getTargetURL() {
>> IComponent directLinkComponent = getComponent("myLink")
>>
>> IEngineService service =
>> getPage().getEngine().getService(Tapestry.DIRECT_SERVICE);
>> ILink link = service.getLink(getPage().getRequestCycle(),
>> directLinkComponent, null);
>>
>> return link.getURL();
>> }
>>
>> This should give you a hyperlink with Javascript that directs the
>> browser to the result of the DirectLink listener method.
>>
>>
>> Mike
>>
>>
>> ---------------------------------------------------------------------
>> 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: DirectLink on a button and success messages
Posted by Matt Raible <li...@raibledesigns.com>.
Boy this seems like a lot of work to get a simple URL. Nevertheless, I
tried it and got the following:
Unable to parse expression ''location.href=\''+addLink+\'''. I tried
onclick="ognl:addLink" and this puts the proper value - but I can't
seem to get it work work right with the location.href in there too.
.html
<span jwcid="@Block">
<a jwcid="addUserLink@DirectLink" listener="ognl:listeners.add">Link
Label</a>
</span>
<button jwcid="@Any" onclick="ognl:'location.href=\''+addLink+\''">Add
User</button>
.java
public String getAddLink() {
IComponent directLinkComponent = getComponent("addUserLink");
IEngineService service =
getPage().getEngine().getService(Tapestry.DIRECT_SERVICE);
ILink link =
service.getLink(getPage().getRequestCycle(),
directLinkComponent, null);
return link.getURL();
}
Thanks,
Matt
On Aug 2, 2004, at 7:42 PM, Michael Henderson wrote:
> Hi,
>
> I have not done exactly this yet but I have played around with
> generating service URLs in code to do redirects to switch form HTTPS
> to HTTP and back.
>
> There may be some whizz-bang javascript component in contrib that will
> do it. otherwise, you need to make the URL string yourself and make it
> part of the javascript via an ognl expression:
>
> <button jwcid="@Any"
> onclick="ognl:'location.href=\''+targetURL+\''">Add New</button>
>
> The DirectLink you want to go to has to be on the same page or in the
> same component somewhere, in a block to prevent rendering:
>
> <span jwcid="@Block">
> <a jwcid="myLink@DirectLink" listener="ognl:listeners.doMyThing">Link
> Label</a>
> </span>
>
> with a method on the component:
>
> public String getTargetURL() {
> IComponent directLinkComponent = getComponent("myLink")
>
> IEngineService service =
> getPage().getEngine().getService(Tapestry.DIRECT_SERVICE);
> ILink link = service.getLink(getPage().getRequestCycle(),
> directLinkComponent, null);
>
> return link.getURL();
> }
>
> This should give you a hyperlink with Javascript that directs the
> browser to the result of the DirectLink listener method.
>
>
> Mike
>
>
> ---------------------------------------------------------------------
> 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: DirectLink on a button and success messages
Posted by Michael Henderson <mh...@mac.com>.
Hi,
I have not done exactly this yet but I have played around with
generating service URLs in code to do redirects to switch form HTTPS to
HTTP and back.
There may be some whizz-bang javascript component in contrib that will
do it. otherwise, you need to make the URL string yourself and make it
part of the javascript via an ognl expression:
<button jwcid="@Any"
onclick="ognl:'location.href=\''+targetURL+\''">Add New</button>
The DirectLink you want to go to has to be on the same page or in the
same component somewhere, in a block to prevent rendering:
<span jwcid="@Block">
<a jwcid="myLink@DirectLink" listener="ognl:listeners.doMyThing">Link
Label</a>
</span>
with a method on the component:
public String getTargetURL() {
IComponent directLinkComponent = getComponent("myLink")
IEngineService service =
getPage().getEngine().getService(Tapestry.DIRECT_SERVICE);
ILink link = service.getLink(getPage().getRequestCycle(),
directLinkComponent, null);
return link.getURL();
}
This should give you a hyperlink with Javascript that directs the
browser to the result of the DirectLink listener method.
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Scott Ellsworth <sc...@alodar.com>.
On Aug 3, 2004, at 10:45 AM, Erik Hatcher wrote:
> As for duplicate submissions - the token stuff, as far as I know, is
> not something built into Tapestry. Not quite related, but we use a
> custom submit component that uses JavaScript to disable the button
> immediately after it is pressed - otherwise hitting the button very
> quickly multiple times causes a page lock error. My current apps are
> not CRUD-style (thank goodness!), so duplicate submissions has not
> been a recent issue of mine - perhaps others building CRUD apps can
> post their techniques.
I have used a shared transaction list for things that dare not be
double submitted. This synchronizes, so I am sure that the db insert
for other submissions is done, and has a list by session id so I can
make sure that this particular button did not get double hit.
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Marcus Brito <mb...@gmail.com>.
> In reality,
> duplicate submits are a trivial problem IMO - something that should
> probably only be worried about when your users start doing them by
> mistake.
In other words, all the time.
-- MB
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: DirectLink on a button and success messages
Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
There's been a Bugzilla issue regarding this:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=30076
-Filip S. Adamsen
-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Wednesday, August 04, 2004 9:27 PM
To: Tapestry users
Subject: Re: DirectLink on a button and success messages
[...]
> Then my messages disappeared.
This I don't understand (yet).
[...]
So throwing a RedirectException here, you're saying, keeps the message
from persisting?
This must be bypassing the persistence of properties when such an
exception is thrown - I'm digging a bit myself to understand why this
happens. Howard? Anyone?
[...]
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Aug 4, 2004, at 10:38 AM, Matt Raible wrote:
>> Right... so <property-specification name="message" persistent="yes"/>
>> is the equivalent in Tapestry to put the message in session scope.
>> You can set it to null later if you like, to clear it out. Another
>> alternative, put a message on your visit object so you have a single
>> message, not per-page as would be the case with a persistent page
>> property-specification.
>
> I tried this and it seemed to work, and then I discovered that I
> PageRedirectException doesn't do a real redirect and I resorted back
> to using RedirectException.
Yeah, sorry about that. PageRedirectException is a confusing one, for
sure - and it is essentially the same as activating a page directly.
> Then my messages disappeared.
This I don't understand (yet).
> I figured it was more important to show messages than to prevent
> duplicate submits, so I reverted back to PageRedirectException - which
> seems to really be the same as cycle.activate("pageName"). The
> following works, but I'd prefer a true redirect (with
> RedirectException) since that seems to be the best way to avoid
> duplicate submits.
Maybe putting a single message in your visit that you manage is the
best approach for you?
> UserForm.save():
>
> UserList nextPage = (UserList) cycle.getPage("users");
> nextPage.setMessage(format("user.saved",
> getUser().getFullName()));
> throw new PageRedirectException(nextPage);
So throwing a RedirectException here, you're saying, keeps the message
from persisting?
This must be bypassing the persistence of properties when such an
exception is thrown - I'm digging a bit myself to understand why this
happens. Howard? Anyone?
> I agree that this is a good solution - but it doesn't solve the
> refresh-after-submit-creates-a-new-record problem. In reality,
> duplicate submits are a trivial problem IMO - something that should
> probably only be worried about when your users start doing them by
> mistake.
Agreed! "It breaks when I hit refresh".... "Ummm.... don't hit
Refresh!".
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Matt Raible <li...@raibledesigns.com>.
On Aug 3, 2004, at 11:45 AM, Erik Hatcher wrote:
> Right... so <property-specification name="message" persistent="yes"/>
> is the equivalent in Tapestry to put the message in session scope.
> You can set it to null later if you like, to clear it out. Another
> alternative, put a message on your visit object so you have a single
> message, not per-page as would be the case with a persistent page
> property-specification.
I tried this and it seemed to work, and then I discovered that I
PageRedirectException doesn't do a real redirect and I resorted back to
using RedirectException. Then my messages disappeared. I figured it
was more important to show messages than to prevent duplicate submits,
so I reverted back to PageRedirectException - which seems to really be
the same as cycle.activate("pageName"). The following works, but I'd
prefer a true redirect (with RedirectException) since that seems to be
the best way to avoid duplicate submits.
UserForm.save():
UserList nextPage = (UserList) cycle.getPage("users");
nextPage.setMessage(format("user.saved",
getUser().getFullName()));
throw new PageRedirectException(nextPage);
users.page:
<property-specification name="message" type="java.lang.String"
persistent="yes"/>
>
> As for duplicate submissions - the token stuff, as far as I know, is
> not something built into Tapestry. Not quite related, but we use a
> custom submit component that uses JavaScript to disable the button
> immediately after it is pressed - otherwise hitting the button very
> quickly multiple times causes a page lock error.
I agree that this is a good solution - but it doesn't solve the
refresh-after-submit-creates-a-new-record problem. In reality,
duplicate submits are a trivial problem IMO - something that should
probably only be worried about when your users start doing them by
mistake.
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Right... so <property-specification name="message" persistent="yes"/>
is the equivalent in Tapestry to put the message in session scope. You
can set it to null later if you like, to clear it out. Another
alternative, put a message on your visit object so you have a single
message, not per-page as would be the case with a persistent page
property-specification.
As for duplicate submissions - the token stuff, as far as I know, is
not something built into Tapestry. Not quite related, but we use a
custom submit component that uses JavaScript to disable the button
immediately after it is pressed - otherwise hitting the button very
quickly multiple times causes a page lock error. My current apps are
not CRUD-style (thank goodness!), so duplicate submissions has not been
a recent issue of mine - perhaps others building CRUD apps can post
their techniques.
Erik
On Aug 3, 2004, at 12:08 PM, Matt Raible wrote:
> In Struts, WebWork and Spring MVC - I've simply stuffed the messages
> into the session, then removed them after displaying them in the next
> page. Or I've used a Filter to remove them from the session and stuff
> them into the request for display on the next page. Using a redirect
> seems to be the easiest way to prevent duplicate submission - although
> all 3 frameworks mentioned have other ways of preventing duplicate
> submissions.
>
> Matt
>
> On Aug 3, 2004, at 9:54 AM, Erik Hatcher wrote:
>
>> Matt - just out of curiosity, in your other framework examples, how
>> have you handled the duplicate submission issue and message issues?
>> You could make the message a persistent page property as a first
>> pass, and still use the RedirectException (although
>> PageRedirectException is probably more appropriate).
>>
>> I don't really recommend persistent properties though as I prefer to
>> keep things stateless, but it is one possible way to achieve what
>> you're after.
>>
>> 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: DirectLink on a button and success messages
Posted by Matt Raible <li...@raibledesigns.com>.
In Struts, WebWork and Spring MVC - I've simply stuffed the messages
into the session, then removed them after displaying them in the next
page. Or I've used a Filter to remove them from the session and stuff
them into the request for display on the next page. Using a redirect
seems to be the easiest way to prevent duplicate submission - although
all 3 frameworks mentioned have other ways of preventing duplicate
submissions.
Matt
On Aug 3, 2004, at 9:54 AM, Erik Hatcher wrote:
> Matt - just out of curiosity, in your other framework examples, how
> have you handled the duplicate submission issue and message issues?
> You could make the message a persistent page property as a first pass,
> and still use the RedirectException (although PageRedirectException is
> probably more appropriate).
>
> I don't really recommend persistent properties though as I prefer to
> keep things stateless, but it is one possible way to achieve what
> you're after.
>
> Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Matt - just out of curiosity, in your other framework examples, how
have you handled the duplicate submission issue and message issues?
You could make the message a persistent page property as a first pass,
and still use the RedirectException (although PageRedirectException is
probably more appropriate).
I don't really recommend persistent properties though as I prefer to
keep things stateless, but it is one possible way to achieve what
you're after.
Erik
On Aug 3, 2004, at 11:44 AM, Warner Onstine wrote:
> Hmm, I'm not sure. I haven't delved into that area of Tapestry yet.
>
> -warner
>
> On Aug 3, 2004, at 8:20 AM, Matt Raible wrote:
>
>> Warner,
>>
>> You tutorial has been a great help to me - thanks! The method you
>> describe will work, but simply activating the next page does not
>> prevent double-submission. If I use cycle.active("users") where
>> "users" is my list screen, and refresh after saving - I end up with
>> two entries. Is there an easy way to fix this? I found using a
>> RedirectException works - but then I can't talk to my page to set
>> messages on it. I search the archives for duplicate posts, but
>> couldn't find anything.
>>
>> Thanks,
>>
>> Matt
>>
>>
>> On Aug 2, 2004, at 9:31 PM, Warner Onstine wrote:
>>
>>> That would certainly work. If you look at my tutorial on the
>>> editDVD() and newDVD listener methods I grab the next page object
>>> (which is the list), if I added in a getMessage and setMessage to
>>> that list I could then add in the success message prior to opening
>>> the page.
>>>
>>> Then you could use something like this:
>>> <span jwcid="@Insert" value="ognl:message"/>
>>>
>>> You should be able to do a Conditional as well to check if it is
>>> empty, I just don't know what the exact syntax would be.
>>>
>>> -warner
>>>
>>> On Aug 2, 2004, at 8:07 PM, Matt Raible wrote:
>>>
>>>> On Aug 2, 2004, at 8:58 PM, Alex wrote:
>>>>>
>>>>>> I can't find anything in the documentation on setting and
>>>>>> retrieving
>>>>>> success messages. What is the communities consensus on a best
>>>>>> practice
>>>>>> for adding/displaying success messages.
>>>>>>
>>>>>
>>>>> You can build a common message page to do so, just like the message
>>>>> box api in the win32.
>>>>
>>>> I tend to display success messages at the top of my list screens.
>>>> For instance, after a user has clicked save, they are redirected to
>>>> the user list page and a message is displayed. Example at
>>>> http://demo.raibledesigns.com/myusers/users.html.
>>>>
>>>> I'm assuming I could add get/setMessage methods to my UserList.java
>>>> class and display that if it's not null. Is that how other folks
>>>> are displaying success messages?
>>>>
>>>> Matt
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> -
>>>> 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
Re: DirectLink on a button and success messages
Posted by Warner Onstine <wa...@warneronstine.com>.
Hmm, I'm not sure. I haven't delved into that area of Tapestry yet.
-warner
On Aug 3, 2004, at 8:20 AM, Matt Raible wrote:
> Warner,
>
> You tutorial has been a great help to me - thanks! The method you
> describe will work, but simply activating the next page does not
> prevent double-submission. If I use cycle.active("users") where
> "users" is my list screen, and refresh after saving - I end up with
> two entries. Is there an easy way to fix this? I found using a
> RedirectException works - but then I can't talk to my page to set
> messages on it. I search the archives for duplicate posts, but
> couldn't find anything.
>
> Thanks,
>
> Matt
>
>
> On Aug 2, 2004, at 9:31 PM, Warner Onstine wrote:
>
>> That would certainly work. If you look at my tutorial on the
>> editDVD() and newDVD listener methods I grab the next page object
>> (which is the list), if I added in a getMessage and setMessage to
>> that list I could then add in the success message prior to opening
>> the page.
>>
>> Then you could use something like this:
>> <span jwcid="@Insert" value="ognl:message"/>
>>
>> You should be able to do a Conditional as well to check if it is
>> empty, I just don't know what the exact syntax would be.
>>
>> -warner
>>
>> On Aug 2, 2004, at 8:07 PM, Matt Raible wrote:
>>
>>> On Aug 2, 2004, at 8:58 PM, Alex wrote:
>>>>
>>>>> I can't find anything in the documentation on setting and
>>>>> retrieving
>>>>> success messages. What is the communities consensus on a best
>>>>> practice
>>>>> for adding/displaying success messages.
>>>>>
>>>>
>>>> You can build a common message page to do so, just like the message
>>>> box api in the win32.
>>>
>>> I tend to display success messages at the top of my list screens.
>>> For instance, after a user has clicked save, they are redirected to
>>> the user list page and a message is displayed. Example at
>>> http://demo.raibledesigns.com/myusers/users.html.
>>>
>>> I'm assuming I could add get/setMessage methods to my UserList.java
>>> class and display that if it's not null. Is that how other folks
>>> are displaying success messages?
>>>
>>> Matt
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
Re: DirectLink on a button and success messages
Posted by Matt Raible <li...@raibledesigns.com>.
Warner,
You tutorial has been a great help to me - thanks! The method you
describe will work, but simply activating the next page does not
prevent double-submission. If I use cycle.active("users") where
"users" is my list screen, and refresh after saving - I end up with two
entries. Is there an easy way to fix this? I found using a
RedirectException works - but then I can't talk to my page to set
messages on it. I search the archives for duplicate posts, but
couldn't find anything.
Thanks,
Matt
On Aug 2, 2004, at 9:31 PM, Warner Onstine wrote:
> That would certainly work. If you look at my tutorial on the editDVD()
> and newDVD listener methods I grab the next page object (which is the
> list), if I added in a getMessage and setMessage to that list I could
> then add in the success message prior to opening the page.
>
> Then you could use something like this:
> <span jwcid="@Insert" value="ognl:message"/>
>
> You should be able to do a Conditional as well to check if it is
> empty, I just don't know what the exact syntax would be.
>
> -warner
>
> On Aug 2, 2004, at 8:07 PM, Matt Raible wrote:
>
>> On Aug 2, 2004, at 8:58 PM, Alex wrote:
>>>
>>>> I can't find anything in the documentation on setting and retrieving
>>>> success messages. What is the communities consensus on a best
>>>> practice
>>>> for adding/displaying success messages.
>>>>
>>>
>>> You can build a common message page to do so, just like the message
>>> box api in the win32.
>>
>> I tend to display success messages at the top of my list screens.
>> For instance, after a user has clicked save, they are redirected to
>> the user list page and a message is displayed. Example at
>> http://demo.raibledesigns.com/myusers/users.html.
>>
>> I'm assuming I could add get/setMessage methods to my UserList.java
>> class and display that if it's not null. Is that how other folks are
>> displaying success messages?
>>
>> Matt
>>
>>
>> ---------------------------------------------------------------------
>> 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: DirectLink on a button and success messages
Posted by Warner Onstine <sw...@warneronstine.com>.
That would certainly work. If you look at my tutorial on the editDVD()
and newDVD listener methods I grab the next page object (which is the
list), if I added in a getMessage and setMessage to that list I could
then add in the success message prior to opening the page.
Then you could use something like this:
<span jwcid="@Insert" value="ognl:message"/>
You should be able to do a Conditional as well to check if it is empty,
I just don't know what the exact syntax would be.
-warner
On Aug 2, 2004, at 8:07 PM, Matt Raible wrote:
> On Aug 2, 2004, at 8:58 PM, Alex wrote:
>>
>>> I can't find anything in the documentation on setting and retrieving
>>> success messages. What is the communities consensus on a best
>>> practice
>>> for adding/displaying success messages.
>>>
>>
>> You can build a common message page to do so, just like the message
>> box api in the win32.
>
> I tend to display success messages at the top of my list screens. For
> instance, after a user has clicked save, they are redirected to the
> user list page and a message is displayed. Example at
> http://demo.raibledesigns.com/myusers/users.html.
>
> I'm assuming I could add get/setMessage methods to my UserList.java
> class and display that if it's not null. Is that how other folks are
> displaying success messages?
>
> Matt
>
>
> ---------------------------------------------------------------------
> 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: DirectLink on a button and success messages
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
We have a get/setMessage on our custom base page that we always extend
from that we use for this very purpose. Our Border component shows
this message on *all* pages, if it is non-null (and of course wrap it
in a <div> with a CSS id, so our customers can tweak how it is shown
easily).
I believe the Workbench or VLib demo app has a similar type of
construct.
Erik
On Aug 2, 2004, at 11:07 PM, Matt Raible wrote:
> On Aug 2, 2004, at 8:58 PM, Alex wrote:
>>
>>> I can't find anything in the documentation on setting and retrieving
>>> success messages. What is the communities consensus on a best
>>> practice
>>> for adding/displaying success messages.
>>>
>>
>> You can build a common message page to do so, just like the message
>> box api in the win32.
>
> I tend to display success messages at the top of my list screens. For
> instance, after a user has clicked save, they are redirected to the
> user list page and a message is displayed. Example at
> http://demo.raibledesigns.com/myusers/users.html.
>
> I'm assuming I could add get/setMessage methods to my UserList.java
> class and display that if it's not null. Is that how other folks are
> displaying success messages?
>
> Matt
>
>
> ---------------------------------------------------------------------
> 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: DirectLink on a button and success messages
Posted by phillip rhodes <rh...@yahoo.com>.
This is what I do, not saying it's the best, but it
works.
I use a BasePage that all my application pages
subclass.
In my BasePage, I have 2 java.util.Lists, with getter
and setter methods
private List errorMessages = new ArrayList();
private List operationMessages = new ArrayList();
As I encounter errors, or want to inform the user that
so and so was successful, I just add a message to the
list.
getOperationMessages().add("Shopping cart saved");
or
getErrorMessages().add("Product ID not found");
<span jwcid="@Conditional" condition="ognl:!
errorMessages.empty">
<table>
<tr jwcid="@Foreach" source="ognl:errorMessages"
value="ognl:operationMessage" element="tr">
<td>
<span jwcid="@Insert" value="ognl:errorMessage"/>
</td>
</tr>
</table>
</span>
<span jwcid="@Conditional" condition="ognl:!
operationMessages.empty">
<table>
<tr jwcid="@Foreach" source="ognl:operationMessages"
value="ognl:operationMessage" element="tr">
<td>
<span jwcid="@Insert" value="ognl:operationMessage"/>
</td>
</tr>
</table>
</span>
in my detach method for the page, I clear the lists...
Don't forget to declare your errorMessage and
operation Message in the page spec.
<property-specification name="errorMessage"
type="java.lang.String"/>
<property-specification name=operationMessage"
type="java.lang.String"/
--- Matt Raible <li...@raibledesigns.com> wrote:
> On Aug 2, 2004, at 8:58 PM, Alex wrote:
> >
> >> I can't find anything in the documentation on
> setting and retrieving
> >> success messages. What is the communities
> consensus on a best
> >> practice
> >> for adding/displaying success messages.
> >>
> >
> > You can build a common message page to do so, just
> like the message
> > box api in the win32.
>
> I tend to display success messages at the top of my
> list screens. For
> instance, after a user has clicked save, they are
> redirected to the
> user list page and a message is displayed. Example
> at
> http://demo.raibledesigns.com/myusers/users.html.
>
> I'm assuming I could add get/setMessage methods to
> my UserList.java
> class and display that if it's not null. Is that
> how other folks are
> displaying success messages?
>
> Matt
>
>
>
---------------------------------------------------------------------
> 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: DirectLink on a button and success messages
Posted by Matt Raible <li...@raibledesigns.com>.
On Aug 2, 2004, at 8:58 PM, Alex wrote:
>
>> I can't find anything in the documentation on setting and retrieving
>> success messages. What is the communities consensus on a best
>> practice
>> for adding/displaying success messages.
>>
>
> You can build a common message page to do so, just like the message
> box api in the win32.
I tend to display success messages at the top of my list screens. For
instance, after a user has clicked save, they are redirected to the
user list page and a message is displayed. Example at
http://demo.raibledesigns.com/myusers/users.html.
I'm assuming I could add get/setMessage methods to my UserList.java
class and display that if it's not null. Is that how other folks are
displaying success messages?
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: DirectLink on a button and success messages
Posted by Alex <al...@gmail.com>.
> The DirectLink is handy component, but I'd like to use it the URL in an
> onclick handler of a <button>. Is this easy to do - or do I need to
> create a custom component? Is there a way to easily calculate the URL
> to use in an onclick handler? Maybe something like:
>
> <button onclick="location.href='calculate this'">Add New</button>
If you use this alot, you'd better creating a new compoent.,
otherwise, you can just add a method in you page class and use ognl to
access it.
> I can't find anything in the documentation on setting and retrieving
> success messages. What is the communities consensus on a best practice
> for adding/displaying success messages.
>
You can build a common message page to do so, just like the message
box api in the win32.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org