Solved

servlet/jsp invocation error

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now