• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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.
 
What's that smell? Hey, sniff this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic