Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 8th, 2001, 04:20 PM
Malted_Monkey Malted_Monkey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 18 Malted_Monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Is there a way to remove a parameter from the request object.

i.e. you can access the parameter with
request.getParameter("paramName");

alternatively is there a way to set the parameter to something else?
maybe using request.setParameter("foo"); ???

thanks

me

Reply With Quote
  #2  
Old March 8th, 2001, 05:42 PM
waldthau waldthau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Colorado
Posts: 46 waldthau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
There is not a setParameter() method for the ServletRequest object or the HttpServletRequest object, nor the corresponding response objects either.

Can you explain more about what you are trying to do, and why?
__________________
- MW

Reply With Quote
  #3  
Old March 8th, 2001, 05:47 PM
Malted_Monkey Malted_Monkey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 18 Malted_Monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
basically i'm just trying to eliminate some parameters after a function is run on a .jsp page. the request get's forwarded to a servlet and an error condition is to redirect back to the original page. however, if certain parameters are not removed, the page will behave funkily.

we have an alternate work around, but it involves hard coding something in the servlet. so deleting the parameters from the servler would be ideal.

thanks

Reply With Quote
  #4  
Old March 9th, 2001, 08:57 AM
waldthau waldthau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Colorado
Posts: 46 waldthau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
When you invoke the servlet, is it from an HTML form like this:

<form name=form1 method=post action=myServlet>

If so, maybe you could split your form into 2 different forms and place the parameters you don't want the servlet to know about in the second form.

Since I don't know exactly what you're trying to do I don't know if that would work or not, but that's all I got right now.

Hope that helps.

Reply With Quote
  #5  
Old March 9th, 2001, 11:55 AM
Malted_Monkey Malted_Monkey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 18 Malted_Monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
better description

OK,

so here's the deal. we are passing parameters from the backend to a .jsp page upon certain errors happening. There is a combination of javascript and java code in the .jsp that changes the behavior of the .jsp page if those errors are passed.

Now there is a use case in which a user can make an error, be sent to the same page with error notification and then perform the error again and again be sent to the same page. the problem is that since there is that if we cannot remove the parameters, we then end up with an accumulation of serial errors, all with the same parameter name. ie:

somePage.jsp?error1=theError&error2=theError&error1=theError&error2=theError

notice the repitition of error1 and error2 in the request line

Calls to the request object will then, i think, only return the value of the first listed value for error1 and error2, and not the most current value of that error because "where you came from" includes the errors that happened to be sitting in the request object.

thus, i want to remove those errors upon handling them so that if an error happens again, we do not report past errors.




Reply With Quote
  #6  
Old March 15th, 2001, 06:41 AM
Torakh Torakh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 0 Torakh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Torakh
Lightbulb

Hello!

Altering HTTP parameters sent with a request is tricky. One alternative is to write an implementation of the HttpServletRequest-interface, contains the true HttpServletRequest-object, a String(Buffer) representing the Query String and override the method getQueryString to return the modified query-string. I've tested this myself, and it is working fine for HTTP GET operations.

A more straightforward way is to use headers instead of parameters (possible if the resource generating the parameters is a servlet or JSP), whereas you can set and remove headers freely and it is possible to provide several headers with the same name!

A third way is to use a request or session attribute to pass objects (errors) to a JSP. Perhaps use some sort of list of the errors?

I hope I've at least given you some useful ideas.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > remove parameter from request object


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway