Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save data from JSP text box to database

 
Mag Yeoh
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi....i'm very new in JSP and Java...but now i handle a project that need to use this 2 Language....

the problem is that i need add the data that i keyin in the webapplication text box to my database....all the process i need to do in java...

in my webapplication only got 2 text box...one is Country Name and another one is Country Population....i want to save this 2 field to my database after i key in a value/data...

can any one who know this help me...really appreciate yr knowledge....Thanks..
 
Natasza Biecek
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
also hello to all, it's my first post here...

You need two things to do that:
1. a html/jsp page to allow user to input data
2. a servlet to process incoming data

So, let's write dataInputPage.jsp


It is a very simple form having two edit-boxes named
'form_country_name' and 'form_country_population'.
This form posts user input to 'dataProcessingServlet' which
will be our backend...

Now, dataProcessingServlet.java


Servlet performes basic validation of incoming data
and when something is wrong - shows list of problems...
When input data looks more-or-less good it establishes connection
to database and tries to insert data.

Please, treat all of this as a kind of draft, many things
should be done better...

regards,
Natasza
[ October 26, 2006: Message edited by: Natasza Biecek ]
 
Mag Yeoh
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Natasza....this is my first time write a project using JSP...

oh...i forget to tell that, they dont want me to use servlet in my java file...need to use useBean/java....it is possible to do that???

Problem...
1. dont want use servlet in my java file
2. they need me to use "useBean"? It is possible to do that?
3. i using db4o database....i not using mySQL....
 
Mag Yeoh
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really Thanks a lot....yr coding very good....
 
Mag Yeoh
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Natasza ....

when i run your coding i having this error....i using eclipse to run jsp and java....

error is ....below is the error i get when i run your coding...i scare that i having a setting problem....you know what happen to this error..it is my setting problem.....
type Status report

message /SampleProject/Forum/SimpleExample.dataProcessingServlet

description The requested resource (/SampleProject/Forum/SimpleExample.dataProcessingServlet) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.17
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mag Yeoh, all you need is a good tutorial or a book for JSP/Servlet beginners.
 
Mag Yeoh
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok. Thanks your very much....Thanks for you help....i use your way idea to run in another way....

Haha....i copy right your idea....

anyway, thanks.....

Cheers....
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic