Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9070921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:47:55+00:00 2026-06-16T17:47:55+00:00

I am working through Murach’s Java Servlets and JSPs I am in chapter 4,

  • 0

I am working through Murach’s Java Servlets and JSPs
I am in chapter 4, when I load http:// button is pressed I get the error. Can anyone see what is causing the problem, I have all the files stored in tomcat/webapps/MailList. I have gone through this code for hours and cannot find any syntax causing the problem, just thinking another set of eyes would probably catch it. Or someone could explain it, any help is greatly appreciated, this is my first day messing with Servlets/JSPs and tomcat.

The join_email_list.html

<!DOCTYPE html>
<html>
    <head>
        <title>Chapter 4 - Email List application</title>
    </head>
    <body background="C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg" >
        <h1>Join the Murach's mailing list</h1>
        <p>To join the Murach's mailing list, enter your name and email address below.<br>
            Then, click n the submit to recieve special offers.</p>
        <form action="show_email_entry.jsp" method="get">
            <table cellspacing="5">
                <tr>
                    <td align="right" >First name</td>
                    <td><input type="text" name="firstName"></td>
                </tr>
                <tr>
                    <td align="right">Last name</td>
                    <td><input type="text" name="lastName"></td>
                </tr>
                <tr>
                    <td align="right">email address</td>
                    <td><input type="text" name="emailAddress"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><br><input type="submit" value="Submit"></td>
                </tr>
            </table>
        </form>
    </body>
</html>

the show_email_list.jsp

<!DOCTYPE html public"-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
    <head>
        <title>Chapter 4 - Email List</title>
    </head>
    <body>
        <%@page import="business.*, data.*" %>
        <%
            String firstName = request.getParameter("firstName");
            String lastName = request.getParameter("lastName");
            String emailAddress = request.getParameter("emailAddress");
            User user = new User(firstName, lastName, emailAddress);
            UserIO.addRecord(user, "..webapps/MailingList/UserEmail.txt");
        %>
        <h1>Thanks for joining</h1>
        <table cellspacing="5">
            <tr>
                <td align="right">First Name: </td>
                <td><%= user.getFirstName() %></td>
            </tr>
            <tr>
                <td align="right">Last Name: </td>
                <td><%= user.getLastName() %></td>
            </tr>
            <tr>
                <td align="right">Email Address: </td>
                <td><%= user.getEmailAddress() %></td>
            </tr>
        </table>

        <form action="join_email_list.html" method="post">
            <input type="submit" value="Return">
        </form>
    </body>
</html>

the User.java class

package business;

public class User {
    private String firstName;
    private String lastName;
    private String emailAddress;
    //this class defines a user, what we can get from a user to store
    public User(){}
    public User(String first, String last, String email){
        firstName=first;
        lastName=last;
        emailAddress=email;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

}

the UserIO.java class

package data;

import business.User;
import java.io.*;

public class UserIO { //the user io class adds the entered info to a txt file a.k.a psuedo db
    public synchronized static void addRecord(User user, String fileName) 
            throws IOException{
        PrintWriter out = new PrintWriter( //open the printwriter
                new FileWriter(fileName, true)); //write to file
        out.println(user.getEmailAddress()+"|"//write these things to file
                +user.getFirstName()+"|"
                +user.getLastName());
        out.close();//close out to free resources
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:47:56+00:00Added an answer on June 16, 2026 at 5:47 pm

    use

    UserIO.addRecord(user, "MailingList/UserEmail.txt");
    

    instead of

    UserIO.addRecord(user, "..webapps/MailingList/UserEmail.txt");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Still working through JQuery to get data and repopulate portions of a page. Right
Working through a sample in Chapter 3 of Programming in Scala, the following code
Working through a zend tutorial & get this message, & not sure where to
Currently working through a Teach Yourself WPF tutorial. Usually I can mentally convert from
Just working through a tutorial on asp.net/mvc for the music store application. Ref: http://www.asp.net/mvc/tutorials/mvc-music-store-part-3
I started working through the tutorial at railstutorial.org to get exposure to the framework.
I am going working through the Rails Guides (http://guides.rubyonrails.org/getting_started.html),and am stuck at item 11
I'm working through the tutorials in the Beginning iPhone Development book. I'm on chapter
I am working through the above Tutorial from ScottGu located here ( http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-master-detail-scenarios.aspx )
I'm working through a jQuery book and am currently on the chapter of table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.