1

With var test = "${attributename}"; is possible to get the request attribute "attributename" from javascript/jquery.

Is there a way to set a request attribute in a similar way in javascript/jquery?

Sefran2
  • 3,578
  • 13
  • 71
  • 106
  • @Stano: I'm using struts 1.3. I need to set a form property according to an ajax call response. I succeed in doing it: in the success callback I replace a div with another one in the response (this div contains the form property field properly setted). But I have some side effects, so I wanted to resolve in another way, for example by setting a request attribute in the success callback. – Sefran2 Jul 27 '13 at 13:08

2 Answers2

1
set a request attribute in a similar way in javascript/jquery

NO.

Request and response available on server side ...you cannot access in javascript.

var test = "${attributename}";

resolves on compile time at server side.

You might misunderstand that jsp and javascript existed on same document.Yes but JSP part compiles on server side itself comes to client.

I did'nt get your intention here, that while sending request,set parameter and do a request.No matter weather it is Ajax,Html form ..etc

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • I'm using struts 1.3. I need to set a form property according to an ajax call response. I succeed in doing it: in the success callback I replace a div with another one in the response (this div contains the form property field properly setted). But I have some side effects, so I wanted to resolve in another way, for example by setting a request attribute in the success callback – Sefran2 Jul 27 '13 at 13:06
  • take a hidden field and use it – Suresh Atta Jul 27 '13 at 13:23
0

Your question wasn't phrased too clearly, but if you are looking to get/set the request parameters of the url... take a look at the following posts:

Get a request parameter from the current url: How can I get query string values in JavaScript?

And set a request parameter: Adding a parameter to the URL with JavaScript

Community
  • 1
  • 1
blink-fish
  • 171
  • 17