Dynamically Generating Templates (Newbie)
Dynamically Generating Templates (Newbie)
- Subject: Dynamically Generating Templates (Newbie)
- From: Jason McInnes <email@hidden>
- Date: Wed, 11 Aug 2004 01:28:19 -0700 (PDT)
I am struggling a bit with how Webobjects uses
templates (.html and .wod files).
Specifically, I have a requirement that users need to
be able to specify the template that will be used for
a page. That is, say I have a Customer EO and it is
set on a WOComponent. The user wants to be able to
create several different templates combining static
elements with dynamic elements created from attributes
of the Customer EO. At run time, the user wants to be
able to select one of the templates to be used by the
component to generate its content. The goal is to not
have to create a .html, .wod, and particularly a .java
file for each template the user comes up with. I want
one .java file - one component - that I can give a
template to (and the target Customer EO), and it can
generate its content based on the template and the
Customer EO. (The user would enter the customer
number, select the template, and hit something like
"generate" and a page would come back that had the
Customer's information in the format specified by the
template the user had selected.)
I found in the javadoc for WOComponent the method
templateWithHTMLString which will accept an html
string and a declaration string, but I'm at a loss as
to what I can do with the result. First of all the
method is static, so I'm not calling it on a class
that I created with a Customer EO instance variable.
I've got this template, but how do I give it the
Customer EO? Alternatively, I was thinking I would set
it on my component java class, but there is no
setTemplate(WOElement) that I can see. And without
being able to give the WOElement the Customer EO, I
don't see how its appendToResponse method will give me
what I want.
Does anyone have experience with this area? Any
guidance would be appreciated!
(As an aside, I also don't understand what I am
supposed to pass in as the third argument to
templateWithHTMLString - aLanguageArray.)
Thanks!
Jason
=====
Jason McInnes
2 Degrees
Cell: 206.849.3680
Email: email@hidden
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
_______________________________________________
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.