File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Problem with link label Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Problem with link label" Watch "Problem with link label" New topic
Author

Problem with link label

HARSHAD bhawsar
Ranch Hand

Joined: Feb 22, 2001
Posts: 48
Frds ,
I have an given link to a string as
<a href=**\myservlet>xyz</a>
after clicking on string 'xyz' a servlet will be called ,I want to pass string 'xyz' to the servlet.
How i should do this?
Udayan Naik
Ranch Hand

Joined: Oct 18, 2000
Posts: 135
I think the following code should work..

Here 'param' can be any name u wish to give.
Then u can retrieve the value of param by

------------------
Udayan Naik
Sun Certified Java 2 Programmer


Udayan Naik<BR>Sun Certified Programmer for the Java 2 Platform
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
A few things about this.
First, you should never use '\' slashes in a URL. Although some browsers (particularly IE) find this acceptable in some situations, it is very non-standard. Please use '/' slashes instead.
Second. You should always put the values of attributes in quotes. This is important for XML and XHTML compatibility, but vital if your parameter values might ever contain spaces or other dangerous characters. Get in the habit of quoting all attribute values now.
So the example give might look more like:


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
HARSHAD bhawsar
Ranch Hand

Joined: Feb 22, 2001
Posts: 48
Thanks frds,
It's working.
But what if i want to pass an string like "hello xyz how r u?"
How i can pass it?
 
 
subject: Problem with link label
 
Threads others viewed
passing string to a servlet
help needed.....
problem with sessions - urgent please
want to pass a string to a servlet
org.apache.jasper.JasperException: java.lang.ArrayIndexOutOfBoundsException: 8
developer file tools