• 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

How to run simple JSTL page?

 
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I am having a JSTL test page as below

easy.jsp


At the first run I got an exception for URI Path. So I added jstl.jar and standard.jar file in the lib dir of this web-app. And here is the result

Output

JSP is as easy as....
1+2+3=${1+2+3}

But the output should be

JSP is as easy as....
1+2+3=6

Have I missed something inspite of adding the above said jar files. Do I have to add the tld and where.


Regards,
Arpit
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Arpit Gadle wrote:At the first run I got an exception for URI Path. So I added jstl.jar and standard.jar file in the lib dir of this web-app. And here is the result
Output
JSP is as easy as....
1+2+3=${1+2+3}

But the output should be

JSP is as easy as....
1+2+3=6
Have I missed something inspite of adding the above said jar files. Do I have to add the tld and where.


Looks like you have EL disabled for your JSP. What is the container you are using ? Are you have anything to do with EL in the web.xml in the application ?
 
Arpit Gadle
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Apache Tomcat 6 and there is nothing in web.xml related to EL.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Arpit Gadle wrote:I am using Apache Tomcat 6 and there is nothing in web.xml related to EL.


What is the version of your web.xml (inside <web-app>) ?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This should help: http://faq.javaranch.com/java/ElOrJstlNotWorkingAsExpected
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf, There's a small typo ( "Servlers 2.3 DOCTYPE" ) in it.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

There's a small typo ( "Servlers 2.3 DOCTYPE" ) in it.


It's a wiki - go ahead and fix it :-) Username/password are the same as for the Saloon.
 
Arpit Gadle
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,
I am using Tomcat 6.0(Servlet 2.5 and JSP 2.1) and JSTl 1.2

Here is the source code and the webx.xml

easy.jsp


web.xml



And edited the web.xml as mentioned in "El Or Jstl Not Working As Expected"

Then also i am getting the same outut as

JSP is as easy as....
1+2+3=${1+2+3}

bye
Arpit

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Place the EL expression outside of the <c:out> tag to make sure that the EL is working properly. If not, then that's the issue that must be addressed before worrying about the JSTL.
 
Arpit Gadle
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bibeault,
Now Its working. Could you suggest me any book for JSTL.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't need a book, just the JSTL Specification.

So you say that the EL works outside of the <c:out> tag? If so, your web app is correctly configured.

OK, now put the <c:out> tag back in and see what's being sent to the browser with a View Source. If the <c:out> tag is still there, that means that the JSTL is not being evaluated.
 
Arpit Gadle
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the latest update.

As I am using Tomcat 6(Servlet 2.5 and JSP 2.1) and I had revert back all the changes

easy.jsp


web.xml


And added this directive as mentioned by Avi Sinha in some other post



Now everything is working fine

Thanks for your reply.


 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you'd rather use a band-aid and some bubble gum to hold your web app together than to get it working and configured correctly?
 
Arpit Gadle
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bibeault,
I understood what you want to say. From now onwards, I will configure my all web-apps correctly instead of trying bubble gum and band-aids to make things working. Is correct configuration for web-app available in JSTL 1.2 Specification? Where I can find it?

Thanks once again for your adivce,

Arpit
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no configuration. Once the EL is working -- you said it was working, correct? -- using the EL is as easy as dropping the jar file into WEB-INF/lib.

That's it.

You haven't answered the questions that I posed earlier yet...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is correct configuration for web-app available in JSTL 1.2 Specification? Where I can find it?


Perhaps you missed my first post?
 
Screaming fools! It's nothing more than a 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