I guess I overlooked that restriction in the original e-mail. A form is a
good way to handle it although the info still would be viewable in the page
source. Rahul, you could also just pass back the value of 'i' to the jsp
and retrieve the categoryId in the JSP based on the index. Or you can
return the Category name that you already display as a query param and look
up the category ID back in the JSP.
-Richard
-----Original Message-----
From: Sergey A. Vorobiev [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 02, 2000 9:19 AM
To: [EMAIL PROTECTED]
Subject: Re: href question (Urgent)
Richard Yee wrote:
>
> Rahul,
> Try this:
> <%
> String url = "CategoryMaint.jsp + "?categoryName=" +
> Categories[i][0] +
> "&categoryId=" + Categories[i][1]
> %>
> <A href="<%= url %>"> <%= Categories[i][0] %> </A>
>
> This assumes that the above lines are inside a loop so that i is
incremented
> appropriately.
>
> Inside your CategoryMaint.jsp file, you can get the values of the
> categoryName and categoryId query parameters by using getParameter(...) or
> getParameterValues(...).
>
> If you just care about the categoryId and not the name, you can omit
> categoryName from the url.
>
> -Richard
The original task was not to show categoryID to users. I think it's
silly, but...
Try using an HTML form with a categoryID field and POST method and
modify categoryID value in onclick() handler, something like this:
<form name=catIDform action="CategoryMaint.jsp">
<input type=hidden name=catID>
...
<% ... loop ... %>
...
<A href="#" onClick="catIDform.catID=<%= Categories[i][1] %>;
catIDform.submit(); return false;"> <%= Categories[i][0] %> </A>
...
<% ... end loop ... %>
...
</form>
I think it helps.
> -----Original Message-----
> From: Rahul Naithani [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 02, 2000 5:28 AM
> To: [EMAIL PROTECTED]
> Subject: href question (Urgent)
>
> Hi friends,
> The problem in life is that if I have an href like this:
>
> <A href= "CategoryMaint.jsp" %> <%= Categories[i][0] %> </A>
>
> Then in CategoryMaint.jsp, how can I get to know the id of Category
clicked
> on? Assuming the Category Name is stored in Categories[i][0] and category
id
> is stored in Categories[i][1].
>
> I Don't want to :
> 1) Use Client side scripting.
> 2) Use QueryString because it displays the users the value of category id.
>
> Please help.
> Regards,
> Rahul.
--
Regards,
Sergey Vorobiev
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets