• 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

Doubt on scriptlet and c:set

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

This is the JSP code:

In the above code with out doing anything the variable set by the <c:set> tag is displayed in the browser if i just type in this URL http://localhost:8080/MovieProject/index.jsp. why this is happening? I did not attempt anything to print that variable set by the <c:set> but it is displayed in the browser..If the variable set by the <c:set > is displayed why not variable set by the scriptlet is not displayed?

This is just a simple project there is no TLD file, Tag handler class..
Only just index.jsp..

Thanks & Regards,
Sudhakar Karnati
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well i think you have mistyped your index.jsp.

1)hope you have imported java.util.* before using List and ArrayList
2)in the scriptlet you declare a List variable named movieList, but add the items to some undefined variable named clist.
3)well when i ran it after the above two corrections, nothing was printed as intended.
please check your code.
 
sudhakar karnati
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1)hope you have imported java.util.* before using List and ArrayList
2)in the scriptlet you declare a List variable named movieList, but add the items to some undefined variable named clist.



I have made the changes and my JSP file looks like this:




Still it is displaying output as Titanic1,poseidon1,TROY1, whatever(including special characters) i type in the body of <c:set> that is displayed on the browser like plaintext

Thanks & Regards,
Sudhakar Karnati
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i got your problem now,

use the taglib directive
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
and be sure you have included the jar files containing the standard JSTL libraries

You know these kinds of errors are easily caught by IDE's. So when you go for a job on Java , do use some IDE (Eclipse Europa and NetBeans 6 are quite cool!!)
[ April 21, 2008: Message edited by: Ash More' ]
 
sudhakar karnati
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have added the library JSTL1.1/1.2 support to libraries and now it is working fine..

Thanks Ash More'
 
reply
    Bookmark Topic Watch Topic
  • New Topic