2007/3/31, Jacky Gagnon <[EMAIL PROTECTED]>:


On 07-03-30, at 17:13, Chuck Hill wrote:

> This sounds like a terrible idea.

Yes I know ;-)

> Why not use a WORepetition and some custom  components?  What are
> you trying to do that can't be done that way?

Its because I have already a Java class who can apply a complex
transformation to my text, I just have to give tags to insert (like
HTML, XML etc.)  and this class know how to process the text to
present the result. I just wanted to reuse it.

But if programmatically generate the HTML of subcomponent don't seem
a reasonable thing to do or its not easy, I will go for another
strategy  (I have a plan B for using WORepetition and custom
component :-)  but will need more work :-( ).

Thanks Chuck.


I think you should try to overwrite the WOComponent method

public WOElement
<http://developer.apple.com/documentation/webobjects/Reference/API/com/webobjects/appserver/WOElement.html>
*template*()

with:
public WOElement template()
   {
       return templateWithHTMLString(composeHTML(), composeWod(), null);
   }

where composeHTML() return a String with the html (webobjects tags
comprised)

and composeWod() return a String with the .woo file. This seems to work good
(I've managed it in a project that I DON'T have create so I'm not sure of
which problematics you should encounter).

I hope this help!


> Chuck
>
> On Mar 30, 2007, at 1:38 PM, Jacky Gagnon wrote:
>
>> Hi,
>>
>> I want to be able to generate HTML code from a WOComponent
>> programmatically and insert the response into a String (to be
>> display into a parent component).
>>
>> I tried something like this :
>>
>> public class ParentComponent extends WOComponent {
>>
>>      //A WOString will display the result
>>      public String getText()
>>      {
>>              while ( iNeedMoreSubcomponent )
>>              {
>>                      String htmlFromSubComponent =
generateHTMLOfSubcomponent();
>>
>>                      ... code where I insert the result of the sub
component into my
>> text ...
>>              }
>>              return text;
>>      }
>>
>>      //This sub component will contain component action and the result
>> will be inserted into the "text"...
>>      public String generateHTMLOfSubcomponent()
>>      {
>>                      WOComponent subComponent =
pageWithName("SubComponent");
>>                      String chaineHTML = resultAjax.generateResponse
().contentString();
>>
>>                      return chaineHTML;
>>      }
>>
>> }
>>
>> But the problem with this example is the value of context().page()
>> (was ParentComponent), who is replaced by the SubComponent (in my
>> case this will be a problem). If I create a new Context for the
>> sub component, I will lost my session.
>>
>> Is there a way to do this or I'm better to change strategy?
>>
>> Thanks in advance.
>>
>> Jacky
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/chill%
>> 40global-village.net
>>
>> This email sent to [EMAIL PROTECTED]
>
> --
>
> 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      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ildenae%40gmail.com

This email sent to [EMAIL PROTECTED]




--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to