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


<havjsp:tcl bean="havTclInterp">
    jspPuts "[set a [split {kicker} {}]]"
</havjsp:tcl>

k i c k e r

... and another which does...


<havjsp:tcl bean="havTclInterp">
    foreach c $a {
        jspPuts "$c<br>"
    }
</havjsp:tcl>

k
i
c
k
e
r

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


<havjsp:tcl bean="havTclInterp" display="true>
    set k ""
    foreach c $a {
        set k "${k}$c<br>"
    }
    set result $k
</havjsp:tcl>

k
i
c
k
e
r

... and another which does...


<havjsp:tcl bean="havTclInterp">
    jspPuts "[lsort -increasing -ascii [info commands]]"
</havjsp:tcl>

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


<%
havTclInterp.setScriptlet(
    "jspPuts \"[lsort -increasing -ascii [info commands]]\"");
String results = havTclInterp.eval();
out.println(results);
%>

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


Search the Site
Find Any or All of
  
Questions?
Feel free to drop by and chat if you have any questions - one of us is usually around during normal CST/CDT business hours.

Home || Services & Clients || Products || WIPs || Orders || News
Web Demos || PC Neural Demo || JS Neural Nets || Surfin'

Bonsai Pic's || Bonsai Style || Bonsai Databases || Bonsai Icons
Horace's Personal Home || Stats 'n Stuff || GuestBook || Chat
Left Hand Fingertip Torture - aka trying to play classical guitar ;-)

Copyright © -1995-2010 by hav.Software. All Rights Reserved.


http://www.hav.com/ havBpNet:J, havFmNet:J, havBpNet++, havFmNet++, havBpETT, havCNet, WebSnarfer, havIndex and havChat are all trademarks of hav.Software.

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

There may be other trademarks or tradenames listed in this document to refer to the entities claiming the marks and names or products. hav.Software disclaims any proprietary interest in any trademark, tradename or products other than its own.


webmaster@hav.com
Modified - 05/04/03 - 20173384 - 4972122