• Post Reply Bookmark Topic Watch Topic
  • New Topic

Beginning JSTL Hello World Example Error

 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have just started on JSTL, and searched for a simple example like Hello World.
I have apache-tomcat-4.1.37 setup in my Win XP system.
But I didnt find satsifactory examples to start, Those results i found were mostly deployed with respect to sun j2ee server,etc.
Somehow i started with the same example, but still get a error.
This is my source directory structure:-

---------Hello.java------------

---------utilitytags.tld---------

----------index.jsp-----------

---------web.xml-------------


but the error displayed is :-


Can anyone please specify what i am missing here...?

Any help are greatly appreciated....

Thanks in advance

Sree
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why Tomcat 4? That's ancient and runs JSP 1.2.

JSP 2.0 has been out for over 8 years -- why use 1.2?
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would just like to make sure that you really want to create custom tags. You don't need to create custom tags to use JSTL, and I wonder if perhaps you have the wrong impression.

If you really want to create tags, rather than use tags provided in the standard libraries, perhaps you can change your topic subject line to reflect this?
 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why Tomcat 4? That's ancient and runs JSP 1.2.

JSP 2.0 has been out for over 8 years -- why use 1.2?


Hi Bear Bibeault,

Thanks for replying,

I thought i will start with tomcat 4 and proceed thereafter with other versions, and then jboss,etc.

i havent worked much with jsp other than just usgin plain html tags in it, beans, and was trying to decrease much of the scriplet part,
that was when i read bout jstl, hence was trying for an example.

Also, (please correct me if i am wrong), isnt jsp2.0 just build up upon jsp 1.2, that means the core functionality of it has to be the same..right?
that is, a jsp page eventually gets compiled to a servlet class to execute itself...

Can you please suggest any good books or sites for referring....?

Awaiting your reply...

Thanks.
 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark E Hansen wrote:I would just like to make sure that you really want to create custom tags. You don't need to create custom tags to use JSTL, and I wonder if perhaps you have the wrong impression.

If you really want to create tags, rather than use tags provided in the standard libraries, perhaps you can change your topic subject line to reflect this?


Hi Mark,

Thanks for replying,

Its just that i had just started with jstl, and from what i had read, jstl helps in decreasing the coding part (in jsp i.e the scriplet code) and making the jsp more readable.
Also since this makes the designing too much simpler to do it part-by-part.
From what i had done earlier was only by using including java code with html tags, beans in the jsp before.
Also i was using the much older version of tomcat so that i could understand the very base functionality of what was going in background while execution
and planned to proceed further with the newer version so on.

Also it is first introduction with jstl and was trying to start with the 'hello world' example....

If this topic heading isnt right in the context, can you please suggest a better one...?

Thanks
Sree
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lucky Sree wrote:I thought i will start with tomcat 4 and proceed thereafter with other versions, and then jboss,etc.

That makes no sense whatsoever. It's like saying you are going to learn Java 1 and work your way up to Java 6.

Use the modern version now. Otherwise you are going to learn the wrong way of doing things -- habits that will be hard to unlearn.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't sound to me like you really want to create custom tags, so I think you're going in the wrong direction. JSTL stands for Java Standard Tag Library. This library contains tags to handle all the typical use cases. You can see the API for the 1.1 version of the tags here: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html (note: this is the 1.1 version because I wasn't able to find the API Javadoc for the 1.2 version, which is current. I was told there's not much of a difference).

A typical application would use a Servlets to manage the controller and model aspects of the application, then JSP pages to manage the view aspect (displaying information and gathering user input). The JSP page will basically be an HTML page with embedded tags (JSTL or other) and EL expressions.

Including Java code or any scriptlets in the JSP page is considered bad form these days, and should be avoided if possible.

As for books, I really liked the book JSTL in Action from Manning Publications. I recommend it highly.

Finally, I don't see the logic in starting with old versions of anything. Your goal should be to learn the use of the contemporary versions of each of the technologies. Working with old versions won't help this. I haven't even used Tomcat. My production environment is expected to be JBoss, so I started with JBoss. Which version? Well, the most recent I could get at the time, which was JBoss AS 5.1.0.GA.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Until you need something from JBoss, I'd recommend sticking to (a modern version of) Tomcat.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Until you need something from JBoss, I'd recommend sticking to (a modern version of) Tomcat.

Why do you say that? Do you think Tomcat is so much easier to learn, that it's worth learning two application servers? I haven't used Tomcat, so I'll take your word for it.
Personally, I found JBoss easy to get up and running, and there's a lot of help on the Ranch if needed.
Of course, it's not clear to me what the OP's real objectives are. If gaining experience with a list of application servers is desired, then working with each one will be very helpful. If the final objective is to work with JBoss, I say start with JBoss.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For learning servlets and JSP, JBoss is overkill and adds unnecessary complexity. Until EJB or some other advanced JEE capabilities are needed, Tomcat is a better choice.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:For learning servlets and JSP, JBoss is overkill and adds unnecessary complexity. Until EJB or some other advanced JEE capabilities are needed, Tomcat is a better choice.

I might agree if the goal is just to learn Servlets and JSP, and this may be the case for the OP so this disagreement may be of no practical value to him/her. However, if the goal is to create Servlet and JSP-based web applications deployed to the JBoss application server, I don't see any reason why JBoss shouldn't be used from the start. The additional (unnecessary) features are not even noticed. They just sit there, quietly waiting until they are needed. No effort is required at all to not use them.

Perhaps the OP can clarify the actual requirements?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not going to further hijack this topic with a JBoss vs. Tomcat debate. The OP nowhere mentioned "I want to learn JBoss now". If you would like to debate further, please start a new topic on the subject.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the record, Tomcat is a subset of JBoss.
JBoss uses Tomcat as it's Servlet/JSP Engine.

So, if it runs in Tomcat, it will run in Jboss.

Follow Bears advice, get a recent version of Tomcat and learn on that.
 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Lucky Sree wrote:I thought i will start with tomcat 4 and proceed thereafter with other versions, and then jboss,etc.

That makes no sense whatsoever. It's like saying you are going to learn Java 1 and work your way up to Java 6.

Use the modern version now. Otherwise you are going to learn the wrong way of doing things -- habits that will be hard to unlearn.


Hi again Bear Bibeault,

I get what you mean. The point i hadnt mentioned earlier is that i was developing with the api of tomcat 4.137 and deploying them not only in the same server
but trying the same example with tomcat 5.x (with 4.x and 5.x api) simultaneously and deploying them in it too..
If i may sound illogical, I just wanted to get the feel of the whole application server and also get clear picture of the stages of its development.
I feel this way i will get to understand both and tomcat's features.

Also I am going to try them with tomcat5.x hereafter..

Thanks,
Sree
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that you are using the correct version of the JSTL. It's different for JSP 1.2 and JSP 2.0. Very different.
 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Make sure that you are using the correct version of the JSTL. It's different for JSP 1.2 and JSP 2.0. Very different.


Yes,

Also the problem is solved, it was because of some silly mistakes i had done.
Like in the doctype of web.xml and tld i had done some case-mistakes.

Thanks to all of the replies i got.

Sree
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!