• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Generating URL dynamically [Solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating URL dynamically [Solved]


  • Subject: Re: Generating URL dynamically [Solved]
  • From: Jacky Gagnon <email@hidden>
  • Date: Thu, 5 Feb 2004 10:52:06 -0500

Hi,

I've found a solution to my problem:

-Ideally you code it into a sub WOComponent to have a better separation
of the logic for the string generated and the page.

-When you insert URLs in your text (the string returned to the
WOString),  you can generate it like this:

...a loop for inserting html code in your string... {

...

context().incrementLastElementIDComponent(); //for updating the element
ID (the number you see at the end of componentActionURL (ex: 0.1.1.2)
or you can use appendElementIDComponent too if you want (ex:
0.1.1.myAction1).

String actionID = context().contextID()  +  "." + context().elementID()
; //create a string containing the last part of the URL
(contextID.senderID)
actionsIDs.addObject(actionID);  //Add it to a collection NSSet,
NSArray or NSDictionary...you can associate it with an action

String urlGenerated = context().componentActionURL();

...and insert it to your String buffer with html tags...

...

}


-Subclass Invoke Action:

     public WOActionResults invokeAction(WORequest aRequest, WOContext
aContext)
     {
       NSArray requestHandlerPathArray =
aRequest.requestHandlerPathArray();
       String actionID = (String)
requestHandlerPathArray.objectAtIndex(1); //to get a string containing
the "contextID.senderID"

       //Is this actionID is a member of the set (or other collection)?
if the answer is yes, call you action, else call the super method
       if ( mesActionsID.member(actionID) == null )
          return super.invokeAction(aRequest, aContext);
        else  return myAction();
     }


If you have comment, modification, or other idea post it...

Thanks all!

Jacky Gagnon




Le Mercredi, 4 fivr 2004, ` 15:51 America/Montreal, Chuck Hill a icrit :

> Then you want context.componentActionUrl
>
>
> At 03:29 PM 04/02/2004 -0500, Jacky Gagnon wrote:
>> Hi, Jonathan
>>
>> I already looked for WOActionURL;  but it's essential that I create
>> the
>> URL in the java code  (I must insert some URLs in a String and return
>> it for display, and the URL must launch a component action).
>> WOActionURL don't seem to be useful in my case or I'm missing
>> somethings...
>>
>> Thanks!
>>
>> J. Gagnon
>>
>> Le Mercredi, 4 fivr 2004, ` 14:51 America/Montreal, Jonathan Rochkind
>> a
>> icrit :
>>
>>> The WOActionURL dynamic element is probably what you are looking for.
>>> There is a thread on this topic on the list right now.  You may want
>>> to review it.
>>>
>>> At 1:49 PM -0500 2/4/04, Jacky Gagnon wrote:
>>>> Hi,
>>>>
>>>> I must generate some HTML code dynamically and insert it into some
>>>> strings, who are displayed with one WOString.  I want to insert some
>>>> URL who can point to a particular component action.
>>>>
>>>> How can I generate this URL without using a WoComponent ?  I found
>>>> in
>>>> WOContext, directActionURLForActionNamed, but its for direct action.
>>>>
>>>> Thanks
>>>>
>>>> J. Gagnon
>>>> _______________________________________________
>>>> webobjects-dev mailing list | email@hidden
>>>> Help/Unsubscribe/Archives:
>>>> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>>>> Do not post admin requests to the list. They will be ignored.
>> _______________________________________________
>> webobjects-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>> Do not post admin requests to the list. They will be ignored.
>>
>
> --
>
> Chuck Hill                                 email@hidden
> Global Village Consulting Inc.
> http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Generating URL dynamically (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Java 1.4.2 Update ..... safe for WO
  • Next by Date: How To Check Attribute's Width Programmatically?
  • Previous by thread: Re: Generating URL dynamically
  • Next by thread: Re: Generating URL dynamically
  • Index(es):
    • Date
    • Thread