Li Ma wrote:
> Hi,
>
> I'm a brand newbie of Java and Web programming. Only two months experience.
> During the two months coding with Servlets, ECS 1.2, Apache, JServ, I get
> the following suggestions about ECS. Because I'm a newbie, I will not be
> suprised at all if I'm actually wrong. Please feel free to point out any
> problem in the suggestions. In case I happen to be right, please also post
> your opinion.
>
> 1. We need a good HTML, XML compiler to compile HTML/XML code into Java
> classes represented by ECS classes. I know there's a html2ecs in ecs source
> code tree. It doesn't work well. I tried long time to make it compiled. Then
> the compiled version doesn't support unclosed HTML tag.
html2ecs was never meant to be a production ready tool merely a way of dumping
out what ecs code 'might' look like for example purposes only. It was and is a
hack i did it in like 45 minutes or 3 beers (which ever came first I don't
remember). I'm surprised people have gotten as much use out of it as they
have.
> There's very good
> reason to have a flexible, stable HTML/XML compiler. You must have heard
> people talking about seperating HTML design from coding.
There are much better ways of doing this.
> 2. We need easy access to HTML element referenced by element name. In my
> experience, after I build a HTML object, then add bunch of elements, I
> couldn't find a way to go back and assign value to one of those elements.
> The only way I can change vaue of an element is I have to keep a reference
> to that particular object. The following example can express my opinion
> clearer:
>
> HTML html = new HTML(...)
> .addElement(...)
> .addElement( new Input( Input.TEXT,
> "txtUserName", "") )
> ...;
>
>
> I didn't find a way to assign default value of the text field txtUserName to
> "Administrator".
Try naming all of your elements if you want to do method chaining and
retrieval.
Html html = new
Html().addElement("somelement",element).addElement("myinput",new
Input(Input.TEXT,"txtUserName",""));
// to fetch
html.getElement("somelement").getElement("myinput).addAttribute("value","Administrator");
// not sure if getElement is the actual name but their is/should be a named
retrieval mechanism
// if not i can add one trivially (since we support addElement("name",element)
and removeElement("name") it makes sense to support getElement("name")
// if it isn't already supported.
> Having the above two improvements, we can easily seperate web design and
> programing. A designer will generate HTML file by any HTML editor. Then
> programmer converts it into Java class, or serialize it into a data file. In
> servlet code, load the compiled data into memory, perform additional process
> based-on servlet request. Then output the result to client side.
>
I'm all for the getElement semantic if it isn't already in there, and can add
that easily. As for making html2ecs useable in a production sense of the word
i think there are better ways to accomplish the content/presentation
seperation. I believe the xml parser on xml.apache.org can be made to
understand and parse html appropriately but haven't gotten around to trying it
yet. If this is the case I can make html2ecs understand and deal with weird
html elements appropriatly but don't want to invest alot of time creating a
tool that I myself won't use. ( Currently i'm trying to get my FORCE
transformation engine xml->xsl->html & xml->xsl->rtf & xml->xsl->wml sync'd up
to the current spec so I can do a release and get the code out there for other
people to use. )
>
> OK. That's all this time. Hope you can understand my poor English.
>
Keep the suggestions coming.
>
> Enjoy your coding!
>
Always.
-stephan
--
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]