I'm using the following code to return results from drop down menues and user input text. It works fine as long as the text is an exact case sensitive match to the data record.
What I want to do is evaluate the output the results of a user input search based on 'param.field' in figure 3. i.e. If 'param.field' = 'name' use a regex to return all records that are a partial, case insensitive match to the input 'value' that was submitted in the search request. Is this possible to accomplish in JSTL? If so I'd like to know how.
Thanks,
Jack
Example1: JavaScript Funciton:
function MM_jumpMenu(targ,selObj,restore, field){ //v3.0 eval(targ+".location='http://mydomain.com/filter.jsp?field="+field+"&value="+selObj. options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script>
Example 2: Form to submit the input and the field 'name' to be found in the bean created array:
<form name="selectName" method="get" action="http:mydomain.com/filter.jsp"> <input type="hidden" name="field" value="name"> <input type="text" name="value" size="16" maxlength="40" value=""> <input type="image" border="0" alt="Go!" src="images/go.gif" align="absmiddle" width="22" height="23" onChange="MM_jumpMenu('parent',this,0,'name')"> <nwc:filterOptions which="name"/> </form>
Example 3: Display the results:
<c:forEach items="${restaurantInfo.restaurants}" var="restaurant"> <c:set target="${restaurant}" property="filterField" value="${param.field}"/> <c:if test="${restaurant.filterValue eq param.value}"> <tr> <td width="155" align="center"> <div align="left"><a href="http://mydomain.com/viewRestaurant.jsp?id=<c:out value="${restaurant.id}"/>"><c:out value="${restaurant.name}"/></a></div> </td> <td width="130"> <div align="left"><c:out value="${restaurant.address1}"/></div> </td> <td width="79"> <div align="left"><c:out value="${restaurant.city}"/></div> </td> <td width="107"> <div align="right"><c:out value="${restaurant.reservationPhone}"/></div> </td> </tr> </c:if> </c:forEach>
=========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com