|
JSP for testing the tclBean as well as the havjsp:tcl Tag set Ver 1.0 - 5/2/03 |
|
Just a little demo which tests the use of the tclBean (com.havsoft.beans.tclBean) to execute inline tcl script segments in a jsp page. This NeoWebscript demo page simply includes a JSP file which, in turn, uses the tclBean (Jacl / Blend) along with a special Tag set to execute some simple inline tcl scripts.
NOTE on Tcl Interpreter Scope: Because a bean is used to provide the tcl interpreter, the scope of the interpreter instance can be set to page, application, session or request - thus, allowing you to control whether or not bound tcl variables are available in successive pages etc.
Let's try evaluating some tcl code from within a JSP using the new <havjsp:tcl>...</havjsp:tcl> tag set to contain the tcl scripts to be interpreted. This Set of tests uses the new jspPuts tcl proc (which is automatically added to the interpreter via tclBean initialization) to do display from the inline tcl scripts.
Here's a first test which simply does...
k i c k e r
... and another which does...
k ... and another which does basically the same thing as the previous example EXCEPT that now, instead of using the new jspPuts tcl command to display the loop results, we will use the display="true" attribute of the havjsp:tcl tag to tell the tag itself to display the final results returned by the interpreter after psocessing the script. NOTICE that this is like the old scripts which had to return desired output as a results String...
k
... and another which does...
after append array auto_execok auto_load auto_mkindex auto_reset break case catch cd clock close concat continue eof error eval exec exit expr fblocked fconfigure file flush for foreach format gets glob global if incr info interp java0x1 join jspPuts lappend lindex linsert list llength lrange lreplace lsearch lsort namespace open package parray pkg_mkIndex proc puts pwd read regexp regsub rename return scan seek set socket source split string subst switch tclLog tclMacPkgSearch tclPkgSetup tclPkgUnknown tell time trace unknown unset update uplevel upvar variable vwait while
... and now do the same thing but by using the bean directly from this page in a jsp Segment as in...
after append array auto_execok auto_load auto_mkindex auto_reset break case catch cd clock close concat continue eof error eval exec exit expr fblocked fconfigure file flush for foreach format gets glob global if incr info interp java0x1 join jspPuts lappend lindex linsert list llength lrange lreplace lsearch lsort namespace open package parray pkg_mkIndex proc puts pwd read regexp regsub rename return scan seek set socket source split string subst switch tclLog tclMacPkgSearch tclPkgSetup tclPkgUnknown tell time trace unknown unset update uplevel upvar variable vwait while Done!!
|