• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

best practices

 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic