Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Can't use pageContext.setAttribute in Scriptlet by Intellij  RSS feed

 
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.




 
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:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!