struts html:option limit?

  • Thread starter Girish T Deshpande
  • Start date
G

Girish T Deshpande

Hi,

I have 350 options <html:select>, but the WebLogic 7.2 is complaining
about it and unablue to compile. I commented about 50 options and its
displaying them successfully. Is there any limit for the number of
options.
I must have 350 options in <html:select>
Any suggestions, code help is greatly appreciated.

<%@ include file="/include/struts.jsp"%>

<bean:parameter id="propertyName" name="propertyName"/>

<html:select property="<%=propertyName%>" >

1 <html:eek:ption value="AIMX">AIMX</html:eek:ption>
2 <html:eek:ption value="XALB">ALBERTA SE</html:eek:ption>
3 <html:eek:ption value="XALG">ALGIERS SE</html:eek:ption>
...............................
.......................................
........................................
349 <html:eek:ption value="XZIM">ZIMBABWE SE</html:eek:ption>
350 <html:eek:ption value="ZOBX">ZOBEX</html:eek:ption>
</html:select>




Thank You in advance
 
M

Murray

Girish T Deshpande said:
Hi,

I have 350 options <html:select>, but the WebLogic 7.2 is complaining
about it and unablue to compile. I commented about 50 options and its
displaying them successfully. Is there any limit for the number of
options.
I must have 350 options in <html:select>

There's no limit on the number of options per se, and it has nothing to do
with Struts really. It is because the class file that is generated from the
jsp is too big (believe it or not there is a limit, which I think is
JVM-specific), or a method in the class is too big.

I'd probably do this:
<html:select property="<%=propertyName%>" >
<html:eek:ptions collection="countries" property="countryCode"
labelProperty="countryName"/>
</html:select>

where countries is a collection of beans representing a country (with
properties countryCode and countryName). Generate the list in the Action and
put it on the request. If the same list is going to be used in multiple
places, I'd consider making it a singleton/static list.

Another possible solution is to split the file and jsp:include the second
half into the first. But in your case I don't think it will help since just
the html:select block itself is probably big enough to cause a compilation
error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top