struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Dessertine <yvesd.pub...@gmail.com>
Subject Problem with <html:select> default value
Date Wed, 04 Mar 2009 16:39:06 GMT
Hello,

I'm having a problem with <html:select> from the struts taglib. The
default option is only selected in the first example (but all 3 lists
are created well in jsp page). I googled a lot, but could't find
similar problem.

My JSP page contains 3 selects:

==============================================================
1) Default value selected:

	<html:select name="afficheStockIAD" property="extractIntegrator">
		<html:options name="afficheStockIAD" property="listIntegratorNames" />
	</html:select>

Generated output:
	<select name="extractIntegrator"><option value="INT1">INT1</option>
	<option value="INT2" selected="selected">INT2</option></select>



==============================================================
2) Default value not selected:

	<html:select name="afficheStockIAD" property="extractYear">
		<option value="<bean:write name="afficheStockIAD"
property="uberPreviousYear" />"><bean:write name="afficheStockIAD"
property="uberPreviousYear" /></option>
		<option value="<bean:write name="afficheStockIAD"
property="previousYear" />"><bean:write name="afficheStockIAD"
property="previousYear" /></option>
		<option value="<bean:write name="afficheStockIAD"
property="currentYear" />"><bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="<bean:write name="afficheStockIAD"
property="nextYear" />"><bean:write name="afficheStockIAD"
property="nextYear" /></option>
		<option value="<bean:write name="afficheStockIAD"
property="uberNextYear" />"><bean:write name="afficheStockIAD"
property="uberNextYear" /></option>
	</html:select>


Generated output:
	<select name="extractYear"><option value="2007">2007</option>
		<option value="2008">2008</option>
		<option value="2009">2009</option>
		<option value="2010">2010</option>
		<option value="2011">2011</option></select>

==============================================================
3) Default value not selected:
	<html:select name="afficheStockIAD" property="extractMonth">
		<option value="1">Janvier <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="2">Février <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="3">Mars <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="4">Avril <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="5">Mai <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="6">Juin <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="7">Juillet <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="8">Août <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="9">Septembre <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="10">Octobre <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="11">Novembre <bean:write name="afficheStockIAD"
property="currentYear" /></option>
		<option value="12">Décembre <bean:write name="afficheStockIAD"
property="currentYear" /></option>
	</html:select>

Generated output:
	<select name="extractMonth"><option value="1">Janvier 2009</option>
		<option value="2">Février 2009</option>
		<option value="3">Mars 2009</option>
		<option value="4">Avril 2009</option>
		<option value="5">Mai 2009</option>
		<option value="6">Juin 2009</option>
		<option value="7">Juillet 2009</option>
		<option value="8">Août 2009</option>
		<option value="9">Septembre 2009</option>
		<option value="10">Octobre 2009</option>
		<option value="11">Novembre 2009</option>
		<option value="12">Décembre 2009</option></select>




The afficheStockIAD.extractIntegrator, afficheStockIAD.extractYear and
afficheStockIAD.extractMonth are filled, and get transfered with the
formbean.

Formbean like this :
	private String extractYear;
	private String extractIntegrator;
	private String extractMonth;
	
	public String getExtractYear() {
		return extractYear;
	}

	public void setExtractYear(String extractYear) {
		this.extractYear = extractYear;
	}

	public String getExtractIntegrator() {
		return extractIntegrator;
	}

	public void setExtractIntegrator(String extractIntegrator) {
		this.extractIntegrator = extractIntegrator;
	}

	public String getExtractMonth() {
		return extractMonth;
	}

	public void setExtractMonth(String extractMonth) {
		this.extractMonth = extractMonth;
	}


Help, if any ideas.


Regards,


Yves

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message