p***p 发帖数: 559 | 1 用JB做一个JSP,SERVLET东西。先建立一个WEB MODULE,JSP存在里面。然后建立JAVA
Bean,SERVLET这些,JB会保存在比如project/src/com/smth/javaweb/
里面。可是在JSP中如果使用com/smth/javaweb的BEAN或者SERVLET老是说找不到。我现在
用土办法,把所有BEAN或者SERVLET打成个JAR文件,然后引入LIB。
请问正确的该如何配置? | w*r 发帖数: 2421 | 2 If you wish to use those objects, you need import the path. You should know
that JSP is nothing but a 'servlet', basically, the jsp will be translated
into a servlet while it is compiled by the J2EE container. So, it's final
representation is a class.
Import in JSP is: <%@ page import="java.lang.*" %>
Do not forget to put double quotes on the package name.
在
【在 p***p 的大作中提到】 : 用JB做一个JSP,SERVLET东西。先建立一个WEB MODULE,JSP存在里面。然后建立JAVA : Bean,SERVLET这些,JB会保存在比如project/src/com/smth/javaweb/ : 里面。可是在JSP中如果使用com/smth/javaweb的BEAN或者SERVLET老是说找不到。我现在 : 用土办法,把所有BEAN或者SERVLET打成个JAR文件,然后引入LIB。 : 请问正确的该如何配置?
| p***p 发帖数: 559 | 3 thanx a lot!!! stuid JB.
MODULE,JSP存在里面。然后建立JAVA
现
【在 w*r 的大作中提到】 : If you wish to use those objects, you need import the path. You should know : that JSP is nothing but a 'servlet', basically, the jsp will be translated : into a servlet while it is compiled by the J2EE container. So, it's final : representation is a class. : Import in JSP is: <%@ page import="java.lang.*" %> : Do not forget to put double quotes on the package name. : : 在
| c**g 发帖数: 274 | 4 Is this a special case in JB? he mentioned if he "把所有BEAN或者
SERVLET打成个JAR文件,然后引入LIB" then no problem.
But as I understand, you always need to import the class if you don't want
to use full path name of a class and the compiled JSP is not under
the same package as that of the class you use, no matter you
"打成个JAR文件,然后引入LIB" or not.
【在 w*r 的大作中提到】 : If you wish to use those objects, you need import the path. You should know : that JSP is nothing but a 'servlet', basically, the jsp will be translated : into a servlet while it is compiled by the J2EE container. So, it's final : representation is a class. : Import in JSP is: <%@ page import="java.lang.*" %> : Do not forget to put double quotes on the package name. : : 在
| w*r 发帖数: 2421 | 5 yes you are right, as long as your jsp page is in the different package,
you should always use import to find the file. em....
I have a question here, I remember that when I use a bean on the page,
I did not import the package, however, for some reason, when i tried use
JBuilder, the bean class can be found automatically by the jsp page.
I think there might be some place in the WEB.xml which could include
a default package for jsp pages.......
【在 c**g 的大作中提到】 : Is this a special case in JB? he mentioned if he "把所有BEAN或者 : SERVLET打成个JAR文件,然后引入LIB" then no problem. : But as I understand, you always need to import the class if you don't want : to use full path name of a class and the compiled JSP is not under : the same package as that of the class you use, no matter you : "打成个JAR文件,然后引入LIB" or not.
|
|