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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:33:11+00:00 2026-05-26T10:33:11+00:00

/ * current page url* / / AddProduct.jsp?categoryId=1 / <script type=text/javascript> function abc(){ var

  • 0

/* current page url*/
/AddProduct.jsp?categoryId=1/

 <script type="text/javascript">     
     function abc(){

    var hashes = window.location.href.slice(window.location.href.indexOf('?')+1).split('&');
    window.location="addproduct.action?"+hashes;
    return false;
    }

        </script>
</head>

<body>


  <s:form method="post" enctype="multipart/form-data">     
        <s:textfield  label="Name" name="productBean.name" id="productBean.name"/>
        <s:textfield  label="Price" name="productBean.price" id="productBean.prsice"/>
        <s:textfield  label="Description" name="productBean.description" id="productBean.description"/>
        <s:label name="upload" value="Image"></s:label>
        <s:file name="upload"> </s:file>
        <s:submit onclick='abc()' value="Add Product" ></s:submit>
     </s:form>

I want to get parameters from url and when form is submitted, the url parameter will append to a new action (addaction)

PROBLEM

get “categoryId=1” and when submit button is pressed append “categoryId=1” with an action

  • 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-26T10:33:12+00:00Added an answer on May 26, 2026 at 10:33 am

    What I understand from your code you want to resend catgoryId with product’s form data and categoryId is available is in URL. I thought don’t need to use window.location and use the following code for your problem solution

     </head>
    
     <body>
    
    
      <s:form method="post" enctype="multipart/form-data" action="addproduct.action">     
        <s:textfield  label="Name" name="productBean.name" id="productBean.name"/>
        <s:textfield  label="Price" name="productBean.price" id="productBean.prsice"/>
        <s:textfield  label="Description" name="productBean.description" id="productBean.description"/>
        <s:label name="upload" value="Image"></s:label>
        <s:file name="upload"> </s:file>
        <input type="hidden" value="${param.categoryId}">
        <s:submit  value="Add Product" ></s:submit>
     </s:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
How can you modify the URL for the current page that gets passed to
If my current url is www.example.com/thank-you, how do I echo out the page name
Using Php I would like to extract the current Url of a page including
I want to use javascript to insert some elements into the current page. Such
If the current page URL has an argument 'myid1' in the querystring, for each
If the current page URL has an argument 'myid1' or 'myid2' in the querystring,
How to get current page URL and title in WordPress?
I'm trying to get current page url. Here is the code: $url = (!empty($_SERVER['HTTPS']))
Is there a way to get the current page URL and all its parameters

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.