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 6022993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:56:22+00:00 2026-05-23T03:56:22+00:00

I just starting learning about servlets yersterday so I’m a newbie. I read a

  • 0

I just starting learning about servlets yersterday so I’m a newbie. I read a tutorial and made the following program to track the use of a link:

package red;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/Redirection")
public class Redirection extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private String referrer;
    private String target;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        try {
            getURLs(request);
        }
        catch(Exception e)
        {
            response.sendError(500, "Target parameter not specified");
            return;
        }
        response.sendRedirect(target);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doGet(request, response);
    }

    public void getURLs(HttpServletRequest request)
    {
        referrer = request.getParameter("referrer");
        if(referrer == null || 0 == referrer.length())
        {
            referrer = new String("");
        }

        target = request.getParameter("target");
        if(target == null || target.equals(""))
        {
            throw new IllegalArgumentException();
        }
    }
}

But when I teste it(Eclipse with Tomcat) i get this:

HTTP Status 500 - Target parameter not specified

How do I specify a target parameter in eclipse so I can run this program ?

Sorry for the beginner question.

  • 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-05-23T03:56:23+00:00Added an answer on May 23, 2026 at 3:56 am

    Well you don’t really know what’s going on here. Maybe you’re getting a different exception – you’re giving that error message whatever goes wrong. You should log exactly what’s being thrown. You also shouldn’t generally catch Exception yourself – catch more specific exceptions.

    Anyway, normally to include that sort of parameter, you’d just put it in the URL:

    /Redirect?target=x&referrer=y
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting learning about ajax requests using jQuery. I've tried looking at other posts
Background: I'm (jumping on the bandwagon and) starting learning about iPhone/iPad development and Objective-C.
I am just starting out learning Clojure and Emacs. I have got Clojure Box
I'm just starting out learning OpenCL. I'm trying to get a feel for what
just considering starting to learning python but I have one concern before I invest
So I am just starting out on learning Django, and I'm attempting to complete
I am just starting to learn about spring and was looking at the difference
I'm just starting out learning python (for webapp usage) but I'm confused as to
I'm just starting out learning ASP.NET. From what I understand, ASP.NET differs from old
Just starting out in asp.net. Have just created a login.aspx page in my site

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.