Board index » jbuilder » recieving and sending variables to jsp

recieving and sending variables to jsp


2005-01-09 06:39:14 PM
jbuilder19
Hi I want to send and recieve a couple of variables to a JSP page. The page
will have a database connection and the applet would use the variables
stored in the database , and visa versa.
Is this possible, if so , how?
Thanks
Paul Iddon
 
 

Re:recieving and sending variables to jsp

Paul Iddon wrote:
Quote
Hi I want to send and recieve a couple of variables to a JSP page. The page
will have a database connection and the applet would use the variables
stored in the database , and visa versa.

Is this possible, if so , how?
First of all, what you are thinking of as the JSP page
is just plain HTML by the time your applet knows anything
about it ... if it knows anything at all (i.e., not all
browsers facilitate conversation between applet and
browser). Remember, a JSP is a server-side object.
Furthermore, it's just a glorified servlet, one which
starts its life as a mixture of HTML, tags, and if badly
written, Java code scriptlets. Once it is compiled, it's
just a servlet.
Given that, what you really should do is encapsulate
your database connection and database interaction in
Java classes in the *business* layer, not the view (JSP)
layer. Write a servlet with which the applet will
communicate via a UrlConnection (the Http variant, actually)
to get the data it needs.
Finally, don't write the communication part: download
the com.oreilly.servlet (I think that's its name) package
from Jason Hunter's Web site,
www.servlets.com
You might also want to consult Jason's book "Java Servlet
Programming" for exactly how to do what you want to do.
Browse the book at your local bookstore.
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.