Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't use pageContext.setAttribute in Scriptlet by Intellij

 
pkinuk Buler
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I tired to set the arraylist object in the PageContext scope by using the ppageContext.setAttribute("list", list ) in a JSP file (the code is listing below), but the Intellij can't compile the code and highlight the method pageContext.setAttribute("list", list ) as "Can't resolve method 'setAttribute(java.lang.String, null)'". I also tried to copy the same jsp file to Eclipse and it worked. Would somebody please tell me how to solve this problem?

Thank you in advance.




 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the point of putting something in the page context in a JSP page? And, going a step further, are you aware that it's considered bad design to keep Java code in JSPs?
 
pkinuk Buler
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:What is the point of putting something in the page context in a JSP page? And, going a step further, are you aware that it's considered bad design to keep Java code in JSPs?


Thank you for yr reply.

i know that, but i just want to try to write the java code in jsp file. Because i'm a jsp beginner, i just wanted to write the code, which i don't know it's output into the IDE and want to see the result, for the SCWCD.

I've solved that problem by import the tomcat 6 libraries into the project, but now i met another problem. the browser said:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 20 in the jsp file: /WEB-INF/tags/ButtonLayout.tag
pageContext cannot be resolved
17: list.add("1");
18: list.add("2");
19: list.add("3");
20: pageContext.setAttribute("list", list);
21:
22: %>
23:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic