Win a copy of Microservices Testing (Live Project) this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

use bean

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried an useBean example


-----------------------example.jsp----------------------------
This is an example jsp page !!

<%@ page import="foo"%>

<jsp:useBean id="ex1" class="foo.exampleBean" />
<jsp:getProperty name="ex1" property="member"/>
--------------------------------------------------------------

i put the .class file of exampleBean.java in WEB-INF/classes/foo

the java file follows

-------------------------exampleBean.java---------------------

public class exampleBean{
private int member;

public int getMember(){
return member;
}

public void setMember(int mem){
member=mem;
}
}

-------------------------------------------------------

i do not know where the problem is.

can anyone help.

ARUL JOSE
[ July 14, 2005: Message edited by: Bear Bibeault ]
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have finally found the error. it was : i didnot say 'package foo;' in the java file. do try this.

java file : the class file should be in WEB-INF/classes/foo/

jsp file : should be in applicationFolder



its working only with packages. i'll find the reason soon, why its not working without using packages. please tell me if you find it.
 
Sheriff
Posts: 67650
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
All classes must be in a package other than the default.
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
to me the default was not working at all. it was working only with packages.

i tried without giving the package name in anything. it showed the 'class not found exception'
 
Bear Bibeault
Sheriff
Posts: 67650
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
Correct, if the class is not in a package, the container will be unable to load it. Package your classes.
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic