actually, you can simulate a form post in javascript, if you dont want your
users to see the Query string. just pass the value into a hidden form field,
and have javascript assign it, then submit with the function.

<form name="someForm" action="vendorparts.jsp" method="post">
<input type="hidden" name="hiddenValue" value="">
<A  HREF="#" ONCLICK="jsSubmit('0001234')">Janes Plumbing</A>
<A  HREF="#" ONCLICK="jsSubmit('0005678')">Joes Plumbing</A>
</form>
<script language="javascript">
function jsSubmit(someval) {
        document.someForm.hiddenValue.value = someval;
        document.someForm.submit();      
}
</script>
-----Original Message-----
From: Rick Snide [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 09, 2002 12:14 PM
To: [EMAIL PROTECTED]
Subject: Setting bean properties on a link with onclick


I have a page "vendors.jsp" where (using a bean) I display a list of vendors
to choose from.  This list of vendors is a list of hyperlinks that the user
can click.  I want the user to click the link and then see the parts that
are associated with that vendor (vendorparts.jsp).  My thought was to use
the HREF=vendorparts.jsp and also use the onclick method to set the vendor
number selected in the bean for the vendorparts.jsp to know whose parts to
display. 
 
my list of links (created by my bean) has items like this for the user to
choose:
<A  HREF=vendorparts.jsp ONCLICK="submit_onclick('0001234')">Janes
Plumbing</A>
<A  HREF=vendorparts.jsp ONCLICK="submit_onclick('0005678')">Joes
Plumbing</A>
 
My problem is that I don't have a good way to set the bean value (setVendor)
before the page in the link is called.  I want to accomplish it with "xml
style" setting the bean properties rather than mixing in alot of "pure
java". 
 
1.  If  I try to use a "normal" java method, the submit_onclick method can
not be found.
2.  If I try to use a function instead, I apparently can not pass a value to
the function.
3.  I don't want to pass parms such as HREF=vendorparts.jsp?vendor=0001234
to prevent the user from looking at someone else's parts.
 
Is there a better way to do this?  
 
Thanks in advance - and sorry for being so wordy.
Nrzf%䭊lz䭻jⴭw(
%#ⴭ51$Ţb-晨bᡮ.&⽮+anrIH簠
LDDI0D䭓J^,rR?ⴭ^䭶   jm䭶j!䭊ڲ    o㲘
m䭚Xmͫ      o鮇nr?䭎}캪ia慮0z^?楧㲗ڪ;)i摩0㌳8.(퍛ګu〵cm#'^&

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to