|
这个主题共有 15 回复 / 2 页 [
1 2
下一页
]
|
|
|
|
|
|
在jsp+javabean模式下不能使用抽象类和继承类的功能,真是不爽
|
发表: 2002年08月30日 09:50
|
回复
|
|
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用抽象类和继承类的功能,真是不爽
|
发表: 2002年08月30日 11:22
|
回复
|
|
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用抽象类和继承类的功能,真是不爽
|
发表: 2002年08月30日 11:45
|
回复
|
|
谁说不能用啊?
抽象类或继承类本身就是Javabean啊 呵呵 你可能思路没转过弯。
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用抽象类和继承类的功能,真是不爽
|
发表: 2002年08月30日 13:32
|
回复
|
|
bang: useBean 的类加载可全是具体类啊.
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用抽象类和继承类的功能,真是不爽
|
发表: 2002年08月30日 16:21
|
回复
|
|
有两种办法:
1.采用facade模式,你所有JsP只Usebean一个具体的类,而在这个类中,你就可以使用抽象类 或其他模式了。
2.在Jsp中不使用Use bean,使用import你的class.你参考Jive源程序,它其实就是Jsp+Javabean的架构。
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用抽象类和继承类的功能,真是不爽
|
发表: 2002年09月02日 17:20
|
回复
|
|
我觉得用第一种方法比较好,这样不会在JSP文件中出现大量的JAVA代码.这种情况下JAVABEAN其实成了一个个调度用的类,合成其它类设计情况.
有机会大家分享一下structs经验吧,我刚下了一个,好象要先了解taglib和xml.
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月03日 09:38
|
回复
|
|
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月04日 09:12
|
回复
|
|
|
如果我使用import的方法,但是又想利用jsp:setProperty name="profile" property="*" 的方便,有没有两全其美的办法?因jsp中有很多要处理的数据,还涉及到转型,jsp中的java代码只能使用interface
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月04日 09:25
|
回复
|
|
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月04日 16:37
|
回复
|
|
可以即用import 也可以用setProperty 比如useBean id="A" class="A.class"
而在你的import中也有个A.class的实例aa
你可以aa=A这样传递。
这里注意java的值传递
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月05日 09:05
|
回复
|
|
<jsp:useBean id="list" type="java.util.List" beanName="java.util.ArrayList"/>可以这样用接口,缺陷是必须指出具体类的名字。当时用工厂方法时,我是这样做的。 public interface aaa{} public class aaaImpl implements aaa{...} public class Factory { public static final String className = "aaaImpl"; public static aaa getAAA(){...} } <jsp:useBean id="bean" type="aaa" beanName="<%= Factory.className %>"/> 测试通过
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月05日 09:07
|
回复
|
|
可以这样用接口,缺陷是必须指出具体类的名字。当时用工厂方法时,我是这样做的。 public interface aaa{} public class aaaImpl implements aaa{...} public class Factory { public static final String className = "aaaImpl"; public static aaa getAAA(){...} }
useBean id="bean" type="aaa" beanName="<%= Factory.className %>" 测试通过
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月05日 09:08
|
回复
|
|
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月05日 09:10
|
回复
|
|
|
不能使用尖括号,我的两条信息都不完全,怎么回事?beanName中应该有内容的 %=Factory.className
|
|
|
|
|
|
Re: 在jsp+javabean模式下不能使用?橄罄嗪图坛欣嗟墓δ?真是不爽
|
发表: 2002年09月05日 09:38
|
回复
|
|
|
|
|
|
|
|
这个主题有 15 回复 / 2 页 [
1 2
下一页
]
|
|
|