Asim Jalis wrote:
> Has anyone used Jacl to write Java servlet code? How
> well does this work? Any experiences or pointers or URL
> references?
Mo DeJong wrote:
> I have not heard of anyone doing that before, but there is no reason
> it should not work. Jacl and Tcl Blend are generic interfaces to
> Java, so you do not need "wrapper" code. Just about anything you can
> do in Java, can be done in TclJava with ease. A good way to learn
> how TclJava works is to take some Java code you already wrote and
> convert it over to TclJava code. If you need any help figuring out
> how to convert Java code to TclJava code, feel free to post a small
> code fragment to the list.
I am appending a simple example servlet:
------------------------------CUT------------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
PrintWriter out;
response.setContentType("text/html");
out = response.getWriter();
out.println("<HTML><HEAD><TITLE>Hello</TITLE></HEAD><BODY ");
out.println("bgcolor=\"#FFFFFF\"><H1> Hello World </H1></BODY></HTML>");
out.close();
}
}
------------------------------CUT------------------------------
Notice I have to extend HttpServlet. Based on the TclJava man-page
(correct me if I am missing something) it does not seem to be possible
to define or extend a Java class within TclJava.
Is there a way to do this? How? Could you re-write this bit of code in
TclJava? Or is there some way of organizing the code so that the
servlet code (the stuff inside doGet) can call Tcl functions which I
define somewhere else using Tcl language constructs?
Thanks for your help.
Asim
----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com