只显示主题贴
hongliang 写道关于exception这块我理解叻,谢谢bruce :)
SessionAware接口我知道,只是我取Session的地方是个Interceptor,我试叻一下,只有Action去实现SessionAware才有意义,对于Interceptor是不起作用的,所以我只能用ActionContext来取。
实际上这个脚手架我现在已经不怎么用叻,我正在筹划第二个版本的脚手架,基于AJAX的,表现层工作从FreeMarker层直接向前推到HTML/JavaScript层,Service层也简洁叻许多(连RuntimeException也没用)
希望早日看到你用AJAX做的 ...
- 进入论坛 Java 版
hongliang 写道robbin 写道简单扫了一眼
LoginAction在Java代码里面写中文字符串,一大忌,你试试部署到某字符集设定不是中文的操作系统上面看看;
从ActionContext里面取Session不优雅,建议看看SessionAware接口;
异常类应该继承自RuntimeException,不要强制层层捕获;
多谢Robbin指教
Action里写中文虽然不太好,不过我也不想用ResourceBundle,非常反感native2ascii这个步骤。现在看来虽然非常不优雅,但也不是什么大问题。只要编译的时候指定encoding为utf-8,执行期间操作系统字符集是不 ...
- 进入论坛 Java 版
我前段时间, 工作中做了一个clustering 在我一台机子上。 Apache 2.0. x + mod_jk-1.2.x + 2个Tomcat. session sticky approach. 只实现了load balancing. 没有做session replication. 因为session replication太慢. 但是就仅是load balancing. 我只在我自已的机子上运行了一下, 我觉得速度不快。反而比以前慢了。 我想, 如果 Apache 2.0. x + mod_jk-1.2.x + 2个Tomcat, 布置在不同的机子上, 性能会提升很多吧. 我认 ...
- 进入论坛 Java 版
这个贴子看的真累. 没有细看. 但感觉 已经从 DTO or not 到了 XML 平面数据 or not.
Firstly, I think we need consider application is remotable or not. If it is remotable application (suppose tomcat + weblogic), consider about performance and remote reasons, DTO is a good way. Here, DTO is a coarse granularity, serializable ...
- 进入论坛 Java 版
No free lunch, we always have to do balance. Good luck. Over
- 进入论坛 Java 版
We could have a superclass for every detailed action class. Let's name this superclass as SuperAction. We also could introduce strategy pattern to resolve your worry. Now we have Spring Ioc container. Let's say there will be Summer Ioc container in the future. Look at following codes.
[code:1]
pu ...
- 进入论坛 Java 版
Kewan, nice to discuss with you.
I showed my opinion based on my supposed situation. Anyway, the more decoupling, the more maintanence, extension, reusablity, flexibility we can get. The down side is introducing more complexty.
回到正题.
I think I agree with your second option. Suppose we have the fo ...
- 进入论坛 Java 版
What you said is right. Our difference depends on different situation.
I mentioned about exception if we use service tier. We know, we need the throwed exception is friendly to client. Therefore, we define different meaning exception classes in different tier.
For example, Hibernate exception ...
- 进入论坛 Java 版
kewan 写道小程序当然不必要分那么多的层,但当程序大了之后,不可能把逻辑都放在Service层。Service应该把工作delegate到Domain层,自己不应该做什么工作。而由Domain层去调用DAO层完成持久化。真正的逻辑应该在Domain层。
这是一个最基本的分层结构,如果还要灵活的话,在Service之上可能还要Facade层等等。
I think Service Tier normally is used to process customized exception in web tier. So I don't think it is necessary to hav ...
- 进入论坛 Java 版
The reason why change checked exception to unchecked exception are listed as follows:
1. client does not have ability to recover checked exception.
2. Throwing checked exception to upper level such as businees tier destroy preservation encapsulation.
3. checked exception force client throw checked ...
- 进入论坛 Java 版







评论排行榜