Win a copy of Head First Android this week in the Android forum!

Niamh Gill

Greenhorn
+ Follow
since Jan 30, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Niamh Gill

Hello,

I am using Java 6 and IE and am attempting to display an image in an applet. I am not getting any error messages in the Java console.

This is the method used to display the image. It is part of a JPanel which is part of an Applet. The System.out just before the image is displayed "about to display image..." appears in the Java Console but the image is not being displayed in the applet. I have used the java policy tool to grant java read permission on my image directory. All images are stored locally.


I know this code has worked before (probably with Java 1.4 or Java 5). Any help greatly appreciated!

Niamh
12 years ago
Hi,

I've been thinking about studying for SCEA certification and have been looking around for J2EE tutorials on the web.

I've come across this one: http://www.javapassion.com/j2ee/#Introduction by Sang Shin, a Sun employee. Has anybody used this tutorial? How would you rate it? It seems very comprehensive...is it appropriate for preparing for SCEA?

Any advice greatly appreciated!
[ June 04, 2008: Message edited by: Niamh Gill ]
Don't suppose HFEJB is available as a PDF yet? I have bought the book and think it's great but it's big! Kathy and Bert's SCJP book came with a CD which had the book on it in PDF format. This meant I could print it out so I was able to bring one chapter with me at a time and also write notes all over it (which I would prefer not to do on the actual book).

Anything similar available for HFEJB?

Thanks!
Many Thanks Bert....I think I'll stick to EJB 2 for now. And thanks to you and Kathy for your great books.
Are there any books or tutorials out for this exam yet?

I'm starting to prepare for the SCBCD exam, and have only a little experience of EJBs. Is it worth waiting for the new exam?

Any advice appreciated!

Thanks
I have the following class:


class A
{
int i;
A(){};
}
class B extends A
{
B(short i)//what constructor on A does this call???
{
this.i = i;
System.out.print("short");
}
B(float j)
{
i = (int)j;
System.out.print("float");
}
}

public class Test extends B {

Test(){
super(4);
}
/**
* @param args
*/
public static void main(String[] args) {
System.out.println(new Test().i);

}
}



I was expecting this not to compile because class A does not have a constructor which takes a number, only a no-arg constructor, but this compiles and works fine - it prints float4. Why?
Thanks for your help guys. I changed my web.xml file in myApp to look like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>TestingServlet</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestingServlet</servlet-name>
<url-pattern>/servlet/Testing</url-pattern>
</servlet-mapping>
</web-app>

This solved the problem!
Thanks again.
18 years ago
Hi,
I am trying to run my first servlet using Apache Tomcat 4.1.24.
I've bought a book on J2EE solutions and followed the instructions exactly but I can't get my servlet to run.
This is my servlet code, which I have compiled in C:\Java\tomcat\webapps\myApp\WEB-INF\classes:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class TestingServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Servlet Testing</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Welcome to the Servlet Testing Center");
out.println("</BODY>");
out.println("</HTML>");
}
}

My web.xml file which I have put in C:\Java\tomcat\webapps\myApp\WEB-INF is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Testing</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
</web-app>
I have also edited the server.xml file (in C:\Java\tomcat\conf) and added the following:
<Context path="/myapp" docBase="webapps/myapp" debug="0" reloadable="true">
</Context>
Now according to the book I'm following (Java for the Web with Servlets, JSP, and EJB: A Developer's Guide to J2EE Solutions - Bundi Kurniawan, New Riders Publishing 2002) I should be able to view the servlet at the following URL:
http://localhost:8080/myapp/servlet/Testing
However I get a 404 error : The requested resource (/myapp/servlet/Testing) is not available.
I have tried moving my servlet to C:\Java\tomcat\webapps\examples\WEB-INF\classes and viewing it at http://localhost:8080/examples/servlet/TestingServlet and it works fine.
I don't really want to do all my development in the examples directory, so I'd like to find a solution as to why it doesn't work in the myapp directory.
Can anybody see the problem? Any suggestions would be much appreciated!
18 years ago