Dynamic Drop-Down Menu Solution

Hi All,
After spending a lot of time trying to find a good solution for a dynamic drop-down menu, I end up writing my own.
The solution is for a list of items, having ITEM as the primary key of the table and ITEMDESCRIPTION as the list of options for the user to select.
The steps are:
1) JavaBean to return a ResultSet;
2) A custom tag to build a HTML SELECT;
3) A .tld file to declare the custom tag;
4) web.xml where the custom tag mapping resides;
4) A JSP to illustrate how to call the custom tag;
Hoping this will save lots of time to others
Cheers
Trajano Roberto
1) Custom tag
package com.amstras.maintenance.customtags;
* Title: erp
* Description:
* Copyright: Copyright (c) 2001
* Company: amstras
* @author Trajano Roberto
* @version 1.0
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.sql.*;
import com.amstras.maintenance.javabeans.*;
public class listitemmaster extends TagSupport {
private itemmaster itemmaster = new itemmaster();
private ResultSet rs = null;
private String parametername = null;
public int doStartTag() throws JspException {
try {
itemmaster.connect();
rs = itemmaster.listitemmaster();
pageContext.getOut().print( "<select name = \"" + parametername + "\">" );
catch ( Exception e ) {
throw new JspTagException( e.getMessage() );
finally {
return EVAL_BODY_INCLUDE;
public int doAfterBody() throws JspException {
try {
if( rs.next() ) {
pageContext.getOut().print( "<option value = \"" + rs.getString( "ITEM" ) + "\">" + rs.getString( "ITEM" ) + "&nbsp&nbsp&nbsp" + rs.getString( "ITEMDESCRIPTION" ) + "</option>" );
return EVAL_BODY_AGAIN;
else {
pageContext.getOut().print( "</select>");
itemmaster.disconnect();
return SKIP_BODY;
catch ( Exception e ) {
throw new JspTagException( e.getMessage() );
public void setParametername( String sPARAMETERNAME ) {
parametername = sPARAMETERNAME;
2) JavaBeam where the method to return the ResultSet resides
public ResultSet listitemmaster() throws SQLException, Exception {
if( con != null ) {
try {
String sSQL = null;
sSQL = " SELECT ITEM, ITEMDESCRIPTION FROM ITEMMASTER ORDER BY ITEM ";
ps = con.prepareStatement( sSQL );
rs = ps.executeQuery();
catch( SQLException sqle ) {
error = "SQLException: list item master failed possible record does not exist. ";
error += sqle.toString();
throw new SQLException( error );
catch( Exception e ) {
error = "An exception occured while listing item master record. ";
error += e.toString();
throw new Exception( error );
finally {
return rs;
else {
error = "Exception: Connection to database was lost.";
throw new Exception( error );
3) extract from the .tld file where the custom tag is declared
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>itemmaster</short-name>
<description>item master</description>
<tag>
<name>viewitemmaster</name>
<tag-class>com.amstras.maintenance.customtags.viewitemmaster</tag-class>
<attribute>
<name>item</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description>item</description>
</attribute>
</tag>
<tag>
<name>listitemmaster</name>
<tag-class>com.amstras.maintenance.customtags.listitemmaster</tag-class>
<attribute>
<name>parametername</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description>parameter name</description>
</attribute>
</tag>
</taglib>
4) web.xml mapping for the custom tag
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>debugjsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>jspCompilerPlugin</param-name>
<param-value>com.borland.jbuilder.webserverglue.tomcat.jsp.JasperSunJavaCompiler</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>debugjsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>erp/maintenance/itemmaster</taglib-uri>
<taglib-location>/WEB-INF/itemmaster.tld</taglib-location>
</taglib>
</web-app>
5) JSP call to the custom tag
<%@ page errorPage="billofmaterialErrorPage.jsp" %>
<%@ taglib prefix = "im" uri = "erp/maintenance/itemmaster" %>
<html>
<head>
<title>CSI - ERP - add bill of material</title>
<link rel = "stylesheet" href = "/erp/erpstyle.css">
</head>
<body>
<h1>Add Bill of Material</h1>
<form action = "billofmaterialcontroller.jsp" method="post">
<table>
<tr>
<td align = "LEFT"><font color = blue>Parent Item:</font></td>
<td><im:listitemmaster parametername = "parameter1" /></td>
</tr>
<tr>
<td align = "LEFT"><font color = blue>Child Item:</font></td>
<td><im:listitemmaster parametername = "parameter2" /></td>
</tr>
<tr>
<td align = "LEFT"><font color = green>Qty Per:</font></td>
<td><input type = "text" name = "parameter3" size = "5" maxlength = "5" /></td>
</tr>
</table>
<p>
<input type="submit" name="submit" value="Add">
<input type="reset" value="Reset">
</p>
<input type = "hidden" name = "Action" value = "Add">
</form>
Click <a href = "billofmaterial.jsp">here</a> to go back.
</body>
</html>

This is a very helpful execellent sample code.
However, If I'm using Model-View-Control approach, then what's the way of applying these codes
to each indivisual file? Say, I have 20 files and only 4 of the 20 need to be treated as they like
to have drop down menu in particular column(s)??? How could the custom tag be applied as the
controller tells the view to present these special treat? or it is not possible (I have to treat each
file, filtered by controller -- one by one as it encounters the special need)?
Thx, Tzae

Similar Messages

  • --urgent Can I use table data to create a dynamic drop down menu?

    Hi,
    I am asked to investigate the possibility of using APEX to create a table driven dynamic drop down menu? The deadline is tomorrow but I have spent quite a bit of time but still have not any clue. Can any one have such experience to point me a way to focus on?
    Many thanks.
    Jennifer

    Thanks you very much for the help Kevin.
    Currently my company is using htp.p style to create web app and using the dynamic menu in a similar way as you explained. Now they want to move to Apex and still keep dynamic menu functionality. After reading your response and research I have done I think I can embed it into Apex application by creating the similar table and PL/SQL package and let Apex to call the PL/SQL package when the application is first called. However may I ask you a question about how to call such pl/sql procedure in Apex? .
    The current application has the following URL, from which the procedure pkg_main.print_menu is called and html home page with dynamic menu is displayed.
    Http://app server:1234/pls/applicationname/pkg_main.print_menu?p_new_window=N
    BUT what about the Apex? The Apex URL format is like the following, where 11563 and 1 is application id and page number. Assume that 1 is home page, but HOW the procedure is called, from WHERE?
    http://apex.oracle.com/pls/apex/f?p=11563:1:3397731373043366363
    Jennifer

  • Utilizing Custom Tags to create a dynamic drop-down menu

    Hi to all,
    I am looking to create a dynamic .jsp to display to the user a drop-down list. This list is based upon data in database. The data will be passed as an application bean. This list will vary depending on application criteria.
    I would like to use a custom tag to create the drop-down menu. I am attempting to keep the .jsp page strictly .jsp, no Java. (I have been successful in creating & using an iterator tag.)
    Can someone point me in the right direction, or give me an example?
    thanks!
    Susie in Virginia Beach

    What exactly is it you don't know how to do? Write a custom tag or write database access code?

  • How to make dynamical drop down menu?

    I am trying to make a drop down menu which is dynamical in dreamweaver? is there a way to do that? i am not good at programming.

    Here are links to a couple of tutorials for this:
    http://www.roscripts.com/Building_a_dynamic_drop_down_menu-216.html
    http://www.finalwebsites.com/tutorials/dynamic-navigation-list.php

  • Setting default value in dynamic drop-down menu

    Hi,
    I created a simple drop-down menu that can be used to edit an
    existing record or to create a new record.
    When creating a new record, I'd like the drop-down menu to
    display "Not specified" by default. Could anyone help me with this?
    The "Not specified" option in the drop-down menu should refer
    to record ID 11 in my database table entitled "names".
    Here's what my code looks like so far.
    The db queries:
    <CFQUERY DATASOURCE="DATA" NAME="get">
    SELECT *
    FROM names
    order by name
    </CFQUERY>
    <CFQUERY DATASOURCE="DATA" NAME="quo">
    SELECT *
    FROM quotes
    WHERE quoteID = #quoteID#
    </CFQUERY>
    This part is for the existing database record:
    <select name="frn_ID">
    <cfoutput query="get">
    <option value="#id#"<cfif id is quo.frn_ID>
    selected</cfif>>#name#</option>
    </cfoutput>
    </select>
    Here is where I'd like the ID with a default value of 11 to
    be displayed:
    <cfelse>
    <select name="frn_ID">
    <cfoutput query="get">
    <option value="#id#">#name#</option>
    </cfoutput>
    </select>
    </cfif>
    Thank you for any help with this!
    Luke

    Thank you.
    I added this line:
    <CFSET ThisOne = 11>
    and then edited the drop-down menu to appear like this:
    <select name="frn_ID">
    <cfoutput query="get">
    <option value="#id#" <cfif ThisOne is ID>
    selected</cfif>>#name#</option>
    </cfoutput>
    </select>

  • Dynamic Drop Down Menu from an Access Database

    Hello Everyone,
    I am user Adobe Designer 7 to create a fillable PDF, and I would like to get the options for a drop down menu from my MS Access database. Basically I would like to populate the drop down menu with the names in the Access database. There i Have a table called PhoneNumbers and it contains the names of all the people I want to appear in the drop down menu that I just created.
    This is what I did:
    I created a drop down menu and then I clicked on Object > Binding > under "Default Binding (Open, Save, Submit)" choose "New Data Connection"
    then connect to the database using a fileDSN. I opened the table where with the "names" column (PhoneNumbers)
    and under the "Query," option, I wrote:
    select * from PhoneNumbers
    Then it gave me all the fields from the table and I dragged the "Last name" field over the drop down menu. I will need to find a way to get the "First Name" field to join the Last Name field to create one name that looks like this: Hill, Angie
    The problem is that even though it shows the name from the Access database, it does not give me a list of all the names when I open the form in Reader 7...
    No matter how much I click that drop down arrow, the name does not change...
    It's almost as if it gets to the databse and gets the data from the database, but it cannot loop through it...
    It's almost as if it's missing the code to loop through it...
    Why is this? Any ideas how to fix it so it gives me a list of ALL the names, when I click on the drop down button?
    After that, how can I add the first name to it?
    The form would look like this:
    Angie H. 202 641 2055
    Right now it does look like that, but I cannot change to another name when I click the drop down menu. For the code to be working when I change to another name, the phone number also changes to the phone number of that person:
    Barry S. 703 555 1258
    The name is in a drop down menu, the phone number is in a textbox.
    Can you help me with this?

    ANGELA,<br /><br />Well, the good new is that you are not far off...What you need is to insert the following code using Java Script under the Initialize function.  Just replace the Connection name,  The Hidden Value, and the Display Text with your information.  This is a function is 8.0 but will work with 7.0<br /><br />/*     This dropdown list object will populate two columns with data from a data connection.<br /><br />     sDataConnectionName - name of the data connection to get the data from.  Note the data connection will appear in the Data View.<br />     sColHiddenValue      - this is the hidden value column of the dropdown.  Specify the table column name used for populating.<br />     sColDisplayText          - this is the display text column of the dropdown.  Specify the table column name used for populating.<br /><br />     These variables must be assigned for this script to run correctly.  Replace <value> with the correct value.<br />*/     <br /><br />var sDataConnectionName = "DataConnection";     //     example - var sDataConnectionName = "MyDataConnection";<br />var sColHiddenValue = "CAT_Corp_SeqNo";               //     example - var sColHiddenValue = "MyIndexValue";<br />var sColDisplayText = "CAT_Corporate";               //     example - var sColDisplayText = "MyDescription"<br /><br />//     Search for sourceSet node which matchs the DataConnection name<br />var nIndex = 0;<br />while(xfa.sourceSet.nodes.item(nIndex).name != sDataConnectionName)<br />     {<br />          nIndex++;<br />     }<br /><br />var oDB = xfa.sourceSet.nodes.item(nIndex);<br />oDB.open();<br />oDB.first();<br /><br />//     Search node with the class name "command"<br />var nDBIndex = 0;<br />while(oDB.nodes.item(nDBIndex).className != "command")<br />     {<br />          nDBIndex++;<br />     }<br /><br />//     Backup the original settings before assigning BOF and EOF to stay<br />var sBOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction");<br />var sEOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction");<br /><br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayBOF", "bofAction");<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayEOF", "eofAction");<br /><br />//     Clear the list<br />this.clearItems();<br /><br />//     Search for the record node with the matching Data Connection name<br />nIndex = 0;<br />while(xfa.record.nodes.item(nIndex).name != sDataConnectionName)<br />     {<br />          nIndex++;<br />     }<br />var oRecord = xfa.record.nodes.item(nIndex);<br /><br />//     Find the value node<br />var oValueNode = null;<br />var oTextNode = null;<br />for(var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex++)<br />     {<br />          if(oRecord.nodes.item(nColIndex).name == sColHiddenValue)<br />          {<br />               oValueNode = oRecord.nodes.item(nColIndex);<br />          }<br />          else if(oRecord.nodes.item(nColIndex).name == sColDisplayText)<br />     {<br />          oTextNode = oRecord.nodes.item(nColIndex);<br />     }<br />}<br /><br />while(!oDB.isEOF())<br />{<br />      this.addItem(oTextNode.value, oValueNode.value);<br />       oDB.next();<br />}<br /><br />//     Restore the original settings<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sBOFBackup, "bofAction");<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sEOFBackup, "eofAction");<br /><br />//     Close connection<br />oDB.close();

  • Drop down menu not appearing correctly

    Hi
    i have a dynamic drop down menu on one of my site pages (
    http://www.mantle.co.uk/investment.php?ID=1),
    the menu optionss are appearing outside of the menu?
    i cannot see why,
    below is my code:
    <form action="<?php print $_SERVER['PHP_SELF'];?>"
    method="get">
    <label for="menu"></label>
    <select name="ID" class="dropdown" id="menu"
    onchange="this.form.submit()">
    <noscript><input type="submit" value="Go"
    /></noscript>
    <option value="" selected="selected">Jump To Another
    Project</option>
    <?php
    do {
    ?>
    <option value="<?php echo
    $row_rsOtherDevs['devID']?>"><?php echo
    $row_rsOtherDevs['title']?></option>
    <?php
    } while ($row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs));
    $rows = mysql_num_rows($rsOtherDevs);
    if($rows > 0) {
    mysql_data_seek($rsOtherDevs, 0);
    $row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs);
    ?>
    </select>
    </form>
    please could you help me!

    On Tue, 28 Nov 2006 11:38:59 +0000 (UTC), "Kamesh192"
    <[email protected]> wrote:
    > <form action="<?php print
    $_SERVER['PHP_SELF'];?>" method="get">
    > <label for="menu"></label>
    >
    > <select name="ID" class="dropdown" id="menu"
    onchange="this.form.submit()">
    > <noscript><input type="submit" value="Go"
    /></noscript>
    > <option value="" selected="selected">Jump To
    Another Project</option>
    > <?php
    > do {
    > ?>
    > <option value="<?php echo
    $row_rsOtherDevs['devID']?>"><?php echo
    >$row_rsOtherDevs['title']?></option>
    > <?php
    > } while ($row_rsOtherDevs =
    mysql_fetch_assoc($rsOtherDevs));
    > $rows = mysql_num_rows($rsOtherDevs);
    > if($rows > 0) {
    > mysql_data_seek($rsOtherDevs, 0);
    > $row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs);
    > }
    > ?>
    >
    > </select>
    > </form>
    Change the above to:
    <form action="<?php print $_SERVER['PHP_SELF'];?>"
    method="get">
    <select name="ID" class="dropdown" id="menu"
    onchange="this.form.submit()">
    <option value="" selected="selected">Jump To Another
    Project</option>
    <?php
    do {
    ?>
    <option value="<?php echo
    $row_rsOtherDevs['devID']?>"><?php echo
    $row_rsOtherDevs['title']?></option>
    <?php
    } while ($row_rsOtherDevs =
    mysql_fetch_assoc($rsOtherDevs));
    $rows = mysql_num_rows($rsOtherDevs);
    if($rows > 0) {
    mysql_data_seek($rsOtherDevs, 0);
    $row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs);
    ?>
    </select>
    <noscript><input type="submit" value="Go"
    /></noscript>
    </form>
    Gary

  • Drop down menu not appearing right

    Hi
    i have a dynamic drop down menu on one of my site pages (
    http://www.mantle.co.uk/investment.php?ID=1),
    the menu optionss are appearing outside of the menu?
    i cannot see why,
    below is my code:
    <form action="<?php print $_SERVER['PHP_SELF'];?>"
    method="get">
    <label for="menu"></label>
    <select name="ID" class="dropdown" id="menu"
    onchange="this.form.submit()">
    <noscript><input type="submit" value="Go"
    /></noscript>
    <option value="" selected="selected">Jump To Another
    Project</option>
    <?php
    do {
    ?>
    <option value="<?php echo
    $row_rsOtherDevs['devID']?>"><?php echo
    $row_rsOtherDevs['title']?></option>
    <?php
    } while ($row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs));
    $rows = mysql_num_rows($rsOtherDevs);
    if($rows > 0) {
    mysql_data_seek($rsOtherDevs, 0);
    $row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs);
    ?>
    </select>
    </form>
    please could you help me!

    On Tue, 28 Nov 2006 11:38:59 +0000 (UTC), "Kamesh192"
    <[email protected]> wrote:
    > <form action="<?php print
    $_SERVER['PHP_SELF'];?>" method="get">
    > <label for="menu"></label>
    >
    > <select name="ID" class="dropdown" id="menu"
    onchange="this.form.submit()">
    > <noscript><input type="submit" value="Go"
    /></noscript>
    > <option value="" selected="selected">Jump To
    Another Project</option>
    > <?php
    > do {
    > ?>
    > <option value="<?php echo
    $row_rsOtherDevs['devID']?>"><?php echo
    >$row_rsOtherDevs['title']?></option>
    > <?php
    > } while ($row_rsOtherDevs =
    mysql_fetch_assoc($rsOtherDevs));
    > $rows = mysql_num_rows($rsOtherDevs);
    > if($rows > 0) {
    > mysql_data_seek($rsOtherDevs, 0);
    > $row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs);
    > }
    > ?>
    >
    > </select>
    > </form>
    Change the above to:
    <form action="<?php print $_SERVER['PHP_SELF'];?>"
    method="get">
    <select name="ID" class="dropdown" id="menu"
    onchange="this.form.submit()">
    <option value="" selected="selected">Jump To Another
    Project</option>
    <?php
    do {
    ?>
    <option value="<?php echo
    $row_rsOtherDevs['devID']?>"><?php echo
    $row_rsOtherDevs['title']?></option>
    <?php
    } while ($row_rsOtherDevs =
    mysql_fetch_assoc($rsOtherDevs));
    $rows = mysql_num_rows($rsOtherDevs);
    if($rows > 0) {
    mysql_data_seek($rsOtherDevs, 0);
    $row_rsOtherDevs = mysql_fetch_assoc($rsOtherDevs);
    ?>
    </select>
    <noscript><input type="submit" value="Go"
    /></noscript>
    </form>
    Gary

  • Drop Down Menu selection query for recordset.

    I am looking to utilize a dynamic drop down menu to query a recordset...I am using Colfusion to import an MS Access database that contains the following fields: "Model Date", "Name", "Points" and "Target".  Each time the database updates, the "Model Date" field contains the date and time the model was run.  I have figured out how to create a dynamic drop down using SELECT DISTINCT "model date" and have also figured out how to create the dynamic recordset to be displayed showing the "Name", "Points" and "Target" data. 
    I want the user to select the "Model Date" from the drop down, hit a submit button and then have the appropriate "Name", "Points" and "Target" data queried and shown below.
    The query should take the selection from the "model date" dropdown and then query the "name", "points" and "target" fields for that particular "model date"
    I admit my knowledge of SQL and Coldfusion is not the best, but it seems like this is a somewhat simple task and I am just missing one or two pieces of the cog to put it all together.
    The database basically looks like this:
    Model Date...........Name..........Points........Target
    8/1/2010 08:00......John Doe.....1,250.........5.55%
    8/1/2010 08:00......Jane Doe.....850............2.35%
    8/1/2010 08:00......Bill Smith....11,832........-123.23%
    8/2/2010 09:02......John Doe.....1,323.........6.67%
    8/2/2010 09:02......Jane Doe.....1,001.........3.21%
    8/2/2010 09:02......Bill Smith....10,235........-110.26%
    The dropdown will only show the "model dates"
    8/1/2010 08:00
    8/2/2010 09:02
    For example, if 8/1/2010 08:00 was selected from the dropdown, I want the following displayed:
    Name..................Points...................Target
    John Doe.............1,250....................5.55%
    Jane Doe.............850.......................2.35%
    Bill Smith............11,832...................-123.23%
    Any help or suggestions would be greatly appreciated!!!
    Thanks,
    Mike

    My second paragraph talks about just displaying the filtered data, so I'm assuming that's what you're looking for, but still not quite sure based on what the other responses are. 
    But I head on anyway -
    On your first page, make note of the instance name of your drop down menu, such as "ModelDate".  Make sure it's in a Form and set the form action to the page where you want to display your data, set the form action to POST.
    On the results page, create a table with cells for each of the data elements you want to display. Create a recordset which you can do in Simple mode. Leave it at select all, and set the filter drop down to the database field which contains your Model Date. In the box to the right, select "=". the next dropdown selct "Form Variable" and the variable name type in the instance name of the drop down on the first page. 
    I may not have the terminology right, doing it from memory.
    From the data bindings tab, expand your recordset and locate each of the database fields you want to display.  Drag each one to the table cell on the page where you want it displayed.  The table cells have to be in a linear row.
    Now, select the table row buy selecting the TR tag in the tags just above the properties panel.  In the server behaviors tab, select repeat region and "All Records"
    Publish your pages and test!

  • Dynamically generate drop down menu

    I am using JSTL to generate a drop down menu on the page
    <html:select size="1" property="reportYear">
    for(int i = 2000; i < 2100; i++)
    { %>
    <html:option value="<%=i%>"><%=i%></html:option>
    <% } %>
    </html:select>
    this doesnt work the problem is printing those double quotes for the value...
    I get the following error
    [ServletException in:/ucpages/contract/CapReportList.jsp] Unable to compile class for JSP Generated servlet error: [javac] C:\Sun\AppServer8\domains\domain1\generated\jsp\j2ee-modules\uc\org\apache\jsp\ucpages\contract\CapReportList_jsp.java:249: cannot resolve symbol [javac] symbol : method setValue (int) [javac] location: class org.apache.struts.taglib.html.OptionTag [javac] jspxth_html_option_12.setValue(i); [javac] ^ [javac] 1 error '
    also tried printing the double quotes using <% out.print("\""); %>
    nothing works

    Seemingly the primitive type int isn't allowed here. Something like the following is close to your code and outputs the result you want:
    <form action="index.jsp">
        <select size="1" property="reportYear">
    <%
    for(int i = 2000; i < 2100; i++)
    { %>
    <option value="<%=Integer.toString(i)%>"><%=Integer.toString(i)%></option>
    <% } %>
    </select>
    </form>Or loop using tags with c:forEach.

  • Populating drop down menu's from database dynamically

    Hi
    I m facing a problem of populating the drop down menu from a MS Access database using JSP. But i m not able to do it. Can you please help me out?
    this works perfectly for textarea
    <textarea cols="20" rows="20">
    <% for(int i =1; i <=rsmd.getColumnCount();++i)
    out.println(rsmd.getColumnName(i)); %>
    </textarea>
    but for drop down box it gives problems
    Heres the code!
    <select name="aa" ID = "aa">
    <option value="<% for(int i =1; i <= rsmd.getColumnCount();++i)
    out.println(rsmd.getColumnName(i)); %>" > </option>
    </select>
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 61 in the jsp file: /gv/event.jsp
    Generated servlet error:
    i cannot be resolved
    wat can be the alternative? Please hlp
    Regards
    Sami

    Hi i m facing a problem in jsp while filling the dropdown box<select name="combosubject"  width="10%" maxlength="20"/>
                                  <option ></option>
                                  <%
                                                System.out.println("1st time");
                                                rs=stmt.executeQuery("select subject.name from subject order by name");
                                                while(rs.next())
                                                  subject = rs.getString(1);
                                             %>     
                                             <option ><%=subject%></option>
                                             <%
                             rs.close();
                             stmt.close();
                       %>the problem is that when i execute this code for the first time it works fine and after that it keeps on throwing exception like "No data found", "Column not found"
    on <form> action i have recalled this function that is when i click the search button this page is executed again and at this moment i got the exception

  • Drop down menu for top level navigation

    Dear All,
    I recently had a quick peek at SAP's corporate Portal, which has a drop down menu in the top level navigation that dynamically changes the secondary level navigation based on the option selected.
    We are currently running a standard portal (<b>not</b> an external facing lightweight framework portal), does anyone know how to achieve a similar result so that we can provide a drop-down menu to allow the user to dynamically change their role structure?
    Many thanks
    James

    Hi James,
    We have implemented such thing two years ago, also without EFP (with the light framework, it's easy). It took some days (more than 5) to change every JS, JSP etc which has to be touched for this. In the end, the first level of the navigation had been moved up into the dropdownbox, so that when changing the ddb, the two lines of the originabl TLN showed in fact the second and the third level (and the DTN starting with the fourth level).
    It was really nice, but keep in mind that this means modifying the standard and maintaining this solution with new SPS coming up...
    Hope it helps
    Detlev

  • Contacts drop-down menu blocked by on screen keyboard in text messages

    Whenever I draft a new text message I put the cursor in the contact box and type the first letter of the name of the person I am trying to contact.  If I have more than 3 people in my phone whose names start with that letter, the drop down menu becomes partially obscured by the on screen keyboard.  If I attempt to scroll down on the menu, it selects whomever I happen to press.  My attempts to minimize the keyboard have been futile.  I understand I can work around this by going into contacts and selecting someone to text, but the problem is pretty aggravating.  Please help!

    Want to contract me? You can follow me on Twitter @RobGambino
    Be sure to click Like! for those who have helped you.
    Click Accept as Solution for posts that have solved your issue(s)!

  • Thanks to the super-users, and questions on backgrounds and drop-down menu

    Hi all.
    I've spent a fair amount of time perusing the archives, so I don't have to bother you all with the basic questions. Great thanks to Wyodor, Old Toad, Ethmoid and Cyclosaurus for their excellent and oft-repeated tutorials.
    With your help, I've figured out how to set up a personal domain name, modify my background image, and create a drop-down menu. (These were major accomplishments for a neophyte like me.) My primitive template can be seen here:
    http://www.monroekarate.org/dojo/Template.html
    And I am pretty happy with it. I have one problem, and one minor element that I'd like to fix.
    The drop-down menu was created following the excellent tutorial from the iWebfaq but I notice that although it looks perfect there is one malfunction. If you hover and try to select an element where there is no underlying content, it works fine. When you try to select a list item with underlying content, however, the drop-down disappears. Any idea why that happens or how I can fix it? I suppose I could just add a space buffer, but that is an inelegant solution.
    On a more trivial note, the background was actually supposed to be composed of two images. The top row was supposed to be a horizontal set of tiles (slightly darker in color) and the rest of the background was tiled in a second image, giving a gradient effect. I used the script Wyodor described here with repeat set to yes which gave me single-image tiling. Looks OK, but if I could get both sets of tiles used it would add substantial richness to the visual effect. Ideas?
    Thanks again for all your help to date, and thanks in advance for considering this issue!
    Cheers,
    Liam

    I appreciate your reply but those arrows were not the ones I was trying to describe. In the same box where you would type your web address on the far right is a small star and then next to it an arrow pointing down. If you click on this arrow, it normally drops down a list of the websites you commonly use. Or, if you are on a website ordering something, there might be a similar arrow that you need to select in order to choose which shipping you might want such as ground, next day air, etc., these are the kinds of arrows that are not working correctly now. Any ideas on these? Thanks for trying to help me.

  • Autocomplete does not work (no drop-down-menu)

    Hi all
    I'm trying to setup the autocomplete-input, but it doesn't
    work. When I type anything into the textbox, the animated image
    beside the box shows activity and I see the submitted data from the
    backend in debug mode, but the drop-down-menu with the matching
    records does not appear.
    if I build a static list of possible choices in the
    cfinput-tag, it works.
    my cfc returns an array and this is serialized as JSON in the
    calling backend-template (see code below). In source code view of
    the html-page, I see lots of java-script and CSS inserted into the
    page.
    any ideas?
    stefan
    calling template:
    <cfsilent>
    <cfscript>
    //Get Query
    locationArray =
    application.addressDao.findLocation(url.term);
    </cfscript>
    </cfsilent>
    <cfoutput>#serializeJSON(locationArray)#</cfoutput>
    relevant part of CFC:
    <cfloop query="qLocations">
    <cfset arrayAppend(records, fPLZ & " " &
    fOrtschaft)>
    </cfloop>
    <cfreturn records/>
    form-page:
    <cfform action="" method="post" name="editForm"
    id="editForm">
    Dynamische Auswahlliste: <br />
    <cfinput type="text" name="ziplocation"
    autosuggest="url:ajaxLocationAutoComplete.cfm?term={cfautosuggestvalue}"
    autosuggestMinLength="3" maxResultsDisplay="10"><br
    />
    <br />
    </cfform>

    Rather a general answer I am afraid, as I can not see an obvious problem & solution:
    # Note for any one off problems with sites it is always worth clearing cookies for that site and cache [[How to clear the Firefox cache]] &[[Delete cookies to remove the information websites have stored on your computer]]
    # Try in safemode (see [[Troubleshoot Firefox issues using Safe Mode]]) that is accessible from your Firefox Button. (but at this stage do not yet try the reset)
    #* next try in safemode and also disable the java plugin that you have (Safe mode disables extensions not plugins)
    #* for info: note Java and Javascript are different animals: http://kb.mozillazine.org/JavaScript_is_not_Java
    # if the above do not help then try the Firefox reset, '''but''' be aware you will loose open tabs, extensions, and certain preferences, you may need to bookmark things first so you can find them again see [[Reset Firefox – easily fix most problems]]

Maybe you are looking for

  • Need to authorize purchases one at a time!  HOW?

    I'm about to have two very mad kids, because I just disabled access to the itunes store. It's the only way to get the parental control I need. In the "good old days", my kids would put songs they wanted to buy in the shopping cart, I would approve or

  • Photosmart 6520 e Windows 7 printer says it is connected to network, but will not print.

    I've followed all suggestions in troubleshooting both from manual and on line.  Shut off firewall, unplugged, plugged waited.  Nothing changes.  All printouts from the printer say connected, but will not print and computer detection of the printer sa

  • Problem with renderpdfform

    Hi all,<br /><br />I have a problem with using the renderPDFForm service.<br /><br />I have some xml files that I need to merge with an xdp form template. So I have set up a watched folder where I drop of the XML and then the renderPDFForm process I

  • TOMCAT 4.0 & SUN J2EE Implementation 1.3.1

    Did anybody have any success configuring those two together????? It seems like no meter what I do Tomcat is only looking at its own Context. I had no problem accessing EJB sitting on SUN's J2EE Impl from IBM WAS, by specifying different javax.naming.

  • Simple question on /jsp:useBean

    Hi, I have a bean within my jsp page. My page doesnt have the </jsp:useBean> code. When users go to my site everything is good. If they hold down F5 for a while, the page hangs and it hangs the whole site until its finished. Its like hold down F5 for