Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

[MVC] If there is only a form ...

Thread view: 
littlebeam - 24 Oct 2006 16:29 GMT
If there is only a form for user to input data, how can I implement it
by MVC?

Currently, I achieve it by:
1) View: there is a jsp for user to input data.
2) Controller: there is a servlet which is called by the form acton. It
is responsible for two tasks:
a) insert data to database ( the data is retrieved by
request.getParameter(). Is it better to achive it by using java beam?
b) if the insertion is successful, the servlet will forward to a
thankyou page, otherwise it will forward to a error page.
3) Model: ?? here, I don't know whether I shoud use java beam...
Manish Pandit - 24 Oct 2006 19:37 GMT
Model is something that has the 'system state', which in your case is
the database that gets changed.

request.getParameter() is fine but this will not work if the form is
multipart (contains files). Also, make sure the form submits via a Post
since it is changing the model. You can use a formbean (like a javabean
but tightly coupled with the form) if you are using a framework like
Struts.

-cheers,
Manish


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.