velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c_k...@bluemail.ch
Subject Re: template isn't found within a jsp
Date Fri, 06 Sep 2002 07:35:09 GMT
>> 
>> Hello,
>> I want to use velocity for the first time. In the users guide, it was
explained
>> how to use velocity within a servlet. So I thought, I could use velocity
>> directly within a jsp but with the advantage, that I don't have to compile
>> the servlet each time I change the code.
>
>What's the problem with recompiling?  Use Ant with a simple build.xml and
>it's a breeze.  If you aren't familiar with Ant, I can send you a generic
>build.xml for building .java files in a web app.

I know ant and I use it too. But If I have (especially in smaller Webapplications)
the possibility to skip compilation, then I would do it. May be I'm just
a bit lazier than others ;-)


>So it looks like you want to put your business logic in JSP's and then
use
>Velocity for the view.

No, I would use a jsp as a Controller or a as the View (in conjuction with
a Velocity template).

>You should look at using some kind of framework to help organize and
>structure your application.  See what's available at
>http://jakarta.apache.org/velocity/powered.html in the Frameworks
>section.  One or more of the frameworks there will let you write logic
in
>a scripting language such as Rhino (JavaScript), BeanShell (Java like
>syntax) or others.  The WebWork framework
>(http://www.opensymphony.com/webwork/) with which I'm most familiar, also
>supports writing logic only JSP's.
>
>If you'd rather write your own environment, check out the Velocity View
>Tool at http://jakarta.apache.org/velocity/toolsubproject.html.  Your JSP
>could set objects into the request with request.setAttribute and forward
>to the .vm template which would pull them out.  It would still be a good
>idea to have a servlet controller or dispatcher that would look at the
URL
>and dispatch to the appropriate JSP or script then render the desired
>Velocity template.
>
>Hope this helps,
>-Bill

Ok, I will have a closer look to these things. 
Thanks for your propositions


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message