Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

servlet/jsp invocation error

Posted on 2012-03-15
3
Medium Priority
?
632 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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses

604 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