• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing Bean  RSS feed

 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
My .jsp file is unable to access the bean, as its located in other directory, following is the directory structure
servlets & bean in "/WEB-INF/classes/"
jsp in "/jsp" directory
how can I make my jsp to access the bean located in other directory.
tia
MB
 
Calina Cazangiu
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to import the bean class in a page directive.
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In bean file

but still jsp is unable to access the bean
do I need to make any changes to web.xml ??
hope I m clear..
MB
[ June 13, 2003: Message edited by: Malhar Barai ]
 
Calina Cazangiu
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add:
<%@ page import="com.stylejunior.style" %>
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Calina Cazangiu:
add:
<%@ page import="com.stylejunior.style" %>

nope dear, still unable to find the bean, this is the error generated

MB
 
Calina Cazangiu
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I don't see the name of your bean class anywhere
- assuming com.juniorstyle.style is your package, and style is not the bean name
(I would expect it to be uppercase anyway).
If "style" is the bean name, you need to declare the package as com.juniorstyle and have it in the
WEB-INF/classes/com/juniorstyle.
You can test your bean class by adding a main method to it.
[ June 14, 2003: Message edited by: Calina Cazangiu ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!