Re: [htmltmpl-java] access to tmpl_var inside of tmpl_loop
Status: Beta
Brought to you by:
bluesmoon
From: Thomas W. <tw...@im...> - 2002-09-04 10:31:09
|
Hello, Philip S Tellis wrote: > > On Wed, 4 Sep 2002, Thomas Wabner wrote: > > > // a normal template variable > > template.setParam("sessionID",sessionID); > > // a template loop > > template.setParam("newsloop",Newsmanager.getNews()); > > .... > > > > in html: > > ..... > > <tmpl_loop newsloop> > > news: <tmpl_var news><br> > > sessionID: <tmpl_var sessionID> > > </tmpl_loop> > > ..... > > > > the problem is, that the var "news" is correct set > > inside the loop, but the outside of the loop declared > > variable "sessionID" is not set. > > > > How can i access tmpl_vars inside the > > loop, which are not declared in the loop-hashtable? > > This is basically what global_vars in the perl version of HTML::Template > does. As of now, it's not possible in the java version, and my initial > intent was not to support it, but it seems like there are people who > would want it in, so the next version would most likely have global_vars > support. great, and many thanks ;-) > For now, you'll have to use a workaround, and add sessionID to each of > your loop elements. Something like this: > > Vector v = Newsmanager.getNews(); > for(Enumeration e = v.elements(); e.hasMoreElements();) { > Hashtable h = e.nextElement(); > h.put("sessionID", sessionID); > } Yea, i know and try to use it. The problem was with my application. I have included html-tmpl-java into java servlets and have any rmi-components, that generates my hashtable for the templates. So i must run about all entries and add the sessionID. But this is not the problem if i can get the next version of html-template with the cool new feature ;-) If you interested for the integration from html-template into java-servlets i can give you a short example. > > I'll add support for it in the next version, and you're welcome to see > if you can too. Thanks very lot Waffel > Philip > > -- > We'll pivot at warp 2 and bring all tubes to bear, Mr. Sulu! > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > Html-tmpl-java-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-tmpl-java-users > URL: http://html-tmpl-java.sourceforge.net/ |