Hi Dmitri.
The easiest way to achieve this is probably to transform your XML into html+wod
(or html inline syntax). Then override the template() method in your
WOComponent subclass to return a template generated dynamically from your
html+wod.
Example:
@Override
public WOElement template() {
String htmlString = createYourHTML();
String wodString = createYourWOD();
return WOComponent.templateWithHTMLString( "app", name(), htmlString,
wodString, NSArray.EmptyArray,
WOApplication.application().associationFactory(),
WOApplication.application().namespaceProvider() );
}
Cheers,
- hugi
On 7.6.2010, at 06:58, Dmitri Barosnikov wrote:
> Hi everyone,
>
> some question here. Is it possible to generate Pages completely out of java
> code, meaning WOD stays empty completely?
>
> The use case is following: i got some page descriptions in xml and need to
> build working page for this, so client can enter his data in this page. What
> i try to do now, is to place some WOForm+WOTextField+WOSubmitButton from java
> code directly in this page, and trying to get it work.
>
> Somehow it does not work :( Any of you made this maybe already?
>
> I give you some simple Example code from me so u get the idea what i try to
> do:
> I call in the appendToResponce of a page my method where i initialize
> elements:
>
> private void makeMyContent(WOResponse woresponse, WOContext wocontext) {
> if (!initialized) {
> log.info("INIT ALL FIELDS");
> makeHtmlBegin(woresponse, wocontext);
>
> // hier werden alle objecte initialisiert.
> woresponse.appendContentString("<form method=\"post\"
> name=\"editForm1\">");
>
> NSMutableDictionary nsdictionary = new NSMutableDictionary();
> WOAssociation association;
> nsdictionary = new NSMutableDictionary();
> // association =
> WOKeyValueAssociation.associationWithKeyPath("superString");
> nsdictionary.takeValueForKey(association, "value");
> // association =
> WOConstantValueAssociation.associationWithValue("superString");
> nsdictionary.takeValueForKey(association, "name");
> // WOTextField textField = new
> WOTextField("WOTextField", nsdictionary.immutableClone(), null);
> textField.appendToResponse(woresponse, wocontext);
> // nsdictionary = new NSMutableDictionary();
> // association =
> WOConstantValueAssociation.associationWithValue("onPressbutton");
> nsdictionary.takeValueForKey(association, "name");
> // association =
> WOConstantValueAssociation.associationWithValue("SUPER BUTTON");
> nsdictionary.takeValueForKey(association, "buttonLabel");
> // association =
> WOKeyValueAssociation.associationWithKeyPath("onPressbutton");
> nsdictionary.takeValueForKey(association, "action");
> // WOSubmitButton submitButton = new
> WOSubmitButton("WOSubmitButton", nsdictionary, this);
> submitButton.appendToResponse(woresponse, wocontext);
>
> woresponse.appendContentString("</form>");
>
> initialized = true;
>
> makeHtmlEnd(woresponse, wocontext);
> }
>
> }
>
>
> Than i try to run this code and dont get it to work, meaning when i press my
> button on the page i get completely new page back, no data will be forwarded
> into page.
>
> Any idea how i can begin the solution of this problem ?
>
> Dmitri
>
>
> __________ Hinweis von ESET Smart Security, Signaturdatenbank-Version 5177
> (20100606) __________
>
> E-Mail wurde geprüft mit ESET Smart Security.
>
> http://www.eset.com
>
>
> _______________________________________________
> 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/hugi%40karlmenn.is
>
> This email sent to [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]