• Post Reply Bookmark Topic Watch Topic
  • New Topic

setAttribute(String, Object) in the type HttpSession is not applicable

 
prashan dassanayake
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the error i got.i understand my error but i don't know how to solve it.So please help me to solve this problem.
exception

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

An error occurred at line: 194 in the jsp file: /pages/common/welcome.jsp
Generated servlet error:
The method setAttribute(String, Object) in the type HttpSession is not applicable for the arguments (String, boolean)

An error occurred at line: 51 in the jsp file: /pages/common/../common/navbar.jsp
Generated servlet error:
The method setAttribute(String, Object) in the type HttpSession is not applicable for the arguments (String, boolean)


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


root cause

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

An error occurred at line: 194 in the jsp file: /pages/common/welcome.jsp
Generated servlet error:
The method setAttribute(String, Object) in the type HttpSession is not applicable for the arguments (String, boolean)

An error occurred at line: 51 in the jsp file: /pages/common/../common/navbar.jsp
Generated servlet error:
The method setAttribute(String, Object) in the type HttpSession is not applicable for the arguments (String, boolean)


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

[ November 10, 2008: Message edited by: prashan dassanayake ]
[ November 10, 2008: Message edited by: Bear Bibeault ]
 
Vijitha Kumara
Bartender
Posts: 3953
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method setAttribute(String, Object) in the type HttpSession is not applicable for the arguments (String, boolean)


Isn't this says it all? You are sending the wrong arguments? If you can post the code then people can see what's wrong.
 
prashan dassanayake
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the relavant jsp code.i understand the error .but i dont know how to solve it.
<tr>
<% request.getSession().setAttribute("viewMenu",false); >
<td><%@ include file = "../common/navbar.jsp" %></td>
</tr>
please tel me how to solve this.
 
Dilip Mallik
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

try using <% session.setAttribute("string",Boolean Object); %>
as a session variable is implicitly available to a jsp
[ November 11, 2008: Message edited by: Dilip Mallik ]
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are passing a primitive type to the setAttribute method. Use a Boolean type like Boolean.FALSE instead.
 
prashan dassanayake
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. but what can be the code that i can use instead of it doing the same work expecting?.Thanks for all Replying and continue replying please1
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by prashan dassanayake:
yes. but what can be the code that i can use instead of it doing the same work expecting?.Thanks for all Replying and continue replying please1


Already mentioned above, use the Boolean wrapper class.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by prashan dassanayake:
but what can be the code that i can use instead of it doing the same work expecting?


then you need to change your JDK to JDK5.0 or higher version.
[ November 11, 2008: Message edited by: seetharaman venkatasamy ]
 
prashan dassanayake
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for all for replying to solve my probs!
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Posting the code along with the error will help people understand the problem fast and makes the solving process easier.
Don't mind but this is what i do when i ask questions....

Have a nice time.


 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this case, the code is not necessary.
We can see in the stack trace that the problem is caused by an attempt to bind a primitive (boolean) to session scope.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!