× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> From: michael@xxxxxxxxxxxxxxxxxx
> 
> Here's the section of the jsp...
> 
> <td id="WC_AdvancedCatalogSearchForm_TableCell_14">&nbsp;&nbsp;
>             <select name="keyword_searchTerm">
>             <option value="" selected>any keyword</option>
>             <%
>             for (int k = 1; k <=
> Integer.parseInt(keywordText.getString("KEYWORD_NUM") ); ++k )
>             { %>
>                         <option
> value="<%=keywordText.getString("KEYWORD_" + k
> )%>"><%=keywordText.getString("KEYWORD_" + k )%></option>
>             <%
>             }
>             %>
>             </select>
> </td>

Actually, assuming that keywordText is a properties file, this
particular code simply dumps the values.  It doesn't show where
keywordText is loaded.  In a JSP Model II approach, you would see
"keywordText" as the ID attribute of a useBean tag somewhere.

Also, just a thought, but I'd highly consider wrapping that particular
code in a class and calling it.  Building a SELECT is something you do
over and over, and the interleaved HTML/Java code is just too prone to
mistakes and errors.  For example, what if there is no entry for
KEYWORD_NUM, or it contains invalid data? 

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.