• 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

Simple jsp form

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,

I am newbie to jsp I have created the following form with bean

index.jsp



Person.java



I have the following questions

1) is my above way to put the form and the processing in a single page is a right way or i have to make separation for that or there is another better way to do that ?
2) how to show the errors if there are some empty submitted fields and I want to tell the user to fill them ?
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is generally accepted that you submit a request to a servlet for java code handling, and use JSPs only for rendering the view (MVC)

I would actually recommend using a web framework which has supporting code that does the heavy lifting for things such as:
- mapping/converting parameters to beans
- validation of the bean and redisplay of the page(with errors) if necessary
- encourages you to use an MVC approach

Common examples are Struts, Stripes, JSF.
Personally I prefer Stripes right now, but there are a bunch of other out there I don't know about.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic