[quote]
500 Servlet Exception
/~ppowell/includes/chat_messages.jsp:153: cannot find symbol
symbol : constructor
MessageProcessor(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,boolean)
location: class ppowell.MessageProcessor
MessageProcessor mp = new MessageProcessor(request, response, true);
// THIRD PARAMETER MEANS YOU WILL GET HTML
^
/~ppowell/includes/chat_messages.jsp:155: cannot find symbol
symbol : method getHTML()
location: class ppowell.MessageProcessor
content = mp.getHTML();
^
Note:
/usr/local/resin2/work/__27eppowell/_includes/_chat_0messages__jsp.java
uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
[/quote]
I am getting ServletException errors on a successfully-compiled class
MessageProcessor
(http://www.myjavaserver.com/~ppowell/docs/MessageProcessor.java ). I
do not understand why I'm getting these errors, it's perfectly good
syntax, I thought!
[code]
package ppowell;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import java.util.regex.*;
import javax.servlet.http.*;
/**
* Serializable class to send message from applet or JSP received from
ChatServlet to go to
* the flat file referenced in ChatGlobals class. Will immediately
also receive all messages
* from the flat file to return to the applet exclusively. Will handle
all commands using
* MessageCenter class instance.
*
* @version JSDK 1.4
* @author Phil Powell
* @package ppowell
*/
public class MessageProcessor implements Retriever, Serializable {
//------------------------- --* PROPERTIES *--
-------------------------------
public String message = "", origMessage = "", nickname = "";
private NicknameBin nickBin;
private HTMLEntities htmlEntities;
private HTMLParser htmlParser;
private URLParser urlParser;
private MessageBinHashBundler bundler;
private MessageConverter converter;
private MessageCenter msgCenter;
private MessageBin msgBin;
private Pattern yourMessagePattern;
private Matcher matcher;
private String cookie = "", html = "", messageFromCommandResponse =
"";
private boolean isFoundNickname = false, isLastToLeave = false,
isFromApplet = false, isOKPostMessage = true;
private boolean isOKReceiveMessages = false, isOKReceiveNicks = false,
isFromHTTP = false, willRetrieveHTML = false;
private String[] convertedMsgArray, commandArray;
private static final String redirectHTML = "";
private Hashtable cookieHash = null;
private HttpServletRequest request;
private HttpServletResponse response;
//------------------------- --* END OF PROPERTIES *--
-------------------------------
/**
* Constructor
*
* @access public
*/
public MessageProcessor() {} // CONSTRUCTOR
/**
* Constructor
*
* @access public
* @param HttpServletRequest request
* @param HttpServletResponse response
*/
public MessageProcessor(HttpServletRequest request,
HttpServletResponse response) { // CONSTRUCTOR
this.request = request;
this.response = response;
}
/**
* Constructor
*
* @access public
* @param HttpServletRequest request
* @param HttpServletResponse response
* @param boolean willRetrieveHTML
*/
public MessageProcessor(HttpServletRequest request,
HttpServletResponse response, boolean willRetrieveHTML) {
this.request = request;
this.response = response;
this.willRetrieveHTML = willRetrieveHTML;
}
}
[/code]
Ok, overloaded constructor, all is cool, so here are the offending
scripts in chat_messages.jsp:
[code]
MessageProcessor mp = new MessageProcessor(request, response, true);
// THIRD PARAMETER MEANS YOU WILL GET HTML
mp.process();
content = mp.getHTML();
[/code]
And here is the offending scripts in chat_nicknames.jsp:
[code]
RequestParameterResetter request2 = new
RequestParameterResetter(request);
request2.setParameter("message", "/n");
MessageProcessor mp = new MessageProcessor(request2, response,
true); // THIRD PARAMETER MEANS YOU WILL GET HTML
mp.process();
content = mp.getHTML();
[/code]
I am not understanding what is going on here and would love for some
insight. Thanx
Phil
trippy - 10 Feb 2006 08:52 GMT
In article <1139477092.490045.78180@f14g2000cwb.googlegroups.com>,
phillip.s.powell@gmail.com took the hamburger, threw it on the grill,
and I said "Oh wow"...
Sorry dude, not trying to rip on you but no, no, no.
You don't need your .jsp to do ANY of this.
Servlets/jsp's have a different thing going on. To be honest, I don't
think you even use the constructors for anything. Everything's done
through methods, not constructors.

Signature
trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM
NP: "Jellyroll" -- Blue Murder
"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum,
a pocketknife, and a smile."
-- Robert Redford "Spy Game"
phillip.s.powell@gmail.com - 10 Feb 2006 15:30 GMT
The infamous "see below"
> In article <1139477092.490045.78180@f14g2000cwb.googlegroups.com>,
> phillip.s.powell@gmail.com took the hamburger, threw it on the grill,
[quoted text clipped - 7 lines]
> think you even use the constructors for anything. Everything's done
> through methods, not constructors.
So I've been told. Bear in mind I have a short amount of time to fix a
live site by conversion from PHP to JSP due to remote host. I know
PHP, not JSP. So basically I know only enough Java to know the concept
of what I want to do, apparently not architecturally sound. Avoiding
going into my month-long PHP-flavored rant about "I can do blah blah
blah in PHP why can't I do this in Java", I really need to fix this
constructor problem. I'll deal with the architecture later.
Thanx
Phil
> --
> trippy
[quoted text clipped - 8 lines]
>
> -- Robert Redford "Spy Game"
phillip.s.powell@gmail.com - 11 Feb 2006 09:40 GMT
I solved it, but the solution is utterly weird.
I just needed to add this:
/**
* Does nothing
*
* @ignore
*/
public static void main(String[] args) {}
I usually only added a blank main() static method to allow for my
Javadocs to align a bit more nicely but it seems to have a bit more
merit than I thought..
Phil
phillip.s.powell@gmail.com - 11 Feb 2006 09:58 GMT
I got it! And I have no explanation for it but it works!
I added this to MessageProcessor class, but I only did this to clean up
the generated Javadocs:
/**
* Does nothing
*
* @ignore
*/
public static void main(String[] args) {}
And suddenly the ServletException is gone and all compiles nicely!
Phil
trippy - 14 Feb 2006 05:26 GMT
In article <1139651934.675003.292030@o13g2000cwo.googlegroups.com>,
phillip.s.powell@gmail.com took the hamburger, threw it on the grill,
and I said "Oh wow"...
> I got it! And I have no explanation for it but it works!
>
[quoted text clipped - 9 lines]
>
> And suddenly the ServletException is gone and all compiles nicely!
I haven't said anything because I don't know what to say. I want to say
it feels wrong but the second I do, I know someone's gonna come say
otherwise and I don't know if they're gonna be right or not.
I'm glad it works. I didn't even think about doing that.

Signature
trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM
NP: "Jelly Roll" -- Blue Murder
"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum, a pocketknife,
and a smile."
-- Robert Redford "Spy Game"