Skip to Content
0
Former Member
Dec 01, 2008 at 05:53 PM

setting value attribute under value node value throwing error

29 Views

Hi,

I created a value node(newrec with cardinality 0..n selection 0..1) with two value attributes under it as firstdt,secdt of type date. when i binded them to inputfileds and set the initial values to todays date its throwing java.lang.nullpointerexception.

Calendar cal = Calendar.getInstance();

java.sql.Date today= new java.sql.Date(System.currentTimeMillis());

wdContext.nodeNewrec().currentNewrecElement().setFirstdt(today);

wdContext.nodeNewrec().currentNewrecElement().setSecdt(today);

but if i directly create a value attributes firstdt of type date directly under context and bind it to inputfiled its displayiong correctly.

Calendar cal = Calendar.getInstance();

java.sql.Date today= new java.sql.Date(System.currentTimeMillis());

wdContext.currentContextElement().setFirstdt(today);

Why is this difference, how to set the initial value of inputfield to today with an attribute created under node.

Thanks.