Generating Pages completely from Java Code
Generating Pages completely from Java Code
- Subject: Generating Pages completely from Java Code
- From: Dmitri Barosnikov <email@hidden>
- Date: Mon, 07 Jun 2010 08:58:43 +0200
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden