Martin,
Find the copy of your working jsp and .java files.
Hope this helps you :-).
------------------------------------JSP File------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="javax.naming.*, javax.naming.directory.*,java.util.*" %>
<%@ page import=" wpv3beta5 " %>
<%
String cnvals = "" , context = "" , i = "", href = "",
namestring = "namestring" , pstring = "", scope = "", actualfilter = "" ,
filter =
"(|(CN=*)(OU=*))", max = "200", children = "N" ;
%>
<jsp:useBean id="mybean" scope="page" class="wpv3beta5" />
<jsp:setProperty name="mybean" property="*" />
<HTML>
<HEAD>
<title>U.S. Federal White Pages Directory</title>
</HEAD>
<BODY bgcolor="#EEEEFF" text="#003366" link="#336699" vlink="#996666"
alink="#FFCC66">
<FORM action="wpv3beta1.jsp" method="POST">
Find <input type="text" size= 30 name="cnvals" value="<%= cnvals %>">
<input type=hidden name="scope" size=30 value="SUBTREE_SCOPE" >
<input type=hidden size= 35 name="context" value="<%= context %>">
<input type="Submit" name="" value="Search">
</form>
<FONT SIZE=-1><EM>example: " beth ander " will find "Elizabeth
Anderson", "Beth Sanderson" and "Elizabeth VanderPutten" </EM></FONT>
<HR>
<TABLE BORDER="1" CELLPADDING=7 CELLSPACING=0>
<CAPTION>List of Directory Entries in this Context</CAPTION>
<TR><TH> </TH><TH>Name--Click to drill
down</TH><TH>Title</TH><TH>Phone</TH><TH>E-Mail / Web</TH></TR>
<TR><TD><%= i %></TD><TD><A HREF="<%= href %>"><%= namestring
%></A></TD>
<TD><%= pstring %></TD>
<TD><%= pstring %></TD>
<TD><%= pstring %></TD></TR>
</TABLE>
<FONT SIZE=-1>This search used: scope= <%= scope %>, filter=<%=
actualfilter %>, directory context=" <%= context %>".<BR></FONT>
<HR><BR>
<form action="wpv3beta1.jsp" method="POST">
<TABLE>
<caption><h3>Basic Search</h3></caption>
<TR><TD>Part of directory to search (blank=entire directory)</TD>
<TD><input type="text" size= 35 name="context" value="<%= context
%>"></TD></TR>
<TR><TD>Names or parts of name to search for:(example: "beth
anders")</TD> <TD><input type="text" size= 30 name="cnvals" value="<%=
cnvals %>"></TD></TR>
<TR><TD COLSPAN=2 ALIGN=CENTER><input type="Submit" name=""
value="Search"></TD></TR>
<TR><TD COLSPAN=2 ALIGN=CENTER><BR><HR><H4>Advanced Search
Options</H4></TD></TR>
<TR><TD>Search filter<BR><A
HREF=searchex.jsp>Examples</A></TD><TD><input type="text" name="filter"
size=30 value="<%= filter %>"></TD></TR>
<TR><TD>Search scope</TD> <TD><select name="scope" size="2">
<option value="DEFAULT" selected>Default
<option value="SUBTREE_SCOPE" >Entire subtree
<option value="ONELEVEL_SCOPE" >Single level
</select></TD></TR>
<TR><TD>Show number of entries below each item (can be VERY slow!)?</TD>
<TD>
<input type=radio name=children value=N checked >No<br>
<input type=radio name=children value=Y >Yes<br>
</TD></TR>
<TR><TD>Maximum items to be retrieved (there's a max of 1,000 anyhow,
since more than that will blow out your browser.)</TD><TD><input
type="text" name="max" size=4 value="<jsp:getProperty name="mybean"
property="max"/>"></TD></TR>
</TABLE>
</FORM>
<%= wpv3beta5.staticstring %><BR>
<jsp:getProperty name="mybean" property="max"/>
<% wpv3beta5 w = new wpv3beta5(); %>
<%= wpv3beta5.staticstring %><BR>
<%= wpv3beta5.lsearch("Shortcut") %>
<%= wpv3beta5.echo("Whazzzzup, Doc??") %><BR>
<%= w.dynamicstring %>
</CENTER>
</BODY>
</HTML>
--------------------Your Java Bean Source File-----------------------
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Properties;
import java.util.Hashtable;
import java.util.Enumeration;
import java.io.* ;
import java.util.Vector;
public class wpv3beta5 {
public static String staticstring = "testing staticstring" ;
public String dynamicstring = "firstdynamic";
static SearchControls ctls = new SearchControls();
static String[] returnAttrs = {"cn", "mail",
"telephoneNumber", "title", "labeleduri", "pager", "description",
"mobile", "facsimiletelephonenumber"};
static String[] returnNothing = {};
private static String max = "200";
static String context = "";
static String separator = "";
static String filter = "(|(CN=*)(OU=*))";
static String cnvals = "";
static String scope = "ONELEVEL_SCOPE";
static String children = "N";
// Set maximum items returned from a search
public void setMax(String max) {
this.max = max ;
if (max.equals(null)) max = "200";
if (Integer.valueOf(max).intValue() > 1000) max = "1000";
ctls.setCountLimit(Integer.valueOf(max).longValue());
}
public String getMax() { return max; }
// Set search context
public void setContext(String context) {
if (context.equals(null)) context = "";
this.context = context;
if (! context.equals("")) this.separator = ", ";
}
file://set the search filter if it's provided in the request
public void setFilter(String filter) {
if (filter != null && filter.trim() != "") this.filter = filter;
}
file://set the simple name search values if provided in the request
public void setCnvals(String cnvals) {
if (cnvals != null )
this.cnvals = cnvals;
}
file://set scope
public void setScope(String scope) {
if (scope != null) this.scope = scope;
}
file://See if children are wanted
public void setChildren(String children) {
if ( ! children.equals(null) && children.equals("Y") )
children = "Y";
}
/** constructor */
public wpv3beta5 () {
this.dynamicstring = "in constructor dynamicstring";
this.staticstring = "staticstring changed in constructor";
} file://end constructor
public static String echo(String in) {
return "I heard you say " + in ;
}
public static String lsearch(String in) {
return "OK";
}
} // end class
Have a nice day.
With regards,
Sachin S. Khanna
http://www.emailanorder.com
----- Original Message -----
From: Martin Smith <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 08, 2001 6:22 AM
Subject: JSP calls instance method, bombs with odd message
> I'm going a little nuts with an error. The app is a single JSP, and the
>
> error occurs when I try to call a Java class file I made. Using Tomcat
> 3.
>
> Here's the message:
> Error: 500
> Location: /wpv3beta1.jsp
> Internal Servlet Error:
> java.lang.IllegalStateException: Response has already been committed
>
> at
>
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletRespon
seFacade.java:157)
>
> at
> org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
>
> at
> org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377)
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> at
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
>
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:156)
>
> at
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
>
> at java.lang.Thread.run(Thread.java:484)
>
> I'm including the JSP and the Java (which is in
> approot/WEB-INF/classes/) below.
>
> Basically, what seems to be happening is that any attempt to reference a
>
> dynamic member of my class gives this "response already committed)
> error. Makes no sense to me. However, it does make me realize I don't
> have a good grip on what the rules are about JSP->Bean or JSP->class
> communications.
>
> Any suggestions????
>
> Martin
>
> ===============the JJP===============
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <%@ page import="javax.naming.*, javax.naming.directory.*,
> java.util.Properties" %>
> <%@ page import="java.util.Hashtable, java.util.Enumeration, java.io.*,
> java.util.Vector, wpv3beta5 " %>
> <% String cnvals = "" , context = "" , i = "", href = "", namestring =
> "namestring" , pstring = "", scope = "", actualfilter = "" , filter =
> "(|(CN=*)(OU=*))", max = "200", children = "N" ; %>
> <jsp:useBean id="mybean" scope="page" class="wpv3beta5" />
> <jsp:setProperty name="mybean" property="*" />
>
>
> <HTML>
> <HEAD>
> <title>U.S. Federal White Pages Directory</title>
> </HEAD>
> <BODY bgcolor="#EEEEFF" text="#003366" link="#336699" vlink="#996666"
> alink="#FFCC66">
>
> <FORM action="/wpv3beta1.jsp" method="POST">
> Find <input type="text" size= 30 name="cnvals" value="<%= cnvals %>">
> <input type=hidden name="scope" size=30 value="SUBTREE_SCOPE" >
> <input type=hidden size= 35 name="context" value="<%= context %>">
> <input type="Submit" name="" value="Search">
> </form>
> <FONT SIZE=-1><EM>example: " beth ander " will find "Elizabeth
> Anderson", "Beth Sanderson" and "Elizabeth VanderPutten" </EM></FONT>
> <HR>
>
> <TABLE BORDER="1" CELLPADDING=7 CELLSPACING=0>
> <CAPTION>List of Directory Entries in this Context</CAPTION>
> <TR><TH> </TH><TH>Name--Click to drill
> down</TH><TH>Title</TH><TH>Phone</TH><TH>E-Mail / Web</TH></TR>
> <TR><TD><%= i %></TD><TD><A HREF="<%= href %>"><%= namestring
> %></A></TD>
> <TD><%= pstring %></TD>
> <TD><%= pstring %></TD>
> <TD><%= pstring %></TD></TR>
> </TABLE>
> <FONT SIZE=-1>This search used: scope= <%= scope %>, filter=<%=
> actualfilter %>, directory context=" <%= context %>".<BR></FONT>
> <HR><BR>
>
> <form action="/wpv3beta1.jsp" method="POST">
> <TABLE>
> <caption><h3>Basic Search</h3></caption>
> <TR><TD>Part of directory to search (blank=entire directory)</TD>
> <TD><input type="text" size= 35 name="context" value="<%= context
> %>"></TD></TR>
> <TR><TD>Names or parts of name to search for:(example: "beth
> anders")</TD> <TD><input type="text" size= 30 name="cnvals" value="<%=
> cnvals %>"></TD></TR>
> <TR><TD COLSPAN=2 ALIGN=CENTER><input type="Submit" name=""
> value="Search"></TD></TR>
> <TR><TD COLSPAN=2 ALIGN=CENTER><BR><HR><H4>Advanced Search
> Options</H4></TD></TR>
> <TR><TD>Search filter<BR><A
> HREF=searchex.jsp>Examples</A></TD><TD><input type="text" name="filter"
> size=30 value="<%= filter %>"></TD></TR>
> <TR><TD>Search scope</TD> <TD><select name="scope" size="2">
> <option value="DEFAULT" selected>Default
> <option value="SUBTREE_SCOPE" >Entire subtree
> <option value="ONELEVEL_SCOPE" >Single level
> </select></TD></TR>
> <TR><TD>Show number of entries below each item (can be VERY slow!)?</TD>
>
> <TD>
> <input type=radio name=children value=N checked >No<br>
> <input type=radio name=children value=Y >Yes<br>
> </TD></TR>
> <TR><TD>Maximum items to be retrieved (there's a max of 1,000 anyhow,
> since more than that will blow out your browser.)</TD><TD><input
> type="text" name="max" size=4 value="<jsp:getProperty name="mybean"
> property="max"/>"></TD></TR>
> </TABLE>
> </FORM>
> <%= wpv3beta5.staticstring %><BR>
> <jsp:getProperty name="mybean" property="max"/>
> <% wpv3beta5 w = new wpv3beta5(); %>
> <%= wpv3beta5.staticstring %><BR>
> <%= wpv3beta5.lsearch("Shortcut") %>
> <%= wpv3beta5.echo("Whazzzzup, Doc??") %><BR>
> <%= w.dynamicstring %>
>
> </CENTER>
> </BODY>
> </HTML>
> ================the java class===========
>
> /**
> *--------------------------------------------------
> * copyright (c) 2001 SystemSmith
> *--------------------------------------------------
> * $ $
> * $Revision: 0.1 $
> * $Date: 2001/06/16 $
> * $Author: mfs $
> * $ $
> *--------------------------------------------------
> */
>
>
> import javax.naming.*;
> import javax.naming.directory.*;
> import java.util.Properties;
> import java.util.Hashtable;
> import java.util.Enumeration;
> import java.io.* ;
> import java.util.Vector;
>
> public class wpv3beta5 {
>
>
> public static String staticstring = "testing staticstring" ;
> String dynamicstring = "firstdynamic";
>
> static SearchControls ctls = new SearchControls();
> static String[] returnAttrs = {"cn", "mail",
> "telephoneNumber", "title", "labeleduri", "pager", "description",
> "mobile", "facsimiletelephonenumber"};
> static String[] returnNothing = {};
> private static String max = "200";
> static String context = "";
> static String separator = "";
> static String filter = "(|(CN=*)(OU=*))";
> static String cnvals = "";
> static String scope = "ONELEVEL_SCOPE";
> static String children = "N";
>
>
>
> // Set maximum items returned from a search
> public void setMax(String max) {
> this.max = max ;
> if (max.equals(null)) max = "200";
> if (Integer.valueOf(max).intValue() > 1000) max = "1000";
> ctls.setCountLimit(Integer.valueOf(max).longValue());
> }
>
> public String getMax() { return max; }
>
> // Set search context
> public void setContext(String context) {
> if (context.equals(null)) context = "";
> this.context = context;
> if (! context.equals("")) this.separator = ", ";
> }
>
> file://set the search filter if it's provided in the request
> public void setFilter(String filter) {
> if (filter != null && filter.trim() != "") this.filter
> = filter;
> }
>
> file://set the simple name search values if provided in the request
> public void setCnvals(String cnvals) {
> if (cnvals != null )
> this.cnvals = cnvals;
> }
>
> file://set scope
> public void setScope(String scope) {
> if (scope != null) this.scope = scope;
> }
>
>
> file://See if children are wanted
> public void setChildren(String children) {
> if ( ! children.equals(null) && children.equals("Y") )
> children = "Y";
> }
>
>
> /** constructor */
> public wpv3beta5 () {
> this.dynamicstring = "in constructor dynamicstring";
> this.staticstring = "staticstring changed in constructor";
> } file://end constructor
>
> public static String echo(String in)
> { return "I heard you say " + in ; }
>
>
> public static String lsearch(String in)
> { return "OK"; }
>
>
> } // end class
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets