How to set a param in href or using Javascript. (PLEASE HELP)!
Hi,
I have a servlet, that requieres 4 parameters: the jsp page, the bean, and one value from my list box.
I having an issue in order to set the value from my listbox to my href. If I put the value in the variable it works very well, but if i try to read the value from my list box, always givme a null.
Here is the Href sentence:
<% String input = request.getParameter("dominiocustomer");%>
<TD Height="20" width="100"><A Href="/servlet/PInfranetServlet?page=change_login_form&Component=com.portal.web.comp.PServicesBeanImpl&loadBean=yes&dominiocustomer=<%=input%>">Cambiar
Login</A></TD>
Where the "dominiocustomer" is the name of my listbox.
One important thing is that the list box object is under this piece of code, and I don't know it this is the reason, that I having a null value.
I appreciate any help!
[946 byte] By [
clerma] at [2007-9-27 0:22:15]

If your list box (I assume we're talking about the <SELECT> element) is on the same page as your posted code it won't work unless you've made a preceding POST or GET request from the same page.
The request.getParameter("parameterName") will retrieve that parameter from the preceding request and not from the same page (unless the above mentioned circumstances).
If you want to use a value from within the same page I recommend Javascript:
<TD Height="20" width="100">
<A Href="javascript:goLink('/servlet/PInfranetServlet?page=change_login_form& Component=com.portal.web.comp.PServicesBeanImpl& loadBean=yes& dominiocustomer=')"> Cambiar
Login</A></TD>
where the function would look something like this:
<script>
function goLink(param1){
var dc = document.yourFormName.theSelectListName.value;
var linkURL = param1 + dc;
window.location.href=linkURL;
}
</script>
/Rickard E
If your list box (I assume we're talking about the <SELECT> element) is on the same page as your posted code it won't work unless you've made a preceding POST or GET request from the same page.
The request.getParameter("parameterName") will retrieve that parameter from the preceding request and not from the same page (unless the above mentioned circumstances).
If you want to use a value from within the same page I recommend Javascript:
<TD Height="20" width="100">
<A Href="javascript:goLink('/servlet/PInfranetServlet?page=change_login_form& Component=com.portal.web.comp.PServicesBeanImpl& loadBean=yes& dominiocustomer=')"> Cambiar
Login</A></TD>
where the function would look something like this:
<script>
function goLink(param1){
var dc = document.yourFormName.theSelectListName.value;
var linkURL = param1 + dc;
window.location.href=linkURL;
}
</script>
/Rickard E