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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:48:11+00:00 2026-05-12T16:48:11+00:00

In a Struts Action, I want to get a parameter from the URL or

  • 0

In a Struts Action, I want to get a parameter from the URL or from a hidden field, when the parameter in the URL is not set.
To retrieve the parameter from the URL is as follows:

String userId = request.getParameter("userId");

But the problem is now, the HTML is based on forms (legacy code). And I observerd that the parameter userId may be reset to null. Is it an option to set the parameter in a form in a hidden field as well? Would I need to define a parameter in the dynaForm for this? How would I retrieve the parameter from the hidden field?

  • 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-12T16:48:11+00:00Added an answer on May 12, 2026 at 4:48 pm

    The parameters in hidden fields are set as any other field, also they can be retrieve the same way.

    String userID = request.getParameter("userId");
    

    To check if it is null you just:

    if(StringUtils.isNotBlank(userId)) {
        // do stuff
    }
    

    http://commons.apache.org/lang/apidocs/org/apache/commons/lang/StringUtils.html#isNotBlank(java.lang.String)

    *Edit adding more info
    request.getParameter doesn’t distinguish between get nor post variables, so if you have a parameter from the URL you can get it with the same method.

    • 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 URL parameter before forwarding to another action from an
I want to generate xml file from Struts action object. So that I have
I need to access the struts.action.extension value in the struts.xml file from an interceptor.
I am doing my struts project now i want to retrieve data as json.
I want to generate an email containing a URL( to a specific Action subclass
I have Struts 1 action and want to test it in isolation. What this
I don't want to debate whether or not to undertake the conversion from struts2
I want to change my ugly url which looks like: /search.action?category=1 to a nice
On default I want my struts2 app to forward to an action: <?xml version=1.0
Can anyone explain, if Struts Action classes are threadsafe in Struts 1.x. Does RequestProcessor

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.