Re: [Mav-user] a new view

2004-09-20 Thread Joseph Dane
"Schnitzer, Jeff" <[EMAIL PROTECTED]> writes:

> Velocity produces text that must be parsed to perform XSLT transforms.
> This new approach starts immediately with SAX events.  Unlike a
> hypothetical "saxify", it doesn't require fully navigating the source
> object graph.  Cool.

yes, I think so too.  in fact, I'd say that this might be the biggest
win to this approach.

> The downside is that it introduces yet another templating language
> syntax.  What about borrowing the syntax of XSLT?  Presumably your web
> developers are already using XSLT to handle the outgoing sax events, it
> would be nice if they could leverage their existing knowledge.

I agree, and have given quite a bit of thought to exactly this
solution.  but I don't think it'd work, at least not in a way that
would meet my initial requirements.

first, XSLT is needlessly verbose.  I don't want to have to say

 

every time I want to refer to a value.  

second, and more importantly, it doesn't really solve the problem.
the key piece is something to allow you to refer to
objects/properties/methods from within the template.  that is, you
want to be able to easily cross the boundary between the template
language and the "host" language.  I could think of only two ways of
doing this in XSLT

 1) write an XSLT extention function, to be used as in 

 
   ...
  

  

...
  
 

but that's way too verbose, and doesn't really solve anything
anyhow, because you've still got a mini-expression language
(e.g. "model.price").  

 2) domify the graph of potentially reachable objects, and use the
 document() function plus a suitable URL resolver to find access the
 objects from the stylesheet.

that also seemed too awkward.  the bottom line is that the expression
language used in XSLT is XPath, which is an incredibly powerful and
useful language, if you happen to be applying it to something that
fits with the XPath data model.  this didn't seem to be the case to
me at the time, although XPath 2.0 looks like it might come closer.

I wanted something that would be both fast (execution-wise) and
relatively easy to explain to programmers/designers of moderate
experience level.  I've been pretty happy with it so far on both
counts.  the app in question exhibits snappy performance (although I
have done no testing to validate this) and people have picked up on
the ideas pretty easily.

on a somewhat off-topic note, I'll say that when I first considered
doing this my instinctive reaction was: "Please!  Not another Java
web framework!".   But on further consideration, I don't think this
critisicm was really valid.  Really, it's just a recycling/repackging
of various systems already available (Maverick, OGNL, "SAX").  More
importantly, it used to be, back before I became someone who designs
applications exclusively for the web (sigh), that I wasn't afraid of
designing application-specific "little languages".   This approach
was considered a powerful tool for solving problems in a general
way.

anyhow, maybe the best thing would be for me to clean things up, put
the code+examples someplace public, and let people take a look.  I'll
do this and let the list know when it's available.

-- 

joe


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
[INVALID FOOTER]


RE: [Mav-user] a new view

2004-09-20 Thread Schnitzer, Jeff
Velocity documents are "mostly" xml-safe.  There are a couple bothersome
issues like relational operators < > and the occasional use of quotes.

Velocity produces text that must be parsed to perform XSLT transforms.
This new approach starts immediately with SAX events.  Unlike a
hypothetical "saxify", it doesn't require fully navigating the source
object graph.  Cool.

The downside is that it introduces yet another templating language
syntax.  What about borrowing the syntax of XSLT?  Presumably your web
developers are already using XSLT to handle the outgoing sax events, it
would be nice if they could leverage their existing knowledge.

Jeff


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:mav-user-
> [EMAIL PROTECTED] On Behalf Of Peter Blakeley
> Sent: Friday, August 27, 2004 2:59 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Mav-user] a new view
> 
> Velocity does not care what type of file it just parses text the input
> and out put file can be anything you want  xml, xhtml, html, htm, jsp,
> txt, vm, css, xslt .
> You can do everything xslt can do and much more in a far more concise
way
> 
> cheers pb..
> 
> Eelco Hillenius wrote:
> 
> >because that would not give him valid XML source files.
> >
> >- Original Message -
> >From: "Doug Kirk" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Friday, August 27, 2004 8:48 PM
> >Subject: Re: [Mav-user] a new view
> >
> >
> >
> >
> >>Hmmm...I don't want to rain on any parades, but I'm just wondering
why
> >>you didn't want to use Velocity, as it accomplishes the same thing
and
> >>it's already written and well-supported?
> >>
> >>
>

--
> 
> Peter Blakeley - Attain Consultants - mobile: 0427-723-814
> 
> SECURITY
> Virus-Protection, Firewalls, Auditing, Upgrades, Repairs,
Troubleshooting
> 
> NETWORK
> Windows 2000, XP, Design, Setup, Management, Troubleshooting
> 
> INTERNET
> Web site design, Java programming, JEE2, JSP, Servlets, RMI, EJB, XML,
> Workflow, Accounting, Web Services
> 
> [ attainconsult.com ]
> [ coolcat.com.au ]
> 
> "Why open source? because I prefer to surf the wave to the beach
rather
> than swim all the way in."
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement
on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> [INVALID FOOTER]



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-09-20 Thread Peter Blakeley
Velocity does not care what type of file it just parses text the input 
and out put file can be anything you want  xml, xhtml, html, htm, jsp, 
txt, vm, css, xslt .
You can do everything xslt can do and much more in a far more concise way

cheers pb..
Eelco Hillenius wrote:
because that would not give him valid XML source files.
- Original Message - 
From: "Doug Kirk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 27, 2004 8:48 PM
Subject: Re: [Mav-user] a new view

 

Hmmm...I don't want to rain on any parades, but I'm just wondering why 
you didn't want to use Velocity, as it accomplishes the same thing and 
it's already written and well-supported?
   

--
Peter Blakeley - Attain Consultants - mobile: 0427-723-814 

SECURITY
Virus-Protection, Firewalls, Auditing, Upgrades, Repairs, Troubleshooting
NETWORK
Windows 2000, XP, Design, Setup, Management, Troubleshooting
INTERNET
Web site design, Java programming, JEE2, JSP, Servlets, RMI, EJB, XML, Workflow, 
Accounting, Web Services
[ attainconsult.com ]
[ coolcat.com.au ]
"Why open source? because I prefer to surf the wave to the beach rather than swim all the 
way in."




---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-08-28 Thread Eelco Hillenius
Haha, really... what's so wrong about starting another technology? I
actually think it is one of the strongest points of the Java communtiy that
there are so many. Gives people choice (after all, why should Maverick have
been started when there was Struts), and the competition makes open source
developpers think harder about their added value in open source space.

Eelco

- Original Message - 
From: "Joseph Dane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 27, 2004 9:24 PM
Subject: Re: [Mav-user] a new view


> Doug Kirk <[EMAIL PROTECTED]> writes:
>
> > Hmmm...I don't want to rain on any parades, but I'm just wondering why
> > you didn't want to use Velocity, as it accomplishes the same thing and
> > it's already written and well-supported?
>
> I do use Velocity, and am happy with it in the contexts in which I
> use it.
>
> However, it didn't seem to quite fit here.  I wanted the source pages
> to be plain old HTML, to the greatest extent possible.  So consider
> something like a role-sensitive navigation bar.  rather than
>
> #if ($user.inRole('admin'))
>   AdminFunctions
> #end
> #if ($user.inRole('manager'))
>   ManagerFunction
> #end
> ...
>
> I wanted
>
>  Admin Functions
>  ...
>
> Also, I wanted to be able to leverage XML tools (XSLT) in interesting
> ways.  If the control elements are expressed in XML, then I could
> (for example) pass a template containing a looping construct through
> an appropriate stylesheet (I'm referring here to an offline process)
> and get a reasonable looking mockup.
>
> Another thing: I figured I'd be using XSLT at runtime.  Both JSP and
> vanilla Velocity are what you might call "text oriented".  Meaning
> that the results of a template evaluation or JSP page evaluation
> would have to be reparsed as XML on every request.  I wanted to avoid
> that overhead.
>
> Certainly I could have used Velocity.  I'm not terribly proud of
> having increased the number of Java web technologies, and I always
> figured I could resist the urge when it came upon me.  But it turned
> out I was wrong.
>
> -- 
>
> joe
>
>
> ---
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> [INVALID FOOTER]



---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-08-27 Thread Joseph Dane
Doug Kirk <[EMAIL PROTECTED]> writes:

> Hmmm...I don't want to rain on any parades, but I'm just wondering why
> you didn't want to use Velocity, as it accomplishes the same thing and
> it's already written and well-supported?

I do use Velocity, and am happy with it in the contexts in which I
use it.

However, it didn't seem to quite fit here.  I wanted the source pages
to be plain old HTML, to the greatest extent possible.  So consider
something like a role-sensitive navigation bar.  rather than

#if ($user.inRole('admin'))
  AdminFunctions
#end
#if ($user.inRole('manager'))
  ManagerFunction
#end
...

I wanted

 Admin Functions
 ...

Also, I wanted to be able to leverage XML tools (XSLT) in interesting
ways.  If the control elements are expressed in XML, then I could
(for example) pass a template containing a looping construct through
an appropriate stylesheet (I'm referring here to an offline process)
and get a reasonable looking mockup.

Another thing: I figured I'd be using XSLT at runtime.  Both JSP and
vanilla Velocity are what you might call "text oriented".  Meaning
that the results of a template evaluation or JSP page evaluation
would have to be reparsed as XML on every request.  I wanted to avoid
that overhead.

Certainly I could have used Velocity.  I'm not terribly proud of
having increased the number of Java web technologies, and I always
figured I could resist the urge when it came upon me.  But it turned
out I was wrong.

-- 

joe


---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-08-27 Thread Joseph Dane
Eelco Hillenius <[EMAIL PROTECTED]> writes:

> It sound nice. I use Velocity mostly, and am still very content with it.
> But, Velocity would not be useful for you as it does not provide you with
> valid XML source files. Just wondering... what kind of stuff are you doing
> with these XML input files?

at this point, not much.

I am a very big fan of XSLT.  at the same time, a certain amount of
my daily routine is taken up with the care and feeding of a large web
application that makes very heavy use of XSLT, and IMO it's a mess.
very hard to understand, and the performance is terrible.  profiling
has revealed that the XSLT is the main source of the poor
performance.

but I continue to like the idea of offline XSLT, and perhaps a
reasonable amount of online XSLT.  I figured that we could write
pages as "vanilla" XHTML (that is, basic structure only, no headers,
footers, etc.) augmented with a few dynamic tags, and run these
through a deploy/preprocess stage to get a series of "intermediate"
pages.  These pages would then be used at runtime in the manner I
described previously.

A more ambitious preprocessing could be used to generate more
realistic mockups.  All the dynamic elements could be replaced with
static (mock) content, perhaps according to a config file of some
sort.

As it turned out, none of this has happened.  The project that
started all this was on a very tight schedule, and the pages for this
stage were simple enough that the source pages contain all requisite
style stuff, and no preprocessing is used.

-- 

joe


---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-08-27 Thread Eelco Hillenius
because that would not give him valid XML source files.

- Original Message - 
From: "Doug Kirk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 27, 2004 8:48 PM
Subject: Re: [Mav-user] a new view


> Hmmm...I don't want to rain on any parades, but I'm just wondering why 
> you didn't want to use Velocity, as it accomplishes the same thing and 
> it's already written and well-supported?
> 
> --doug
> 
> 
> 
> ---
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> [INVALID FOOTER]


---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-08-27 Thread Eelco Hillenius
It sound nice. I use Velocity mostly, and am still very content with it.
But, Velocity would not be useful for you as it does not provide you with
valid XML source files. Just wondering... what kind of stuff are you doing
with these XML input files?

Eelco

- Original Message - 
From: "Joseph Dane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 27, 2004 8:21 PM
Subject: [Mav-user] a new view


>
> I recently had reason to develop a new view type for Maverick, and
> wonder if there might be any interest in it.  If so, perhaps I can
> contribute it back to the project.
>
> The problem: I needed a very simple X?HTML template system.  It had to
> be something that, however, complicated under the hood, could be used
> by junior developers and design people.  I also wanted the source
> pages to be valid XML, so that I could use the various XML tools to
> edit/process/test the pages.
>
> I wanted to avoid JSP's scriptlet syntax.  JSTL might work, but I
> wanted the source pages to be valid XML, so I wanted to avoid stuff
> like
>
>   ... 
>
> Basically, I wanted XML source files, with the ability to dynamically
> evaluate expressions and a some minimal amount of flow control.
> Looping, for sure.  Conditionals, probably.  Something to match the
> minimalist spirit of Maverick itself.
>
> Something that might look like this (with some of the namespace stuff
> cleared away):
>
>  
>   
>Welcome ${user.fullName}
>Your order contains the following items:
>
>  
>${item.productId}${item.description}
>  
>
>
>the current time is ${util.dateTime}
>
>   
>  
>
> looks a bit like JSTL, but is required to be valid XML, unlike
> JSP+JSTL.  I used OGNL for the expression language.
>
> The processing model goes like this: the "page description" (e.g. the
> above sample) is loaded once at app startup and parsed as a stream of
> SAX events.  The events are recorded, and we do a certain amount of
> pre-processing, e.g. joining and "compiling" text nodes.  Then, at
> request time we replay the event stream using a request specific
> "evaluation context" that contains things like the current request,
> the authenticated user, and some utilities.  Maverick makes this
> pretty simple, because we can grab the "next transform step" in the
> view handler, and send the replayed SAX events on down the line.
>
> This means that any XSTL we might want to perform can be specified in
> Maverick's config, and will be handled completely by Maverick.
>
> Another nice thing about this is that unlike using JSP+XSLT, where
> the output of the JSP has to be re-parsed on every request, in my
> system the source is parsed exactly once.
>
> The strange thing about all this is that I wasn't able to find
> anything that quite suited my purpose.  So I guess that's one purpose
> of this message: to see what I may have missed in the sea of Java
> webapp frameworks.
>
> The other purpose is to see if there's any interest in this.  If not,
> then I must have missed something, because I've been quite pleased
> with the results.  If so, then I can see about getting it cleaned up
> and put out somewhere for the Maverick community to have a look at.
>
> -- 
>
> joe
>
>
> ---
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> [INVALID FOOTER]



---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
[INVALID FOOTER]


Re: [Mav-user] a new view

2004-08-27 Thread Doug Kirk
Hmmm...I don't want to rain on any parades, but I'm just wondering why 
you didn't want to use Velocity, as it accomplishes the same thing and 
it's already written and well-supported?

--doug

---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
[INVALID FOOTER]