| Author |
Problem with Simple JSP page
|
Raman Ghai
Ranch Hand
Joined: Jan 01, 2012
Posts: 51
|
|
Hello,
I have just started with JSP today and created the first JSP page.
However , it is not providing the output as expected . Here's the source code
Please help me find the errors ..
Any other resources /information regarding JSP will be appreciated. thanks
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1188
|
|
|
First of all stop writing java code inside jsp, its a very old practice.
|
Swastik
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
Swastik Dey is correct. If you are just starting out on JSP, it's important to use modern techniques and develop good habits right at the start.
The use of Java code in scriptlets in a JSP has been discredited since 2002 (10 years ago! ) and is no longer acceptable. You should find a tutorial or other learning materials that emphasize the JSTL (JSP Standard Tag Library) and the EL (Expression Language).
I also recommend that JSP novices read the following articles: The Secret Life of JSPsThe Front Man
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Raman Ghai
Ranch Hand
Joined: Jan 01, 2012
Posts: 51
|
|
|
ok..I understand that use of java code inside JSP has been deprecated ..I will take care in future ..Thanks for replying.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
So why not try posting your example code using modern JSTL and EL?
And, after you used the JSTL and EL, does the page still exhibit the same problems that you are trying to solve?
(I also recommend learning how to format and indent HTML properly.)
|
 |
Raman Ghai
Ranch Hand
Joined: Jan 01, 2012
Posts: 51
|
|
I have no idea about JSTL and EL . Actually, I am a beginner on web technologies. So , it will take some time to get familiar with all this stuff.
As far as HTML indenting is concerned , I will learn that too. Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
What tutorial are you using that led you up to the point that you were able to write the code of your initial post? If it does not talk about JSTL and EL, then it is either very old and antiquated, or just a bad one.
Any (good) modern tutorial on JSP will cover JSTL and EL.
|
 |
dineshiop kumar
Greenhorn
Joined: Mar 05, 2009
Posts: 13
|
|
|
i would like to recommend Head First JSP and learn it is easy way of learning jsp and effective
|
 |
Raman Ghai
Ranch Hand
Joined: Jan 01, 2012
Posts: 51
|
|
Bear Bibeault wrote:What tutorial are you using that led you up to the point that you were able to write the code of your initial post? If it does not talk about JSTL and EL, then it is either very old and antiquated, or just a bad one.
Any (good) modern tutorial on JSP will cover JSTL and EL.
I read that code from an e-book on Java Servlets(don't remember the name). It has not mentioned a thing about JSTL or EL in the beginning . Do you know any good books/e-books to start with ?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
The JavaRanch Bunkhouse is a great place to start to find books on such subjects. There you will find not only lists of books on various Java and web-related subjects, but expert reviews of these books. Take a look!
Be aware that even modern books on JSP are likely to cover scriptlets -- knowledge of them may be needed to work on legacy web apps. But scriptlets should never be used in new pages.
|
 |
Arun Giridharan
Ranch Hand
Joined: Sep 30, 2010
Posts: 290
|
|
|
Bear is right as always !! EL and JSTL is indeed FUN ! and used alot.
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1002
|
|
Ignoring the scriptlet side of things, I can't see anything else wrong with the example as is.
No errors. What was the problem with it?
Rewriting as JSTL is fairly simple though:
|
 |
Raman Ghai
Ranch Hand
Joined: Jan 01, 2012
Posts: 51
|
|
|
Now the same code worked right on retrying using Netbeans IDE. Atleast I got to learn about some things ..Thanks guys for replying
|
 |
 |
|
|
subject: Problem with Simple JSP page
|
|
|