Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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'
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!