You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohan Radhakrishnan <Mo...@hclcomnet.co.in> on 2003/03/07 13:27:20 UTC

html:text property problem

Hi,

      I am trying to use the following

<bean:define id="startdate" name="form" property='<%= "date[" + 0 + "]"
%>'/>

to set the property in a html:text box. The property is of type String[]. So
I am using the above indexed property access method.

<html:text property="date" value="<%=date.toString()%>"></html:text>

I have also put the following check in my form.

    public String getStartDateIndexed( int index ) {
		if( startDate_ == null ){
			startDate_ = new String[]{ new
DateUtility().getCurrentDate() };
		}
	return startDate_[ index ];
    }

along with pre-population of the html:text boxes. Inspite of all this
sometimes the following exception is thrown.

  Anybody see any chinks in the armour above. What more error checks does it
need ? Is it the right way with Struts 1.0 ?

java.lang.NullPointerException
	at
org.apache.struts.util.PropertyUtils.getIndexedProperty(PropertyUtils.java:3
72)
	at
org.apache.struts.util.PropertyUtils.getIndexedProperty(PropertyUtils.java:3
14)
	at
org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.java:42
4)
	at
org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:453)
	at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:503)
	at
org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:200)
	at
org.apache.jsp.visibleleftpanel_jsp._jspService(visibleleftpanel_jsp.java:21
7)

Thanks
Mohan

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