Redian新闻
>
JB JAVA Bean,SERVLET位置一问
avatar
JB JAVA Bean,SERVLET位置一问# Java - 爪哇娇娃
p*p
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。
请问正确的该如何配置?
avatar
w*r
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:
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。
: 请问正确的该如何配置?

avatar
p*p
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:
: Do not forget to put double quotes on the package name.
:
: 在

avatar
c*g
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:
: Do not forget to put double quotes on the package name.
:
: 在

avatar
w*r
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.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。