I have a Java web services deployed on Glassfish server using Netbeans. Service fetches data from database and populates DefaultListModel customers.
DefaultListModel customers is returned to program and used to populate JList however I get error bellow. The name of the web service main package is bank. Can I actually return DefaultListModel from web service and is there any way to repair this error.
incompatible types
found : bank.DefaultListModel
required: javax.swing.DefaultListModel
You have two different classes that happen to have the same short name. That doesn’t make them interchangeable.
Your service layer should not depend on the technology you have chosen for the GUI layer. A DefaultListModel won’t be very useful when you’ll switch to a webapp to display the result of the service. Make it return a
List<Customer>.DefaultListModelis nothing more than a wrapper around a list anyway.