Adam Ruggles wrote:
Based on your posts I get the idea you don't understand how the MVC pattern works. I'll try to describe what should be happening.

On the browser a user submits the data he/she wishes to update. That information is then passed to the action, I prefer to do this with an object. So in your action you would have a public void setAccount(Account account); method. On your form you would have fields with names like account.id, account.description, ...

I was looking to encapsulate all the behavior of the account in an account object. So the object updates its self.
Now for this example I'm going to use the default execute method. So in the public String execute() throws Exception {...} method your going to have an account object. Now if you want to update this account you pass it to your service layer which might have a method that looks like this. accountService.update(account);

Again, accountService is another class. So I have to split the attr form the behavior of each object in two classes. right?
Inside the account service you'll be talking to your DAOs. So you might have an update method in your DAO. accountDAO.update(account). Now since your using JDBC you have control of the sql statement. So one method of building the sql statement without having to load the account object from the database would be to check for nulls. So say I only wanted to update the description. Everything else is unchanged. So in my DAO update method I would check for non-null fields and add the ones that are not null to the sql statement. Then execute the statement.

That was my question. I have to go through all this coding and write all these extra classes to be able to update info. right ? And I have to change the bussiness logic (AccountService) to suit this design.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to