This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes best practices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "best practices" Watch "best practices" New topic
Author

best practices

shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
Hi,
I am designing a web-interface for a research project. Basically this interface would allow users to access some services through the net. When I started to design, I had all these technologies like servlets, JSP, JSF, frameworks like Struts etc, MVC pattern.
I decided to use servlets,Javascript, xml+xsl. Since I have zero knowledge abt JSP, I decided not to use it and also Struts. I designed something similar to what struts do, i have a single servlet which intercepts all request and delegates to the appropriate business logic module. And then this module generates an XML which I transform using an XSL and output to the client.
Now my application has also forms(only few of them for user registration and stuff). I have seen struts handle forms elegantly, but I think i dont have to learn and use struts just for a few forms that I have. Right now, I have these forms in HTML format,I perform all validations using javascript at the client side and I access the form elements in my server-side code and perform database operations.
Everything is fine, but eventually I see that my code is getting cluttered with lots of request.getParameter() and hardcoded database queries which I would like to avoid.
Could anyone let me know of any best pratices for handling forms with technologies I am using. I wanna keep it simple cos I have only a few forms and would like to design something clean for these forms.
Nauman Khan
Ranch Hand

Joined: Aug 07, 2003
Posts: 49
My advise is to you to use Properties object and define all parameters which you don't want to hardcoded in your application in properties files which can easily retrieve by properties oject which is defined in java.util library.
Regards,


Nauman Khan <br />SCJP,MCSE,SCWCD,SCBCD,SCWCD1.4
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
Originally posted by Nauman Khan:
My advise is to you to use Properties object and define all parameters which you don't want to hardcoded in your application in properties files which can easily retrieve by properties oject which is defined in java.util library.
Regards,

thank you for your inputs.
I am doing it this way now. I have a bean for every form that takes care of getting data from the user form and also the database operations. In this way I could move much of my code to the bean and keep my business module code clean.
Shankar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best practices