• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JSP and JavaBeans Help

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a Jsp file . In that i used a javabean. I am using weblogic 8.1. This is the code
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<html>
<head>
<title> Global Auctions - view item, Holder Bean </title>
</head>
<boby>
<h1>View Item Holder Bean </h1>
<jsp:useBean id="item" class="Item" scope="session" >
<jsp:setProperty name="item" property="catId" value="3000" >
<jsp:setProperty name="item" property="desc" value="Mango" >
</jsp:useBean>
<table>
<tr><td>Item number : </td><td><%= item.getCatId() %></td></tr>
<tr><td>Item Desciption : </td><td><%= item.getDesc() %></td></tr>
</table>
</boby>
</html>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The above code giving an error
##############################################################
Compilation of 'C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java' failed:
--------------------------------------------------------------------------------
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:128: cannot resolve symbol
probably occurred due to an error in /item.jsp line 8:
<jsp:useBean id="item" class="Item" scope="session" >
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:129: cannot resolve symbol
probably occurred due to an error in /item.jsp line 8:
<jsp:useBean id="item" class="Item" scope="session" >
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:132: cannot resolve symbol
probably occurred due to an error in /item.jsp line 8:
<jsp:useBean id="item" class="Item" scope="session" >
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:134: cannot resolve symbol
probably occurred due to an error in /item.jsp line 8:
<jsp:useBean id="item" class="Item" scope="session" >

--------------------------------------------------------------------------------
Full compiler error(s):
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:128: cannot resolve symbol
symbol : class Item
location: class jsp_servlet.__item
Item item = null; //[ /item.jsp; Line: 8]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:129: cannot resolve symbol
symbol : class Item
location: class jsp_servlet.__item
item = (Item)session.getAttribute("item"); //[ /item.jsp; Line: 8]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:132: cannot resolve symbol
symbol : class Item
location: class jsp_servlet.__item
item = (Item)session.getAttribute("item"); //[ /item.jsp; Line: 8]
^
C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_myservletExp_dir_myservletExp\jsp_servlet\__item.java:134: cannot resolve symbol
symbol : class Item
location: class jsp_servlet.__item
item = new Item(); //[ /item.jsp; Line: 8]
^
4 errors
###########################################################

anyone can rectify the problem
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to add an import statement so the JSP can find your Item class.
And of course the Item class needs to be found in your WEB-INF/classes directory or in a jar-file located in WEB-INF/lib
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should also place your bean in a package other than the default. Most servlet containers have problems with classes in the default package.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic