有关jsp页面导入和< jsp:useBean id的问题 [英] question regarding jsp page import and <jsp:useBean id

查看:133
本文介绍了有关jsp页面导入和< jsp:useBean id的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在运行的J2EE应用程序,其基本结构为

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

我想添加另一个目录,如NewDir所示,该目录将具有与root目录类似的login.jsp,后者使用com.top.web中的某些类.等等,login.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"/>

我遇到的问题是,当我创建该目录时,我需要更改上述导入内容,因为obvisoulsy无法找到这些类.这个login2.jsp如何在com.top.web ...中找到这些类?

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... ?

那useBean又如何呢?怎么会找到呢?

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

推荐答案

为什么您认为找不到它们?

Why do you think it won't find them?

jsp引用的类必须在classpath中.并且类路径包含WEB-INF/classes. jsp的位置并不重要.

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.

这篇关于有关jsp页面导入和&lt; jsp:useBean id的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆