This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes How to pass values from the Form? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to pass values from the Form?" Watch "How to pass values from the Form?" New topic
Author

How to pass values from the Form?

Amy Howard
Ranch Hand

Joined: Jul 11, 2002
Posts: 86
My Browse Page has two listboxes. One is server list, another is TLA listbox. The link image "Search" will display Search page which has the same values of server and TLA which the user selected from the previous page Browse.
The following code can't get server and appTLA value. Do you know what the problem is?
<A href="myTest/controller/SearchFiles?server="+document.forms[0].search.value + ";appTLA=" +document.forms[0].appTLA.value +" onfiltered="MM_swapImgRestore()" onfiltered="MM_swapImage('navsearch','','<%=ctxPath%>/images/nav_search_ov.gif',1)"><IMG name="navsearch" border="0" src="<%=ctxPath%>/images/nav_search_up.gif" width="142" height="18"></A>
Thanks for the help in advance!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

When all is said and done, what does the href attribute of the "a" tag look like when the page is sent to the browser? It looks like there may be a few formatting problems with the URL you are constructing.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amy Howard
Ranch Hand

Joined: Jul 11, 2002
Posts: 86
The following code works correctly without passing any value from the Browse page to the Search page.
<A href="myTest/controller/SearchFiles" onfiltered="MM_swapImgRestore()" onfiltered="MM_swapImage('navsearch','','<%=ctxPath%>/images/nav_search_ov.gif',1)"><IMG name="navsearch" border="0" src="<%=ctxPath%>/images/nav_search_up.gif" width="142" height="18"></A>
Geeta Ramasami
Ranch Hand

Joined: Mar 05, 2003
Posts: 72
Hi,
In seperating the parameters in the querystring u need to use & and not ;.I think u have used ';',thats y u r not getting it..
Try using it like this:
<A href="myTest/controller/SearchFiles?server="+document.forms[0].search.value + "&appTLA=" +document.forms[0].appTLA.value +" onfiltered="MM_swapImgRestore()" onfiltered="MM_swapImage('navsearch','','<%=ctxPath%>/images/nav_search_ov.gif',1)"><IMG name="navsearch" border="0" src="<%=ctxPath%>/images/nav_search_up.gif" width="142" height="18"></A>
Cheers
Geeta
 
 
subject: How to pass values from the Form?
 
Similar Threads
what are the possible reasons for request getting submitted twice?
JSP Action Buttons freez after returning from ajax call
Is Null, Not an Object, or Not Defined
Help needed with onChange()
using ajax and struts iterate tags