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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:32:11+00:00 2026-05-15T15:32:11+00:00

I want to add a URL parameter before forwarding to another action from an

  • 0

I want to add a URL parameter before forwarding to another action from an action method. Although HttpServletRequest has a getParameter() method, it has no setParameter() method. I know setAttribute() is there but I need the it to be part of the URL (like ?something=something&some2=some2). I know I can do it using filters but that’s an overkill for this task.

Basically we have an externally managed filter which will change something on a page when that parameter is set. Let’s say the color of the page will be passed as part of the URL parameter. When that parameter is present a servlet filter picks it up and changes the color of that page. I know it’s a very odd way of doing but that’s how they have it set up here.

I know how to make it work using java script based form submit by adding the URL parameter to the action url (ie. “/someAction.do?color=red”). But for some of the actions it actually does a action.forward(“action_name”) in the code. For those I was wondering what to do.

Does anyone know how to do that in struts 1.2?

  • 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-15T15:32:12+00:00Added an answer on May 15, 2026 at 3:32 pm

    The short answer is that it isn’t possible. Request parameters are supposed to be from the HTTP request. You can fake adding them using a combination of a ServletFilter and an HttpServletRequestWrapper but that is outside of Struts. Depending upon what you are trying to accomplish there may be a better solution. Want to describe that a bit more?

    Update

    With the additional detail you’ve added, I think you can try this to see if it meets your needs:

    import org.apache.struts.action.ActionRedirect;
    ...
    ActionForward forward = action.forward("action_name");
    ActionRedirect redirect = new ActionRedirect(forward);
    redirect.addParameter("color", "red");
    return redirect;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a parameter to a URL but currently it isnt showing
I want to add the option of automatic port forwarding (NAT Traversal) to an
I'm trying to grab each URL parameter and display them from first to last,
My problem is I want some parameter values, passed through URL, don't trigger the
I would like to add a parameter to each URL in my Rails 2.3.10
I have a web form to which I want to take a parameter from
I want to setup routing as follows: /Profile/Edit -> routes to Edit action /Profile/Add
I have dbml with single table users i want add partial class for User
I want to add a column to an existing legacy database and write a
I want to add a constant value onto an incoming bound integer. In fact

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.