tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pedro Santa" <>
Subject Error while trying to parse a JSP from a bean
Date Thu, 03 Jan 2008 13:01:49 GMT
Hi all!

I'm getting an error while trying to parse a JSP from a bean. Here's the deal.

My site has 2 frames. On the first is the web page. The second one, I
want it to parse the contents of the first frame, in order to strip
some elements from the source code - but for testing purposes I now
only want to echo the entire source on the second frame.

To do this I've got a bean named (package "reader") that
has a property 'url' to store the filename of the page I want to parse
and methods to set the url and to get the source of the url in a
String. Here's the code for the getSource method:

    public String getSource() {
        String result = "";
        try {
            URL urlobj = new URL("http://localhost:8080/myappfolder" + url);
            System.out.println("###### URL: " + urlobj.toString());
            BufferedReader in = new BufferedReader(new

            String inputLine;

            while ((inputLine = in.readLine()) != null) {
                result += inputLine + "\n";
        } catch (IOException ex) {
            System.out.println("### ERROR!");
null, ex);
        return result;

I use the bean on the HTTP, session and when a page loads
updates the 'url' property of the bean.

The second frame is an application.jsp that reloads every 5 seconds,
and outputs the String from the getSource method.

I pasted the all my jsp's on the
<tomcat_folder>\webapps\ROOT\myappfolder - as well as the context.xml
and web.xml files generated by Netbeans 6, the entire contents of
'web' folder. Pasted also all my classes on
<tomcat_folder>\webapps\ROOT\myappfolder\WEB-INF\classes and

When I try and fire up the page, the second frame displays nothing and
I get this error on Tomcat console:

I've tested the code with simple html files and it worked fine. I
tested the code with a jsp file without dynamic code (only HTML) it
worked fine either. And finally testes the code with the default jsp
for tomcat (http://localhost:8080/index.jsp) that has dynamic code in
it and it worked flawless as well.

I think I'm not doing something here, can anybody give me some advice
on how to put this thing to work?

I send also some useful information.

The application.jsp:

<%@page import="reader.*" %>
        <META HTTP-EQUIV="Refresh" CONTENT="5; URL=application.jsp">
        HttpSession s = request.getSession();
        Reader reader = (Reader) s.getAttribute("reader");
        <title>JSP Page</title>

I'm using Windows XP Professional SP2, Jakarta Apache Tomcat 5.5.9
(downloaded from here
and NetBeans IDE 6.0 Beta 2 (Build 200710212201).

All the other JSP features work fine.


Thanks in advance.


Pedro Machado Santa

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message