Solved

servlet/jsp invocation error

Posted on 2012-03-15
3
625 Views
Last Modified: 2012-03-15
Hello:

I am learning jsp/servlets using tomcat. Please find attached along with this question a zip file containing source code for a simple MVC pattern wherein the servlet is the controller, the JSP is the view and a Plain Old Java Class as the model. Also included in the code is the actual (compiled) webapp ready to be deoplyed in tomcat. This webapp is in the folder titled "serveonce".
Sources are included in a separate directory.
The application compiles fine but when I try to run it I get an error as shown in the file err.png (included in the zip file).
All of the above code is in the zip file attached below in my second post below. The filename is code.zip/
Please let me know where I am going wrong?

 (since experts exchange wont allow me to attach a .jsp file I am including it in the code below. The jsp file goes under the "serveonce " folder.
newjsp.jsp

<%@ page import = "java.lang.String" %>

<html>
    <body>
        <h1 align="center">My First Servlet</h1>
        <%
            String myName = (String)request.getAttribute("Names");
            out.println(myName);
         %>

    </body>
</html>

Open in new window

0
Comment
Question by:arjoshi77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:arjoshi77
ID: 37724116
0
 
LVL 9

Accepted Solution

by:
arioh earned 500 total points
ID: 37724395
hi

According to err.png you are just opening a folder with your app in FF, but not running your webapp. You should open an url instead. It would be like "http://localhost:<tomcat port>/serveonce/form.html". Tomcat port is usually 8888 or 8080
0
 
LVL 7

Expert Comment

by:gudii9
ID: 37725049
You should provide application context name and servlet name and port everything in the url like
http://localhost:8080/firstapp/myServlet(depending on the exact port number, path)

Here are interesting explanation, examples, links

http://www.java-samples.com/showtutorial.php?tutorialid=552


http://oreilly.com/catalog/javacook/chapter/ch18.html

http://www.javalobby.org/java/forums/t15789.html
http://www.redbooks.ibm.com/redbooks/pdfs/sg245755.pdf
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question