• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I pass a parameter?

 
qingwu wang
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • 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 ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
You got my question.I try to do so.it success!
Thank you Mike,thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic