deddleston
Programmer
Hi, I have the following code, to product a pull down menu
<%
StringTokenizer st = new StringTokenizer(dao.getAllSolutions(), "|"
;
out.println("<select name=\"menu1\" onChange=\"MM_jumpMenu2('self',this,0)\">"
;
String nextVal = "";
int counter = st.countTokens();
if (counter == 1) {
nextVal = st.nextToken();
out.println("<option selected value='metadata_search_facility.jsp?solName="+solName+"&component_name="+nextVal+"'>"+nextVal+"</option>"
;
} else {
if (component_name == null) {
out.println("<option selected>All IM Solutions2</option>"
;
}
while (st.hasMoreTokens()) {
nextVal = st.nextToken().trim();
out.println("<option "
;
if ((component_name != null) && (component_name.trim().equals(nextVal))) {
out.println("selected "
;
}
out.println("value='metadata_search_facility.jsp?solName="+solName+"&component_name="+nextVal+"'>"+nextVal+"</option>"
;
}
}
if ((counter == 1) && (component_name == null)) {
//Only 1 exists
response.sendRedirect("metadata_search_facility.jsp?solName="+ solName +"&component_name="+nextVal);
}
%>
However this doesn't always allow "all IM solutions" to be a choosable option all the time. It will start with that option, but if you choose another (dynamic) the "all IM solutions" option disapears. I need to make it always be there. M$ arn't the only option!
<%
StringTokenizer st = new StringTokenizer(dao.getAllSolutions(), "|"
out.println("<select name=\"menu1\" onChange=\"MM_jumpMenu2('self',this,0)\">"
String nextVal = "";
int counter = st.countTokens();
if (counter == 1) {
nextVal = st.nextToken();
out.println("<option selected value='metadata_search_facility.jsp?solName="+solName+"&component_name="+nextVal+"'>"+nextVal+"</option>"
} else {
if (component_name == null) {
out.println("<option selected>All IM Solutions2</option>"
}
while (st.hasMoreTokens()) {
nextVal = st.nextToken().trim();
out.println("<option "
if ((component_name != null) && (component_name.trim().equals(nextVal))) {
out.println("selected "
}
out.println("value='metadata_search_facility.jsp?solName="+solName+"&component_name="+nextVal+"'>"+nextVal+"</option>"
}
}
if ((counter == 1) && (component_name == null)) {
//Only 1 exists
response.sendRedirect("metadata_search_facility.jsp?solName="+ solName +"&component_name="+nextVal);
}
%>
However this doesn't always allow "all IM solutions" to be a choosable option all the time. It will start with that option, but if you choose another (dynamic) the "all IM solutions" option disapears. I need to make it always be there. M$ arn't the only option!