Java Web Application
I am interested in creating a simple web application that will take in user input, convert it to an XML file and send the file to a database.
Coding wise I feel I am okay, it is just the general setup and what implementation to use I am a bit unsure of.
At the moment I have a JSP
page containing a form, the user fills out the form and on submit
a POST method
is sent to a servlet
, in the servlet doPost()
method the servlet is instantiating a java object
and passing it the user inputted 开发者_如何学Godata. The java object then writes that data to an XML file
and sends it to the database via REST
.
All I would be interested to know is if this the standard/optimal way of creating such a web application.
Any and all feedback is appreciated.
Thanks
For a "simple webapplication" this high level approach looks fine in general. However, if you want more critical feedback, you'd need to give more details about the low-level approach. It may for example happen that it isn't memory efficient and thus may break when the webapp is been used by over 10 users concurrently, just to give an example.
I only question the choice for the GET
method. You'd normally only use it to retrieve data (SELECT
), not to create/alter data (INSERT/UPDATE/DELETE
). For that you'd normally use POST
, so that no one can execute it "accidently" by just clicking a (bookmarked) link. Changing GET
to POST
isn't that hard, add method="post"
to the <form>
element and rename doGet()
to doPost()
.
精彩评论