|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
problem when use bean class with JSP
I keep been class in mybean package in
c:\tomcat\webapps\Root\Web-inf\classes\mybean\somebean.class and save jsp file in c:\tomcat\webapps\Root\jsp\sec1\test.jsp and I type url in http://localhost:8080/jsp/sec1/test.jsp This work correct. and all directory such as \Root\jsp, \Root\news, \Root\webboard must use \Root\Web-inf\classes\mybean to keep class file. I have 2 question 1. When I not use package, in file somebean.java I delete line 1 (package mybean) and compile again. and I edit file test.jsp change from <jsp:useBean id="bean1" class="mybean.somebean" /> to <jsp:useBean id="bean1" class="somebean" /> When I run this jsp file. It has error Class org.apache.jsp.someclass not found I try to shutdown and restart Tomcat. but it has same error. 2. When I put class file in c:\tomcat\webapps\Root\jsp\Web-inf\classes\mybean\somebeen.class or c:\tomcat\webapps\Root\jsp\sec1\Web-inf\classes\mybean\somebeen.class Why it not found class bean? Any help please? |
|
#2
|
|||
|
|||
|
This is the correct behavior. The package that a bean or other class is in is reflected in the folder hierarchy under the Web-inf/classes folder. If you don't want to use packages (though you should use them to group related classes and to protect the namespace of your application) you have to have your class in the classes folder.
Also note that the WEB-INF hierarchy is unrelated to the folder structure under the Root level of your webapp so you shouldn't have additional WEB-INF folders. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > problem when use bean class with JSP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|