- This topic has 6 replies, 2 voices, and was last updated 19 years, 8 months ago by nkibble.
-
AuthorPosts
-
nkibbleMemberHi,
I’m trying to make use of the java.util.logging classes within a JSP page, using MyEclipse.
Using the sample source below, the editor is underlining the getLogger(), addHandler() and info() method calls, as though it doesn’t recognise the class. I am using Tomcat 5.5 and JDK 1.5, and am using Eclipse 3.0 with MyEclipse 3.8.4.The JSP does work, but it’s annoying that the editor is acting as though there are errors in the code.
I’d appreciate any guidance.
Sample source below:
%@ page language=”java” import=”java.util.logging.*” %
%
Logger logger = Logger.getLogger(“example”);
logger.addHandler(new ConsoleHandler());String info = request.getParameter(“info”);
if (info != null && !info.equals(“”)) {
logger.info(info);
}
%
Riyad KallaMemberIs this the EXACT code you are using, or did you manually omit the < and > before and after your %’s just for the post here in the forums? I just pasted in your code and fixed it and closed/reopend the file and it was fine (try that):
<%@ page language="java" import="java.util.logging.*" %> <% Logger logger = Logger.getLogger("example"); logger.addHandler(new ConsoleHandler()); logger.setFilter(null); String info = request.getParameter("info"); if (info != null && !info.equals("")) { logger.info(info); } %>
nkibbleMemberWow, that’s a quick response!
I did take out the < and > symbols, in order to be able to post the request.
I get getLogger(“example”), .addHandler(..) and .info(info) underlined ( in red).Could there be an issue with my setup? I installed MyEclipse and just started using it. Prior to this, everything has worked fine.
Riyad KallaMemberI get getLogger(“example”), .addHandler(..) and .info(info) underlined ( in red).
If you mouse over in the right margin ontop of the red blocks marking the errors, what is the error message?
nkibbleMemberI’m sorry, I’ve realised what this was now.
I called my JSP file “Logger.jsp” and this seems to be confusing MyEclipse. I’ve renamed the file to “LoggerJSP.jsp” and this has sorted the issue out. D’oh!Just out of interest, why would this cause MyEclipse to get confused? Does it class Logger.jsp as a class?
Riyad KallaMemberAhhh yes this is a subtle bug we need to fix, the JSP is getting generated and compiled to a filename that conflicts with the Logger.class from the JDK, we are looking into this.
nkibbleMemberThanks for the update, I’ll keep this in mind.
-
AuthorPosts