• 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

Save data from JSP text box to database

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really Thanks a lot....yr coding very good....
 
Mag Yeoh
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic