What does your "displayHelloWorld()" method in "helloservlet.dll' return? If
it returns a String do something like this:
String message=displayHelloWorld();
out.println("<h3>" + message +"</h3>");
Manish


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of [Qari
Qasim]
Sent: Thursday, June 21, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: Re: How to use JNI with Servlets


Hi Manish,
Thanks for your email. I did what you told me to do. However, I still get 1
error:
'void' type not allowed here:
                out.println("<h3>" + displayHelloWorld() +"</h3>");


 now my code is:

public class JniServlet extends HttpServlet
{
        public void doGet(HttpServletRequest request,HttpServletResponse
response) throws ServletException, IOException
        {

                response.setContentType("text/html");
                PrintWriter out = response.getWriter();
                out.println("<html><head><title>JNI
Servlet</title></head><body>");
                out.println("<h3>" + displayHelloWorld() +"</h3>");
                out.println("</body></html>");

                }


        public native void displayHelloWorld();

    {
        System.loadLibrary("helloservlet");
                }
}

do u know what I need to do to compile this java class.
Regards,

 -----Original Message-----
From:   Manish Bhatnagar [mailto:[EMAIL PROTECTED]]
Sent:   Thursday, June 21, 2001 12:18 PM
To:     [EMAIL PROTECTED]
Subject:        Re: How to use JNI with Servlets

Try making the necessary changes (as indicated)...

public class JniServlet extends HttpServlet
{

        // remove native keyword from here
        // ------
        //         |
        //         V
        public native void doGet(HttpServletRequest
request,HttpServletResponse response) throws ServletException, IOException
        {
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();
                out.println("<html><head><title>JNI
Servlet</title></head><body>");
                                // remove JniServlet(). from here, just
displayHelloWorld()
                                // ------
                                //         |
                                //         V
                out.println("<h3>" + JniServlet().displayHelloWorld()
+"</h3>");
                out.println("</body></html>");

                }
        public native void displayHelloWorld();
        // remove ststic block from here
        // ------
        //         |
        //         V
                  static {
        System.loadLibrary("helloservlet");
                }
}

Hth,
Manish Bhatnagar
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of [Qari
Qasim]
Sent: Thursday, June 21, 2001 2:14 PM
To: [EMAIL PROTECTED]
Subject: Re: How to use JNI with Servlets


Thanks for your reply.
I think I really DO need some help with this. For example I wrote the
following code, but does not compile:



public class JniServlet extends HttpServlet
{

        public native void doGet(HttpServletRequest
request,HttpServletResponse response) throws ServletException, IOException
        {
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();
                out.println("<html><head><title>JNI
Servlet</title></head><body>");
                out.println("<h3>" + JniServlet().displayHelloWorld()
+"</h3>");
                out.println("</body></html>");

                }
        public native void displayHelloWorld();

    static {
        System.loadLibrary("helloservlet");
                }
}


Is this how you meant to code?
Thanks



-----Original Message-----
From:   Manish Bhatnagar [mailto:[EMAIL PROTECTED]]
Sent:   Thursday, June 21, 2001 8:00 AM
To:     [EMAIL PROTECTED]
Subject:        Re: How to use JNI with Servlets

Hello Qari!
There is not much of difference in using JNI with standalone application and
using it with Servlets.
You need to call the JNI using the same good old
System.loadLibrary("my_dll") method.
You did not mention which web-server you are using. I tell you for Tomcat.
After you have build the DLL, place it in $TOMCAT_HOME/lib.
That's it. Try it out.
If you are unable to get it working, please let me know.
I will mail you the working code.
-mb-

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of [Qari
Qasim]
Sent: Wednesday, June 20, 2001 8:11 PM
To: [EMAIL PROTECTED]
Subject: How to use JNI with Servlets


Hi

i was trying to do some example with JNI. I can use JNI with standalone Java
application but I just cannot figure out how I can use JNI with Servlet.

Can some one show me a sample code using JNI with Servlets.

thanks very much

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to