velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles N. Harvey III" <charl...@alloy.com>
Subject RE: Experiences made by porting a JSP based application to Velocity (with Struts and Tomcat)
Date Thu, 05 Sep 2002 18:42:15 GMT
[snip]
>One problem with Velocity is documentation. Of course you can generate
>JavaDocs out of your business logic classes. But how can you tell a Web
>Designer, which objects are available where (in which context). The only
>method I currently know is to write a HTML index page with some
explanations
>yourself (manually). Some improvment here would be helpful.
>
>Tom


I was actually working on something like that.  Might take me a while since
I am really busy at work these days (and I don't even have a computer at
home
to save my sanity).  With most xml platforms you can add a request parameter
and you can see the xml stream so you can see all the variables that are in
the context.  So I was trying to do the same for Velocity.  Something like:

Servlet:

	ctx.put("context", context);


Then in VTL (pseudocode):

	#foreach ($key in $context.keys)
		$key : $context.get($key)
		#foreach($class in $key)
			$class.getMethods()
		#end
	#end


Something like that.  Because Velocity reads all public methods on all the
classes
in the context.  So if you can load all the class names and method names
into
the context you should then be able to print them out nicely.

I had imagined it as an extra request parameter like
/myservlet?showMethods=1.
So when this is called a certain .vm file is used to display the foreach
loop
above.

If you can get it done faster than me go right ahead.  If I wasn't so busy
I'm
sure I could figure it out in a day or two (I'm still new to this java
stuff).

Hope this was helpful.


Charlie


--
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