开发者

question regarding jsp page import and <jsp:useBean id

开发者 https://www.devze.com 2022-12-14 05:41 出处:网络
Hi I have a J2EE application which is working and I has the basic structure as APP ____login.jsp ____other files/directories(several other directories and files required)

Hi I have a J2EE application which is working and I has the basic structure as

APP

|____login.jsp

|____   other files/directories      (several other directories and files required)

|____WEB-INF

     |__classes
             |__top
                |___web     (has more sub directories with class files)
|
______NewDir

      |__login2.jsp

I want to add another directory as shown above NewDir which would 开发者_运维百科have a similar login.jsp as the one int he root directory which uses some classes in com.top.web. etc and the login.jsp uses those at the top of the page in the following manner.

<%@ include file="includes/utf8.jsp"%>

<%@ page import = "com.top.app.login.LoginBean" %>
<%@ page import = "com.top.app.login.*" %>
<%@ page import = "javax.servlet.http.Cookie" %>
<%@ page import = "org.apache.commons.logging.Log" %>
<%@ page import = "org.apache.commons.logging.LogFactory" %>

<jsp:useBean id="bean" scope="session" class="com.top.app.login.LoginBean"/>

The quesiton I have is when I create that directory I need to change the above imports because obvisoulsy its not going to find those classes. How would this login2.jsp find those classes inside com.top.web... ?

Also what about the useBean? How would that also be found?


Why do you think it won't find them?

The classes referenced by the jsp must be in the classpath. And the classpath includes WEB-INF/classes. The location of the jsp is of no importance.

0

精彩评论

暂无评论...
验证码 换一张
取 消