Re: How do I restore the 'previous' page with DirectActions
Hi Chuck, thx for answering, On 20/nov/2009, at 14.08, Chuck Hill wrote: I want to return the same page a user is viewing after he clicks a directAction. Why a direct action? If the page is the result of a component action, why not use a component action. I want external referers to be able to link directly to a specific language of the website. Still... you pointed out an easy workaround for me. I can use the component action to swap the language and leave the direct one in place for external references... those coming from outside won't have a 'previous' page to be restored so I don't have to face the issue at all. I'd look in the headers for the referrer URL and use a WORedirect to that. Yeah but how do I restore the page if I'm missing the contextID? rdm ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I restore the 'previous' page with DirectActions
On Nov 21, 2009, at 10:31 AM, Riccardo De Menna wrote: Hi Chuck, thx for answering, On 20/nov/2009, at 14.08, Chuck Hill wrote: I want to return the same page a user is viewing after he clicks a directAction. Why a direct action? If the page is the result of a component action, why not use a component action. I want external referers to be able to link directly to a specific language of the website. Still... you pointed out an easy workaround for me. I can use the component action to swap the language and leave the direct one in place for external references... those coming from outside won't have a 'previous' page to be restored so I don't have to face the issue at all. I'd look in the headers for the referrer URL and use a WORedirect to that. Yeah but how do I restore the page if I'm missing the contextID? You don't restore the page, you use WORedirect to get the browser to request the URL again. Chuck -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How do I restore the 'previous' page with DirectActions
Hi all, Just a quickie... I want to return the same page a user is viewing after he clicks a directAction. Specifically I'm talking about a language switch link in the pageWrapper to change languages. I want a simple url like http://www.domain.com/cgi-bin/WebObjects/App.woa/wa/English What I'm doing atm is adding a link with the following binding: LanguageLink : WOHyperlink { directActionName = aLanguage; ?contextID = context.contextID; } And then in my DirectAction.class I'm intercepting it with: public WOActionResults performActionNamed(String anActionName) { ... // Do the language switching here ... String stringContextID = (String)req.formValueForKey(contextID); return s.restorePageForContextID(stringContextID); } This mostly works... but sometimes I get errors since for no apparent reason the WOHyperlink does not include the ?contextID thing sometimes. Am I doing it correctly? I just want the equivalent of returning null on a component based action. rdm ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I restore the 'previous' page with DirectActions
On Nov 20, 2009, at 11:38 AM, Riccardo De Menna wrote: Hi all, Just a quickie... I want to return the same page a user is viewing after he clicks a directAction. Why a direct action? If the page is the result of a component action, why not use a component action. Specifically I'm talking about a language switch link in the pageWrapper to change languages. I want a simple url like http://www.domain.com/cgi-bin/WebObjects/App.woa/wa/English What I'm doing atm is adding a link with the following binding: LanguageLink : WOHyperlink { directActionName = aLanguage; ?contextID = context.contextID; } And then in my DirectAction.class I'm intercepting it with: public WOActionResults performActionNamed(String anActionName) { ... // Do the language switching here ... String stringContextID = (String)req.formValueForKey(contextID); return s.restorePageForContextID(stringContextID); } This mostly works... but sometimes I get errors since for no apparent reason the WOHyperlink does not include the ?contextID thing sometimes. Am I doing it correctly? I just want the equivalent of returning null on a component based action. I'd look in the headers for the referrer URL and use a WORedirect to that. Chuck -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com