And I am chiseling away at this project. Coded the registration form in true MVC fashion. As I said to Olivia today, they don’t call it software engineering for nothing. I had to really plan this out properly and code the components with lots of reuse in mind. It’s paying off, slowly.
So anyway, I can see why my brother’s developers shy away from doing extensive error checking on their forms. It’s a pain in the ass. But a necessary one, I think. I really wish something like XForms were widely adopted so that us poor web developers could enforce constraints easily at the client level. I would do it with JavaScript except I really fucking hate JavaScript. It’s slow, clunky, and almost always makes your page look-n-feel unprofessional.
So, I said, fuck it, might as well take some OOP features of Java and code some reusable error handling for forms. I came up with a nice idea of using a HashMap that stores keys of the form element identifiers and passing that object to the JSP page through the RequestDispatcher/Session. Once my JSP page has it, it checks if there are errors, and if there are, it outputs the error message and also marks off asterisks next to invalid form elements.
This is probably the kind of thing Struts/FormBeans handles for you easily, but I’m doing it from scratch. All in the name of knowledge, I guess. Is the time I’m spending on this from scratch > the time it would take to learn the Struts framework/deal with the issues arising from the Struts framework? Who knows. But at least I’m learning more, so I guess that’s why it wins out.
Argh, I need sleep. I’m so pathetic. I disabled Workrave, and so I haven’t taken ANY breaks in the last 2 hours.