锁定老帖子 主题:讨论一下spring自己的MVC框架
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2005-04-30
大愚弱智:
引用 另外,Spring的可配置客户端验证问题,spring借用struts的验证机制,我用过一阵子,每更改一下配置文件,就得重新启动服务器,感觉不是很好用
server端的验证为什么要重启?我想不明白. spring的验证是可以直接new一个验证类,然后做测试的.有必要用容器吗? js,是有必要,但如果单单靠js就是找死. |
|
返回顶楼 | |
发表时间:2005-04-30
checkbox绑定到boolean的问题我还没解决,CustomBooleanEditor它只能绑定到Boolean,而不是boolean,只能使用request.getParameter来取得checkbox的值。
----这个问题谁能帮我解决一下 |
|
返回顶楼 | |
发表时间:2005-04-30
所有的问题都已经解决了!只是你们敢不敢使用新的“SpringMVC”,这个新的“SpringMVC”就是Aurora MVC Framework,在Spring的官方网站有贴出。我下载看了一下,这是SpringMVC的实践着在总结了SpringMVC的各种毛病之后搞出来的一个估计是为替代SpringMVC的框架。
例如对于xiaoyun所说的提交多个bo的问题,上面有解释: With Aurora, the framework uses metadata placed in your configuration files to map request values to your domain objects. Thus, you can edit one object, or even several, on the same form. The framework uses reflection to map each individual request value to your domain object just before your custom processing logic is executed. Of course, you are not locked into this approach since sometimes you won't want to map to domain objects - you can declare non-domain object values in the same way but you can still leverage every other aspect of the framework to keep things consistent. Thus, in almost all cases, you won't have to deal with the HttpServletRequest object at all, but the framework does not shield you from it either like other MVC frameworks do. 对于多选列表问题,它是这样解决的: <SelectMany name="company.types" referenceData="types" validatorId="multireference" errorMessage="There are no company types in the database." > <Text /> </SelectMany> 这是很好的一个MVC框架,可以作为SpringMVC的代替,值得我们好好研究。 |
|
返回顶楼 | |
发表时间:2005-04-30
贴上一个解决boolean值的类,还没有测试过(不好意思),是按照spring里的写的,有少少改动(以下的代码是错误的,sorry).
package org.springframework.beans.propertyeditors.custom; import java.beans.PropertyEditorSupport; import org.springframework.util.StringUtils; /** * 自定义的boolean类型编辑器 * @author xiaoyu */ public class CustomBasicBooleanEditor extends PropertyEditorSupport { public static final String VALUE_TRUE = "true"; public static final String VALUE_FALSE = "false"; private final boolean allowEmpty; public CustomBasicBooleanEditor(boolean allowEmpty); { this.allowEmpty = allowEmpty; } public void setAsText(String text); throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasText(text);); { //修改,如果为空值,那就是false setValue(false);; } else if (text.equalsIgnoreCase(VALUE_TRUE);); { //这句改动了 setValue(true);; } else if (text.equalsIgnoreCase(VALUE_FALSE);); { //这句改动了 setValue(false);; } else throw new IllegalArgumentException("Invalid boolean value [" + text + "]");; } public String getAsText(); { return (getValue(); == null ? "" : getValue();.toString(););; } } |
|
返回顶楼 | |
发表时间:2005-04-30
我正在研究Aurora MVC Framework,说不准,里面已经解决好了呢。
Aurora MVC Framework的FormController和其它Controller都派生在Spring的Controller,返回的也是ModelAndView。里面还提供了n多的HTML控件,Validator控件,Javascript都附带好了,都是为了解决SpringMVC的很多问题而做的,值得我们这帮SpringMVC狂好好研究一下! |
|
返回顶楼 | |