aspose file tools*
The moose likes Servlets and the fly likes How can I pass a parameter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can I pass a parameter?" Watch "How can I pass a parameter?" New topic
Author

How can I pass a parameter?

qingwu wang
Ranch Hand

Joined: Feb 19, 2003
Posts: 147
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 ]

Thanks...qingwu<br />When I open my eyes,I see your pretty face.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Feb 19, 2003
Posts: 147
You got my question.I try to do so.it success!
Thank you Mike,thanks.
 
Consider Paul's rocket mass heater.
 
subject: How can I pass a parameter?