Wiadomosc od Vitaly Baranovsky z 2006-09-22 15:24 brzmiala:
You can write a method visible in a Velocity context (add it to one of
existing classes or create a new one and put in in the context)
responsible for such things.
Thanks, but I'm new to Jetspeed and Velocity. And I don't no how can I
to do
this. Can you give me sample of code? Thanks!
First, write your own class (say MyClass ;) ) with a constructor taking
as an argument RenderRequest (RenderRequest is available in the
Jetspeed's Velocity context). In the class add an appropriate method,
e.g. String getPageTitle(). Basing on the render request, you can
determine a requested page and return its custom title. Finally, package
your class as a JAR. Copy the JAR to Jetspeed's WEB-INF/lib.
Now you have to add an instance of your class to the Velocity context.
Edit org.apache.jetspeed.velocity.JetspeedVelocityViewServlet (a
"portal" component). In the method Template
handleRequest(HttpServletRequest, HttpServletResponse, Context ctx) add
something like ctx.put("myClass", new MyClass(renderRequest)). An
instance of your class with the method will be accessible within
Velocity as $myClass.getPageTitle() (similarly, other methods if you
create them).
Recompile the "portal" component and package it as a JAR. Its name
should be something like jetspeed-portal-2.1-dev.jar (for Jetspeed 2.1
dev), for other versions use an appropriate name. Overwrite the existing
JAR in Jetspeed's WEB-INF/lib. Restart Catalina and it should work.
--
pozdrawiam,
Jacek Wislicki
[EMAIL PROTECTED]
http://www.nauka-biznes.org.pl/jetspeed/portal/
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]