Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple examples of JSP

 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all


can anyone help me
on to where i can get some simple
examples in JSP for practice as i am a beginner
which things i must practice in order to
move towards creating a gud web page.
Thanks in advance.

Dhwani:>Its always too soon to quit.
 
Nalini Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For designing a good web page you need good knowledge on HTML,JSP is for handling dynamic requests and responses as simple static HTML cannot do,

Do excercise on basic tags how to include java code etc..

I hope you understand
:thumb:
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be better if you go through some good book like 'Head First servlets & JSP'
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi thr

thanks Nalini and Pranav for your kind help

but now i am in one more doubt if anyone can help

me on it i have created a html web page in
dreamweaver now on the
form action event i need to call a jsp
in order to pass data from html form
to jsp for furthur processing


so i am confused now to where i must write
my code for jsp in dreamweaver?



below shown is my code if anyone can help




any help on the above will
be realy
great thanks in advance

Dhwani:>Its always too soon to quit.
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!!!

i am happy to inform that i have
created a JSP but now


i am in a different
doubt i am veryfying my abc.jsp using
web browser option it shows a window saying
write name of your site now what i must
write here ?or it gives other option below saying
create FTP server etc...


i am working in LAN
ie i am working on client machine so will
i proceed now please if anyone can help

it will be realy great thanks in advance

Dhwani:>Its always too soon to quit.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, partner.

Here's a simple example where you send 2 parameters to a JSP page.
This first page can be pure HTML (you can call it form.html):



Note that on the action attribute of the form tag, we're specifying a page called result.jsp. This is the page that will receive these parameters, and in this case it has to be in the same directory of the form.html page. Here's the code of the result.jsp page:



Now, just check the form.html page, hit the Submit button and your form will be submitted. A tip for you: take a look at some JavaScript samples too... learn the main HTML tags and their attributes... learn as much as you can about Java and good OO design... then, read the Head First! Servlets and JSP book, and you'll find a lot of nice things! You'll learn that a JSP page is not the place to put Java code boy, there are so many things to learn!

Well, I hope this helps.
Take care, partner.
[ December 28, 2007: Message edited by: Roberto Perillo ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Roberto Perillo:
You'll learn that a JSP page is not the place to put Java code

Robert is quite correct.

Since you are just starting out, developing good coding habits at the start is always a good idea. JSPs should not be used for processing data, but to create the display. As such, your action should submit to a servlet (rather than a JSP) to perform the data processing. When the servlet is finished with its job, it can forward to a JSP to show the results.

There are some articles that might be helpful to you at this point. Please take a look at this article and this article.
[ December 28, 2007: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic