Hello all,
I have a question about calling a .dll from a servlet. I know it can be
done and that you use jni to do it, but not knowing anything about jni,
.dll's, and how to utilize the abilities of both I thought I would ask the
pros (that means you guys).
What I'm trying to do:
I created a servlet that gathers info via an html form. This servlet then
stores the info in a DB and at that point I need to call a .dll and somehow
send the info (that was just stored) to this .dll (which is 3rd party
software) that will turn the users input into a FAX and send it out.
I found some code from one of the archives of this list and it seems pretty
straight forward.
If I understand the code below whenever you want to call the .dll file then
create an instance of the class "Hello"????? If this is wrong could someone
point me in the right direction? Also, I need to figure out how I can send
the .dll info? I would assume that I would need to send the info to the
.dll in order to create a correct FAX.
Thanks in advance,
--brian
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class DllCall extends HttpServlet {
private int output()
{
int out = 10;
Hello myHello = new Hello();
out = myHello.getInt();
return out;
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
int integer = output();
PrintWriter out = res.getWriter();
out.println("<HEAD><TITLE> SimpleServlet
Output</TITLE></HEAD><BODY>");
out.println("<h1> SimpleServlet Output </h1>");
out.println("<P>Servlet output: " +integer);
out.println("</BODY>");
out.close();
}
public String getServletInfo()
{
return "DLL call servlet";
}
}
class Hello
{
private native int getLine();
public int getInt()
{
int input = getLine();
return input;
}
static
{
System.loadLibrary("C:\\WINNT\\system32\\Hello");
}
} //end class Hello
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
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