472,372 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,372 software developers and data experts.

JSP error & Java class for rs232

I wnat to see in browser an status from an device connected on rs232

The java class for read from serial port is:

import java.io.*;
import java.util.*;
import java.lang.*;
import javax.comm.*;
public class Serial implements SerialPortEventListener

SerialPort port;
CommPortIdentifier ID;
InputStream in;
OutputStream out;
String text1="ok";

public void alarm(){

ID = CommPortIdentifier.getPortIdentifier("COM1");
port = (SerialPort)ID.open("alarm",1000);
in = port.getInputStream();
out = port.getOutputStream();
port.setSerialPortParams (19200, port.DATABITS_8, port.STOPBITS_1,
catch (Exception e) {}


public void serialEvent(SerialPortEvent e)
int data = 0;
String text1;

case SerialPortEvent.DATA_AVAILABLE:
while (in.available() > 0)
if ('S' == (char)data)
catch (IOException ev) {}

public String update_status (int s)
int temp = s;
int val = temp & 0x01;

if (val==0x01)
text1 = "ok";
text1 = "not ok";

return text1;

}//end class

Tha jsp page is :

<%@ page import="Serial" %>
<TITLE>Using a JavaBean</TITLE>

<% Serial rs232 = new Serial(); %>

The status is: <%= rs232.update_status() %>


I started Apache Tomcat 5.0 server (run on Winxp); I put RS232.jsp in
"webapps/Root" and Serial.class in "webapps/Root/WEB-INF/classes

On executing "http://localhost/RS232.jsp" I have an error :

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
[javac] Compiling 1 source file

C:\Tomcat5\work\Catalina\localhost\_\org\apache\js p\RS232_jsp.java:6:
'.' expected
import Serial;
1 error

What can be wrong????
Jul 18 '05 #1
1 7688
hello, i'm hani. i'm learning to use servlet in read serial port. i'll try to run your program. the error is it can't read update_status(). only. have you figure what's wrong with the code. just want to know. thank you
Mar 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
by: Przemo | last post by:
Hi, Do you know some good RS232C class? There is one in VB.NET 101 Examples, but I think it is poor. 1. I can't for e.g. read into my application all data received. I must tell how many...
by: Bruce | last post by:
I get this error on a line that references any control in the form_load sub: An unhandled exception of type 'System.NullReferenceException' occurred in BC785dProg1.exe Additional...
by: Mika M | last post by:
Ealier I have found Class called as Rs232. After importing it into project, it was easy to use for printing string to the COM-port like ... Dim p As Rs232 = New Rs232 p.Open("MyPortSettings...
by: Mika M | last post by:
Hi! My application uses Rs232-class, which was shipped with "101 VB.NET Samples\Framework - Using the COM Port". I need to sent certain kind of string into peripheral equipment attached to...
by: jereme.goblue | last post by:
The web page at http://www.rossowinspections.com/ has an issue with the left menu. The left menu has 7 links. One of the links doesn't work. Using Firefox 1.5 the Fees link isn't a clickable...
by: Dave Harry | last post by:
I found the RS232 class from MS's 101 VB samples. Writing to the port works fine. (I've got hyperterminal on the other comm port and a crossover cable between COM1 and COM2) The port is opened...
by: judge82 | last post by:
I made sure I closed all the bracket, why do i still get the error. on line 360, 424, 425 and 607 Please help /* * ShopCartServletHW3.java *
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.