0

I have a struts application, and I am trying to call the Action class with an URL. When I try to pass the request parameters, none of them get appended.

Here is the code I have :

    document.myform.action = "mydetails_${firmID}_${empID}.action?id=56";
    document.myform.submit();

But this is what I see in chrome console :

mydetails_123_04.action?

For some resaon, the stuff after the question mark is not appended. Am I missing something ?

2
  • How about "mydetails_${firmID}_${empID}.action" + "?id=56" ? Commented Sep 3, 2012 at 6:53
  • 2
    I don't know what's up with your string, but given that you're submitting a form what's wrong with <input type="hidden" id="56"> in the form? Commented Sep 3, 2012 at 7:16

1 Answer 1

2

Don't think you can set params like that in the action. You need to add them as parameters in the form, which involves creating a hidden input node:

var input = document.createElement( 'input' ); 
input.type = 'hidden';
input.name = 'id';
input.value = 56;
document.forms.myform.appendChild( input );​
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.