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

  • SEARCH
  • Home
  • 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

I'm just starting out in learning Ruby and I've written a program that generates
I am just starting learning about Linq. I wrote some examples but there is
I'm just starting out with C++ and am learning how to use QT creator
i've just started learning winapis and c++ programming .. i was thinking about starting
I've just starting using the Amazon Web Services (AWS) and I'm still learning about
Just starting learning about ajax requests using jQuery. I've tried looking at other posts
I've just starting learning jQuery and AJAX. I'm able to load a local page
I'm just starting out learning OpenCL. I'm trying to get a feel for what
So, I starting to learning Tkinter in Python, (just starting to learn Python, for
I am starting with google maps. just learning. while ago, it was working. now

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.