Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on scriptlet and c:set

 
sudhakar karnati
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • 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
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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'
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic