Re: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-25 Thread Mike Kienenberger
Will Glass-Husain [EMAIL PROTECTED] wrote:
 Doesn't quite work that easily.
 
 The problem is that if #directive is not an actual macro, than 
\#directive 
 is shown verbatim.  You only should escape when the same  code is legit in 

 both the source and the generated Velocity.  This can be a little 
confusing.

Now, see, that's exactly the kind of garbage I avoid.  I see now I left off 
another rule that I follow.

- Always perform escaping with variable replace (preferrably EscapeTool).

Ie, ${esc.hash} or ${poundSign} and not \#

-Mike


 - Original Message - 
 From: Mike Kienenberger [EMAIL PROTECTED]
 To: Shinobu Kawai [EMAIL PROTECTED]; Velocity Users List 
 velocity-user@jakarta.apache.org
 Cc: Velocity Users List velocity-user@jakarta.apache.org
 Sent: Thursday, February 24, 2005 7:07 PM
 Subject: Re: Escaping in VTL (was Re: Velocity JSP Generation)
 
 
  Shinobu Kawai [EMAIL PROTECTED] wrote:
   Escaping the VTL properly was a little challenging, but otherwise it 
   was
  no
   big deal.
 
  I still don't get the whole escaping scheme, partly because I can't
  find any documentation that is completely correct.  We might want a
  document totally devoted to escaping in VTL.  :(
 
  Escape all [$], [#], [], [!] and ['].  (actually, ! might be overkill, 
  but
  better safe than sorry.) Just use your tool :)
 
  Always use formal notation ${x}
 
  That's always worked for me, and never surprises me.
 
  -Mike
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-25 Thread Gonzalo Diethelm
 Doesn't quite work that easily.
 
 The problem is that if #directive is not an actual macro, 
 than \#directive 
 is shown verbatim.  You only should escape when the same  
 code is legit in 
 both the source and the generated Velocity.  This can be a 
 little confusing.

I know there is no agreement on this. To me, this behavior breaks the
principle of least astonishment.

http://en.wikipedia.org/wiki/Principle_of_least_astonishment

Regards,


-- 
Gonzalo Diethelm
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-25 Thread Will Glass-Husain
Yes.  It's confusing.  But I'd vote against changing this (for the 1.x 
series) or all
my app-generating templates will break.

WILL
- Original Message - 
From: Gonzalo Diethelm [EMAIL PROTECTED]
To: 'Velocity Users List' velocity-user@jakarta.apache.org
Sent: Friday, February 25, 2005 7:09 AM
Subject: RE: Escaping in VTL (was Re: Velocity JSP Generation)


Doesn't quite work that easily.
The problem is that if #directive is not an actual macro,
than \#directive
is shown verbatim.  You only should escape when the same
code is legit in
both the source and the generated Velocity.  This can be a
little confusing.
I know there is no agreement on this. To me, this behavior breaks the
principle of least astonishment.
http://en.wikipedia.org/wiki/Principle_of_least_astonishment
Regards,
--
Gonzalo Diethelm
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-25 Thread Nathan Bubna
agreed.  this is not my preferred escaping system either, but we can't
just go changing it now.  i can't think of any way to make such a
change backwards compatible.

the best that could be done (if someone is interested in doing it) in
1.x, would be to make escaping behavior configurable via a simple
property toggle, but even then, the current behavior would have to
stay the default option.

On Fri, 25 Feb 2005 11:17:36 -0800, Will Glass-Husain [EMAIL PROTECTED] wrote:
 Yes.  It's confusing.  But I'd vote against changing this (for the 1.x
 series) or all
 my app-generating templates will break.
 
 WILL
 
 - Original Message -
 From: Gonzalo Diethelm [EMAIL PROTECTED]
 To: 'Velocity Users List' velocity-user@jakarta.apache.org
 Sent: Friday, February 25, 2005 7:09 AM
 Subject: RE: Escaping in VTL (was Re: Velocity JSP Generation)
 
  Doesn't quite work that easily.
 
  The problem is that if #directive is not an actual macro,
  than \#directive
  is shown verbatim.  You only should escape when the same
  code is legit in
  both the source and the generated Velocity.  This can be a
  little confusing.
 
  I know there is no agreement on this. To me, this behavior breaks the
  principle of least astonishment.
 
  http://en.wikipedia.org/wiki/Principle_of_least_astonishment
 
  Regards,
 
 
  --
  Gonzalo Diethelm
  [EMAIL PROTECTED]
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity JSP Generation

2005-02-24 Thread Rana Asif Rubbani
I totally agree with Florin Vancea about it. Taming struts with 
torque/hibernate can be marvelous. Struts++ ;)

Asif
- Original Message - 
From: Florin Vancea [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org; Shinobu 
Kawai [EMAIL PROTECTED]
Sent: Thursday, February 24, 2005 12:23 PM
Subject: Re: Velocity JSP Generation


- Original Message - 
From: Shinobu Kawai [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org
Sent: Thursday, February 24, 2005 8:41 AM
Subject: Re: Velocity JSP Generation


snip
I wonder if anybody uses Velocity to create Velocity templates.  I
might need to add vtl to the EscapeTool.  (half joking, half...)

snip
Well, I was kind of thinking about this right before I saw your message.
(only half seriously...)
But really, what if (only what if) one would provide the Struts validator
and config files (which are info-rich-enough), along with the *.properties
containing messages, and at the startup of the WAR (or even at build time)
Velocity would generate a set of Velocity templates for all required pages
(maybe even Action classes).
Yes, it's not something one can whip up before coffee break, but it may be
interesting as it would produce
Instant Applications - just add CPU/database and enjoy a nice hot cup of
Velocity Java
:)
Florin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-24 Thread Shinobu Kawai
Hi Will,

  #*
  First time I've ever heard of creating JSP with Velocity.  :)
  I wonder if anybody uses Velocity to create Velocity templates.  I
  might need to add vtl to the EscapeTool.  (half joking, half...)
  *#
 
 Ha.  I wrote an app that uses Velocity to generate Velocity templates.  It's
 a quick start tool to generate a Velocity-based application for new users.

Wow!  Great work.  :-)

 Escaping the VTL properly was a little challenging, but otherwise it was no
 big deal.

I still don't get the whole escaping scheme, partly because I can't
find any documentation that is completely correct.  We might want a
document totally devoted to escaping in VTL.  :(

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity JSP Generation

2005-02-24 Thread Florin Vancea
Don't get too carried away :)

It was just caused by lack of coffee early in the morning. :)

Actually I do not see such a framework being very useful, at least not
compared to the complexity involved.
It seems like Will was way ahead and I truly believe that such a framework
is viable only for:
a - to build a startup point which will be refined later _by_hand_ (what I
understand Will did)
b - to automate part of app building, within some organization big enough to
support continuous customizing of the generator.

From my experience, any other usage scenario for a (completely) automated
app-builder is very unlikely.
But then again, maybe I'm wrong or short-sighted.

Cheers,
Florin

- Original Message - 
From: Rana Asif Rubbani [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org; Shinobu
Kawai [EMAIL PROTECTED]
Sent: Thursday, February 24, 2005 10:12 AM
Subject: Re: Velocity JSP Generation


 I totally agree with Florin Vancea about it. Taming struts with
 torque/hibernate can be marvelous. Struts++ ;)

 Asif
 - Original Message - 
 From: Florin Vancea [EMAIL PROTECTED]
 To: Velocity Users List velocity-user@jakarta.apache.org; Shinobu
 Kawai [EMAIL PROTECTED]
 Sent: Thursday, February 24, 2005 12:23 PM
 Subject: Re: Velocity JSP Generation


 
  - Original Message - 
  From: Shinobu Kawai [EMAIL PROTECTED]
  To: Velocity Users List velocity-user@jakarta.apache.org
  Sent: Thursday, February 24, 2005 8:41 AM
  Subject: Re: Velocity JSP Generation
 
 
  snip
  I wonder if anybody uses Velocity to create Velocity templates.  I
  might need to add vtl to the EscapeTool.  (half joking, half...)
 
  snip
 
  Well, I was kind of thinking about this right before I saw your message.
  (only half seriously...)
  But really, what if (only what if) one would provide the Struts
validator
  and config files (which are info-rich-enough), along with the
*.properties
  containing messages, and at the startup of the WAR (or even at build
time)
  Velocity would generate a set of Velocity templates for all required
pages
  (maybe even Action classes).
  Yes, it's not something one can whip up before coffee break, but it may
be
  interesting as it would produce
 
  Instant Applications - just add CPU/database and enjoy a nice hot cup
of
  Velocity Java
 
  :)
 
  Florin
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity JSP Generation

2005-02-24 Thread Mike Kienenberger
Florin Vancea [EMAIL PROTECTED] wrote:
 But really, what if (only what if) one would provide the Struts validator
 and config files (which are info-rich-enough), along with the *.properties
 containing messages, and at the startup of the WAR (or even at build time)
 Velocity would generate a set of Velocity templates for all required pages
 (maybe even Action classes).

I take a Cayenne database model, run it through Velocity and create a 
combination of nine struts-config files, validator xml files, java actions, 
and velocity templates for generating reports on database entities and 
creating/editing database entities.  Cayenne takes the same database model, 
runs it through velocity and creates database layer objects.   I just give 
my ant task a database table entity and out comes a report component and 
editing tool.  The only thing I might do afterward is swap a few fields on 
the html.vm template to organize the form differently.  That and update my 
main struts-config.xml file to include all of the new pieces.

So it's certainly doable.

-Mike

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-24 Thread Mike Kienenberger
Shinobu Kawai [EMAIL PROTECTED] wrote:
  Escaping the VTL properly was a little challenging, but otherwise it was 
no
  big deal.
 
 I still don't get the whole escaping scheme, partly because I can't
 find any documentation that is completely correct.  We might want a
 document totally devoted to escaping in VTL.  :(

Escape all [$], [#], [], [!] and ['].  (actually, ! might be overkill, but 
better safe than sorry.) Just use your tool :)

Always use formal notation ${x}

That's always worked for me, and never surprises me.

-Mike

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-24 Thread Shinobu Kawai
Hi Mike,

  I still don't get the whole escaping scheme, partly because I can't
  find any documentation that is completely correct.  We might want a
  document totally devoted to escaping in VTL.  :(
 
 Escape all [$], [#], [], [!] and ['].  (actually, ! might be overkill, but
 better safe than sorry.) Just use your tool :)

I'll add [\] to that.  :)

 Always use formal notation ${x}
 
 That's always worked for me, and never surprises me.

If I can be sure that EscapeTool will be in the Context, it isn't hard
at all.  But what if it's not?

Anyways, what I wanted to say was I want a complete and accurate
document on how escaping works in Velocity.  It should cover
references, directives, silent notation, formal notation, schmoo... 
Anything else?

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Escaping in VTL (was Re: Velocity JSP Generation)

2005-02-24 Thread Will Glass-Husain
Doesn't quite work that easily.
The problem is that if #directive is not an actual macro, than \#directive 
is shown verbatim.  You only should escape when the same  code is legit in 
both the source and the generated Velocity.  This can be a little confusing.

Will
- Original Message - 
From: Mike Kienenberger [EMAIL PROTECTED]
To: Shinobu Kawai [EMAIL PROTECTED]; Velocity Users List 
velocity-user@jakarta.apache.org
Cc: Velocity Users List velocity-user@jakarta.apache.org
Sent: Thursday, February 24, 2005 7:07 PM
Subject: Re: Escaping in VTL (was Re: Velocity JSP Generation)


Shinobu Kawai [EMAIL PROTECTED] wrote:
 Escaping the VTL properly was a little challenging, but otherwise it 
 was
no
 big deal.
I still don't get the whole escaping scheme, partly because I can't
find any documentation that is completely correct.  We might want a
document totally devoted to escaping in VTL.  :(
Escape all [$], [#], [], [!] and ['].  (actually, ! might be overkill, 
but
better safe than sorry.) Just use your tool :)

Always use formal notation ${x}
That's always worked for me, and never surprises me.
-Mike
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Velocity JSP Generation

2005-02-23 Thread Shinobu Kawai
Hi Rana,

 Is there any tool/framework available that you just give it the database 
 schema and it creates the jsp pages for you. Like GUIs for add/edit/delete 
 cases and a controller page where all pages will be submitted. Is there any 
 such jsp code generator available.

I'm not aware of such tools, but the torque project might give you a
clue on how to do it.
 http://db.apache.org/torque/

#*
First time I've ever heard of creating JSP with Velocity.  :)
I wonder if anybody uses Velocity to create Velocity templates.  I
might need to add vtl to the EscapeTool.  (half joking, half...)
*#

Best regards,
-- Shinobu

--
Shinobu Kawai [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity JSP Generation

2005-02-23 Thread jian chen
Wow, it seems to me off the chart here by asking for jsp related
stuff. Personally I think Velocity is the way to go, why need JSP?

jian


On Wed, 23 Feb 2005 22:41:21 -0800, Shinobu Kawai
[EMAIL PROTECTED] wrote:
 Hi Rana,
 
  Is there any tool/framework available that you just give it the database 
  schema and it creates the jsp pages for you. Like GUIs for add/edit/delete 
  cases and a controller page where all pages will be submitted. Is there any 
  such jsp code generator available.
 
 I'm not aware of such tools, but the torque project might give you a
 clue on how to do it.
  http://db.apache.org/torque/
 
 #*
 First time I've ever heard of creating JSP with Velocity.  :)
 I wonder if anybody uses Velocity to create Velocity templates.  I
 might need to add vtl to the EscapeTool.  (half joking, half...)
 *#
 
 Best regards,
 -- Shinobu
 
 --
 Shinobu Kawai [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity JSP Generation

2005-02-23 Thread Will Glass-Husain
#*
First time I've ever heard of creating JSP with Velocity.  :)
I wonder if anybody uses Velocity to create Velocity templates.  I
might need to add vtl to the EscapeTool.  (half joking, half...)
*#
Ha.  I wrote an app that uses Velocity to generate Velocity templates.  It's 
a quick start tool to generate a Velocity-based application for new users.

Escaping the VTL properly was a little challenging, but otherwise it was no 
big deal.

WILL
- Original Message - 
From: Shinobu Kawai [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org
Sent: Wednesday, February 23, 2005 10:41 PM
Subject: Re: Velocity JSP Generation


Hi Rana,
Is there any tool/framework available that you just give it the database 
schema and it creates the jsp pages for you. Like GUIs for 
add/edit/delete cases and a controller page where all pages will be 
submitted. Is there any such jsp code generator available.
I'm not aware of such tools, but the torque project might give you a
clue on how to do it.
http://db.apache.org/torque/
#*
First time I've ever heard of creating JSP with Velocity.  :)
I wonder if anybody uses Velocity to create Velocity templates.  I
might need to add vtl to the EscapeTool.  (half joking, half...)
*#
Best regards,
-- Shinobu
--
Shinobu Kawai [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Velocity JSP Generation

2005-02-23 Thread Florin Vancea

- Original Message - 
From: Shinobu Kawai [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org
Sent: Thursday, February 24, 2005 8:41 AM
Subject: Re: Velocity JSP Generation


 snip
 I wonder if anybody uses Velocity to create Velocity templates.  I
 might need to add vtl to the EscapeTool.  (half joking, half...)

 snip

Well, I was kind of thinking about this right before I saw your message.
(only half seriously...)
But really, what if (only what if) one would provide the Struts validator
and config files (which are info-rich-enough), along with the *.properties
containing messages, and at the startup of the WAR (or even at build time)
Velocity would generate a set of Velocity templates for all required pages
(maybe even Action classes).
Yes, it's not something one can whip up before coffee break, but it may be
interesting as it would produce

Instant Applications - just add CPU/database and enjoy a nice hot cup of
Velocity Java

 :)

Florin



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity JSP Generation PROPOSED PROJECT

2005-02-23 Thread Rana Asif Rubbani
HI
Torque/Hibernate are persistence layers. You give them database schema in 
XML and get Data Objects and SQL scripts etc.

Actually I am thinking to create a framework that you just give your db 
schema in XML form like you do for torque/hibernate and it will create the 
data objects using toque/hibernate, generating JSP source code, linking of 
torque/hibernate objects with appropriate JSP page.

E.g. In database you have a table AUTHOR. Now you want to 
insert/update/delete authors. The framework will create a page to add 
authors[The code generator can customize the pages to any theme provided], 
one page for update of authors and one page for deletion of authors and the 
like. i.e. you can customize the page generation e.g. create only add page 
and update page, don't create delete page. The framework will take the input 
of fields for each database field. i.e. against this field you want a 
textfield or radio or combo etc. the framework will provide necessary 
scripting also. e.g. a database field of Number datatype can have a display 
text field that only accepts numbers[generated script will do it].

Now the framework will bind the created JSP/VM page with torque/hibernate 
Objects itself and also produce a ctrl page where add/update pages will be 
posted in order to perform the action.

In short, using the existing projects like velocity, torque, jsp, hibernate 
etc, i just wanted to build a project which is capable of providing 
integrated model, view controller layers of such projects by just a button 
click .

All of this is just a thought. I just wanted to confirm from velocity 
community that is there any the like open source thing already exists?
Also will velocity serve the purpose as far as code generation is concerned.

Please comment and suggest. I'm excited about this project.
Regards
Rana Asif Rubbani
- Original Message - 
From: Shinobu Kawai [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org
Sent: Thursday, February 24, 2005 11:41 AM
Subject: Re: Velocity JSP Generation


Hi Rana,
Is there any tool/framework available that you just give it the database 
schema and it creates the jsp pages for you. Like GUIs for 
add/edit/delete cases and a controller page where all pages will be 
submitted. Is there any such jsp code generator available.
I'm not aware of such tools, but the torque project might give you a
clue on how to do it.
http://db.apache.org/torque/
#*
First time I've ever heard of creating JSP with Velocity.  :)
I wonder if anybody uses Velocity to create Velocity templates.  I
might need to add vtl to the EscapeTool.  (half joking, half...)
*#
Best regards,
-- Shinobu
--
Shinobu Kawai [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]