• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

how to overwrite a request param?

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing something like this:

Which doesn't work, how i would properly write this in JSP (avoiding a scriptlet if possible, if not, a scriptlet is ok too).
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please explain it briefly what you want do ?
 
Tudor Raneti
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought it's obvious from the code, i'm trying to do the following, but rewriting the params of request to not create more variables than necessary:
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's see if this is the answer to your question.

No, you can not override the request parameters values neither reuse these parameters as variables. When you use the c:set tag with the attribute scope="request" you are setting request attributes and not parameters. As a proof, we know that a JSP "becomes" a Servlet, so check the ServletRequest API in this link http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequest.html

There, you will see the public methods getParameter() but no setParameter(), instead, there exist setAtribute() and getAtribute, that is what you are really doing in the code you posted inside the first message.

 
Tudor Raneti
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I feared as much, thank you.
 
Sheriff
Posts: 67693
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tudor Andrei Raneti wrote:I thought it's obvious from the code


Nothing is ever "obvious from the code". In the future please be sure to clearly explain what you are trying to accomplish.
 
Tudor Raneti
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Tudor Andrei Raneti wrote:I thought it's obvious from the code


Nothing is ever "obvious from the code". In the future please be sure to clearly explain what you are trying to accomplish.


The question is only obvious to the answerer. Thus the name of the topic too. I find that people who don't care to answer a question also find the question meaningless, hence not obvious. And an answer has been given, thanks for sharing your opinion though.

EDIT1: I wonder if reflection can do anything to the request object, AFAIK it can, not gonna try it though if i can avoid it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic