How do I limit length of a dropdown menu?

I have a drop down menu that represents a field in my database table that is several hunfred characters long. How could I limit the size of the text box on my JSP page so that it doesn't represent the entire length of the string? Either cutting it off at a certain point and not being able to see the remainder of the string would be good or even better if when the string was selected, the user could scroll across a text box of size 30 across to see the entire string.

Please help and show some code if possible.

Thank you very much in advance for your assistance.

[593 byte] By [moined_mogul] at [2007-9-26 2:32:58]
# 1
please help...thank you
moined_mogul at 2007-6-29 9:55:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Use the "value" property for the <option tag><select name="myField"><option value="my entire value would appear here">my shortened value</select>How you build this depends upon your implementation.Are you using a ResultSet?
chiranjp at 2007-6-29 9:55:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
yes
moined_mogul at 2007-6-29 9:55:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I am getting these values that populate my drop down from a column in the table of my database. The field in my database is 400 characters long.

How can I make sure that the drop down menu that appears on my JSP page is not more than 50 characters long. With allowing the user to scroll along within that text box of length 50 to see the entire 400 characters only when selected?

Please help?

Thank you.

moined_mogul at 2007-6-29 9:55:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

This is the tag I am trying to limit the size of the drop down menu.

PLEASE HELP!!!!

<TR>

<TD ALIGN="right"><B><B><div class="text">Number:</div></B></TD>

<TD><SELECT type="select" name="Number">

<OPTION value=0> - Select Number - </OPTION>

<%

String[] NumberList = beanName.getList("NumberList");

if (NumberList != null)

{

for (int i=0; i < NumberList.length; i++)

{

if (NumberList.equals (strSelectedResource))

{

%>

<OPTION selected value="<%= NumberList %>"> <%= NumberList %> </OPTION>

<%

}

else

{

%>

<OPTION value="<%= NumberList %>"> <%= NumberList %> </OPTION>

<%

}

}

}

else

{

%>

<OPTION> No Numbers Loaded </OPTION>

<%

}

%>

</SELECT>

</TD>

</TR>

moined_mogul at 2007-6-29 9:55:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

I guess you could cut the string off at 50 chars.

String option = .....; // from your ResultSet

.

.

option = option.substring(0, 50); // cuts it off at 50 chars.

%>

<option value="<%=option%>"><%=option%></option>

<%

.

.

Enygma42 at 2007-6-29 9:55:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...