?
Solved

servlet/jsp invocation error

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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

762 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