I'm so happy! Since yesterday, I've been asking God to enlighten me in initializing default values for the <@s.select> tag, whether multiple or not. Just now, I was able to give the roles default values whenever I edit the user. What I did was I have a List<Integer>, that is the container of the existing roleIds of the user, and put it to the value attribute of the select tag. It's quite simple, only that I've been experimenting with the wrong attributes. Many forums claim it's the property attribute, though it might have been right, there was no right example showing how it should be done. With the value attribute, I kind of experimented on it a bit and thank God, I was able to make it right.
*****
I was able to transfer the role identification to the User model. I added the isAdmin function in the User model, as how sir Butch suggested. And now, the loginAction is really much cleaner.
*****
I added 2 kinds of Login Interceptors: the one that simply assures that the user session is not null, and the other one that assures that the user session has an admin role. Jo mentioned (Anna said) Spring security. I wasn't able to experiment with this feature though.
*****
Another component is to be added: Exception. Just where should I put it? I have two kinds of exceptions, the one that we made to prevent duplicate values, and the Validation exception, the one Tina did. The validation exceptions weren't caught yet and I'm still finding the right spot for it. Also, the validation mechanism Tina implemented wasn't quite that easy to comprehend. I think it's not implemented as the usual interceptor. It doesn't have an interceptor reference, simply it has a mapping mechanism in the web.xml: patterns com.orangeandbronze.service.* so I think it maps itself automatically. Catching the exception is also another thing. Uhh, can you wait 'til I understand it (the validation impl)?
*****
Refactoring the bloodiest of them all: Book! I'm having a hard time right now understanding the literally messy code. What was I thinking that time? I couldn't effectively add the author – book mapping til I refactor this completely. Right now, I just migrated some unnecessary functions from the action to the service.
