hi, i have a html ptions which is using catValues collection. This collection is loaded with all the categories. The following is the code <html:select property="contextCode"> <html ptions collection="catValues" property="categoryCode" labelProperty="categoryName" /> </html:select> i wanted to set the index of the select box to the second element is there a way to do it in the html options box Thanks
alan do
Ranch Hand
Joined: Apr 14, 2005
Posts: 354
posted
0
there are a couple of ways you can do this...
1. break the <htmlptions> into iterations of <htmlption>. track the indexId (with logic:equal or c:if) and generate the <htmlption> with selected="true" attribute
2. if your collection is generated from the action, do form.set("contextCode", secondOptionValue); inside the action before forwarding it to the page.
-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Rashid Darvesh
Ranch Hand
Joined: Feb 13, 2004
Posts: 189
posted
0
Thanks but the problem is that the page is first time initialized. so i have the collection in the session variable and it is used to populate the html ptions tag. So the page is loaded for the first time and it does not go to the action class. i think the first method is fine. Could you please eloborate how i expand the html ptions tag. Thanks
alan do
Ranch Hand
Joined: Apr 14, 2005
Posts: 354
posted
0
is the second value in the dropdown always a known value? if so, you can initialize your form-property (using the initial="xxx" attribute) to that value. if you can't do this, i'll explain the <html ption>.
Rashid Darvesh
Ranch Hand
Joined: Feb 13, 2004
Posts: 189
posted
0
Thanks Alan its works now. i just set the initial property in my dynaaction form declaration in the struts-config.xml file
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.