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
Solved

servlet/jsp invocation error

Posted on 2012-03-15
3
624 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example issues from command prompt 10 50
maven module vs maven project 3 46
Java Eclipse Loop 3 20
What browser will run Java? 7 42
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

809 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