get request

By clicking a hyperlink in html file can i pass desired page as a string to servlet which will in get the web page and how?Help please, thanx
[155 byte] By [calvinWpecker] at [2007-9-30 20:06:14]
# 1

Hi calvinWpecker,

U did not explain ur problem properly.

But what I figured out is that maybe u want to pass a String as a parameter to a servlet.

Yes u can do that. Here's how...

Say u have a page named page1.jsp. Here u have a link to page2.jsp as

<a href="http://localhost:8080/examples/page2.jsp">Go 2 page2</a>

In this link, u want 2 pass a String parameter say, "www.java.sun.com";

Now the link will work as,

<a href="http://localhost:8080/examples/page2.jsp?web_page_name='www.java.sun.com'">Go 2 page2</a>

Here web_page_name is the name of the parameter that u r passing to the next page and www.java.sun.com is it's value.

Now, after this, u can collect this value in page2.jsp or ur servlet with the help of request.getParameter("web_page_name") method.

I hope this is what u wanted.

Keep me posted.

Cheers !!

Sherbir.

sherbir at 2007-7-7 0:52:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
That is exactly the explanation I was looking for.Thanx heaps Sherbir
calvinWpecker at 2007-7-7 0:52:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...