Randall Twede wrote:in other word write a line like this
ProductDetailsDTO productDetailsDTO = new ProductDetailsDTO();
for ProductDetailsService
Well, sort of. I don't know the specifics of
Struts, but typically service implementations are instantiated once, externally to the classes that use them, and are passed into constructors or autowired or whatever. The Action class shouldn't know that it has an instance of ProductDetailsServiceImpl; only that it has an instance of some class that implements the ProductDetailsService interface. If we let the Action class instantiate the service then that instantiation would happen every time the user clicked that button (or whatever it was), and most likely we don't want that either.