File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Changing request Attribute via Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Changing request Attribute via Javascript" Watch "Changing request Attribute via Javascript" New topic
Author

Changing request Attribute via Javascript

Rafael Andrade
Greenhorn

Joined: Aug 04, 2006
Posts: 15
Hi there. I have an Attribute in the request, wich was set in may action like this:
request.setAttribute("imovelDefinido", "N");

Now I want to change it in my JSP when I click on a radio button, wich means the onclick event. I think the best (or the only) way is using javascript. How can I do it?

Thanks!
Rafael
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Originally posted by Rafael Andrade:
I think the best (or the only) way is using javascript.


You are incorrect. There is no way to do it.

While the page is sitting in the user's browser for him or her to interact with it, there is no request active. No request means no request attributes. So what are you going to change?

The request that created the HTML page to send to the broswer is long since over. And until the user submits the page (or your Javascript initiates an Ajax request), no new request will exist.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Your question indicates a fundamental misunderstanding regarding how JSP works and operates. Perhaps this article might be helpful.
Rafael Andrade
Greenhorn

Joined: Aug 04, 2006
Posts: 15
You�re right. I�ll read the article.
Thanks alot for the answer!
And congratulations for the site, it�s the best one by far!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Changing request Attribute via Javascript
 
Similar Threads
HttpSession Listeneres
Problem passing a value from one jsp to another using href
getRequestDispatcher include error path
Request attributes missing
Showing Request Attribute in javascript