Well, the NPE is due to the fact that you are setting declaring dt_oid as an
Integer(which can be null) but in the method listdomain is an int. The JVM
automatically tries to convert Integer to int, but if it's null, it will
throw a NPE, since an int can not be null. That's the first thing you should
look at. Also, who and when is setting dt_oid? Because there is no such
field in the jsp, so it will always be empty. And you will always get that
exception.

Second, if you want to fill the domaintype in the bean, as the rest of
fields, you will need to rename the select to listbean.domainType, as the
rest of fields in the form. Otherwise it will not be loaded in the bean.
Also, you should revise the logic used to create the ids in the DAO. As it
stands, the objectid will always be 1.

Third, IMO your code is hard to read. If you create an object of class
DomainBean, do not call it listbean, because everybody that reads it will be
puzzle why something that is not a list is called list.




2011/3/16 JavaNoobie87 <vivek...@enzentech.com>

>
> JOSE L MARTINEZ-AVIAL wrote:
> >
> > Struts does not know that yo want to should map that domainType to your
> > bean. It wil try to map the parameters received from the request to the
> > action. So for each parameter it founds in the request received from the
> > user, it is gonna look in the action for a set.
> >
> > If I remember correctly, if the parameter name has a dot, it will
> > understand
> > that is a setter in an bean, so if you put a parameter name called
> > "myBean.myValue", it will try to look for a setMyBean, which receives an
> > object that has a setMyValue, and it will try to instantiate the bean and
> > do
> > both sets. But that's not the case in your jsp, since the parameter name
> > is
> > just domainType.
> >
> > But I'm still missing something. From your code I suppouse you want to
> > show
> > the user a list of domains, then he selects one, and then your
> application
> > load the data, and return to the user with the same jsp, where he can
> > change
> > some values, and press save, who will send the form to the server, and
> > save
> > it in the database, is that right?
> >
> >
> Are you saying that  I should try to use "listbean.domainType" instead of
> just domainType?
> Also your description of my project is almost exact. I intend to show the
> user a list of domains from which he may select one, my application will
> load the data corresponding to that domain from another table , containing
> all records of that particular domain(hence the iterator tag ). I also
> intend to be able to edit ,update and save the individual records in a
> domain .Thanks for replying
>
>
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/loading-Dropdown-dynamically-from-database-tp3555885p3760331.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to