PLEASE [b]HELP[/b] ME [[u]i][b]ASAP[/b][/i][/u]
843841Jun 28 2005 — edited Jun 28 2005I have made a servlet and a corresp HTML page
the HTML page has a text field...
u enter 'A' in it and the servlet sends the charecter 'A' to COM4 on my computer
so i have a servlet up and running which uses java commapi
this servlet is tested to be running on JRUN 4.0
the problem however is i cannot find a way to put this page on the internet as i do not know whrere to host a web server
please anybody helping me should give me in clear cut instructions as to what to do in steps and if giving a web server hosting site please see to it that the site does it for free like selfhost.com (selfhost does not host Apache server)
i also have VQServer installed
please could anybody tell me as to how to use this servlet with VQServer
i have apache 2 server installed on my comp
the html page is
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HAED><TITLE>Collecting a Parameter</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<H1 ALIGN="CENTER">collecting a parameter</H1>
<FORM ACTION="/servlet/OneParam">
First Parameter:<INPUT TYPE="TEXT" NAME="param1"><BR>
<CENTER><INPUT TYPE="SUBMIT"></CENTER>
</FORM>
</BODY></HTML>
the servlet is...
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import javax.comm.*;
public class OneParam extends HttpServlet
{
static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "A";
static SerialPort serialPort;
static OutputStream outputStream;
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
portList=CommPortIdentifier.getPortIdentifiers();
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String title="Reading the request parameter";
String docType="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n";
out.println(docType+
"<HTML>\n" +
"<HEAD><TITLE>" + title +"</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title +"</H1>\n" +
"<UL>\n" +
" <LI><B>param1</B>:"
request.getParameter("param1") "\n" +
"</UL>\n" +
"</BODY></HTML>");
while (portList.hasMoreElements())
{
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)
{
if (portId.getName().equals("COM4"))
{
try
{
serialPort = (SerialPort)
portId.open("SimpleWriteApp", 2000);
} catch (PortInUseException e) {}
try
{
outputStream = serialPort.getOutputStream();
} catch (IOException e) {}
try
{
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_2,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}
try
{
outputStream.write(request.getParameter("param1").getBytes());
} catch (IOException e) {}
}
}
}
serialPort.close();
}
}