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'm using Struts 2 . I'd like to return from an Action to the
when they say the action controller in the struts framework is multi threaded, does
Struts 1.3 application. Main website is NOT served by struts/Java. I need to forward
I have a Struts (1.3x) ActionForm that has several String and boolean properties/fields, but
I am migrating a struts application from Websphere to Tomcat 6 and my application
I want to log every user action that change domain in my web application.
I have some code within struts.xml like: <action name=viewApplicationPDF class=com.xxx.abc.web.action.XApplicationPDFAction> <result name=success>/WEB-INF/templates/xApplication.jsp</result> </action> I
This problem is not related to struts 2. I failed to find a solution
The struts2 validation framework allows you to define your validation for an action or
I have a Struts + Velocity structure like for example, a Person class, whose

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.