Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting rid of "value" attribute in f:selectItems?

bland999Nov 3 2010 — edited Nov 8 2010
Hello,

There is a simple problem I am facing at work that is actually hurting us significantly... we have a JSF 1.1 (yes, it's very old!) situation where we need to present a page that has a very long dropdown list, more than 5000 options in it. The problem is that the options are very long, and the entire page ends up being over 600Kb in the browser, and worse than that the application server gobbles up massive amounts of RAM just to generate the page.

One optimization we want to do is to take advantage of the following fact: all of the options have values that match the labels. In other words, our options look like this:

<option value="longString1">longString1</option>
<option value="longString2">longString2</option>
<option value="longString3">longString3</option>

We'd like to reduce the page by 50% with a simple optimization: suppress the value attributes like the following:


<option>longString1</option>
<option>longString2</option>
<option>longString3</option>

We are generating these options in an ArrayList of SelectItems, and using an f:selectItems to generate the HTML... but we have NOT figured out how to suppress the value attributes. Try as we might, we are unable to remove them... Is there any way to get:

<f:selectItems ...>

to just display the labels???

Or is there another approach we should use??

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2010
Added on Nov 3 2010
6 comments
215 views