论坛首页 Java企业应用论坛

webwork多方法的问题

浏览 4719 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2005-08-11  
在一个action里面,定义了多个方法,浏览器中用下面的方法来访问:
http://localhost/ww/multiMethod!defaultMethod.action
这样看起来很别扭!
我想用struts里面的样子来访问,就是下面的样子:
http://localhost/ww1/multiMethod.action?method=defaultMethod
webwork中能实现吗?
要是可以的话,怎么做?
要是不行也请说一声,免得徒劳无功!谢谢!
   发表时间:2005-08-12  
webwork如果想实现这么做,可以自己实现一个控制器可以做到(我没试过)
0 请登录后投票
   发表时间:2005-08-12  
干么要这么做,xwork.xml中不是可以定义action要执行的method吗?
0 请登录后投票
   发表时间:2005-08-24  
在action里直接判断就可以了啊。
if ("method1".equals(Method););{
............................
return "method1."+SUCCESS
}else("mothod2.equals(Method);");{
..............................
return "method2."+SUCCESS
}

配置文件action里面定义:
<result name="method1.success" type="dispatcher">
				<param name="location">method1.jsp</param>
			</result>
			<result name="method2.success" type="dispatcher">
				<param name="location">method2.jsp</param>
			</result>
0 请登录后投票
   发表时间:2005-08-24  
托天 写道
在一个action里面,定义了多个方法,浏览器中用下面的方法来访问:
http://localhost/ww/multiMethod!defaultMethod.action
这样看起来很别扭!
我想用struts里面的样子来访问,就是下面的样子:
[color=red]http://localhost/ww1/multiMethod.action?...


就为了看起来别扭?
我还觉得struts看起来罗嗦呢........
0 请登录后投票
   发表时间:2005-08-24  
破碎虚空 写道
托天 写道
在一个action里面,定义了多个方法,浏览器中用下面的方法来访问:
http://localhost/ww/multiMethod!defaultMethod.action
这样看起来很别扭!
我想用struts里面的样子来访问,就是下面的样子:
[color=red]http://localhost/ww1/multiMethod.action?...


就为了看起来别扭?
我还觉得struts看起来罗嗦呢........


            严重同意,! 多简炼
0 请登录后投票
   发表时间:2005-09-08  
我觉得还挺好看的.

我想知道可不可以针对不同的方法选择使用不同的validator?虽然可以分开写两个Action解决问题,但是总觉得不好.

另外文档里写到:

引用


Validation rules can be specified:

1 Per Action class: in a file named ActionName-validation.xml
2 Per Action alias: in a file named ActionName-alias-validation.xml
3 Inheritance hierarchy and interfaces implemented by Action class: WebWork searches up the inheritance tree of the action to find default validations for parent classes of the Action and interfaces implemented



由于没有例子,不知道什么是Action alias?
0 请登录后投票
   发表时间:2005-09-08  
一个Action类可以在xwork.xml里面配置多个action定义,这就是alias
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics