• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I pass a parameter?

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone!
I want to pass a parameter to next servlet page.I try to do this.but I cannt get what I want to.
In the code,*i* is a variable in the 'for loop'.

How can I translate a string to int?

[ June 15, 2003: Message edited by: qingwu wang ]
[ June 15, 2003: Message edited by: qingwu wang ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your code, 'i' is being treated as part of the whole string. You need to reference the *value* of the variable i, so place it outside the quotes.

<a href="<%=encodeURL("/servlet/util.Void?location=" + i, request, response)%>">

Also, encodeURL is your own method, right? because HttpServletResponse's version does not take request and response as a parameter.

You might want:
<a href="<%= response.encodeURL("/servlet/util.Void?location=" + i) %>">
 
qingwu wang
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You got my question.I try to do so.it success!
Thank you Mike,thanks.
reply
    Bookmark Topic Watch Topic
  • New Topic