`
visionary_2006
  • 浏览: 126493 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

再次发现一个struts2中命名空间有趣的问题

阅读更多
今天在处名命空间时,发现一个奇怪的现象,之前我写过关于它的文章,是说,见议所有路径前面都加上 / .现在看来,这样说不完全正确.

在没有用到strtus2标签的表单里,action这里加里加上/*.action是会出错的
而用到标签的表单加上/却不会出错.

例:命名空间为:/user

<s:form action="/user/login.action">
	<s:textfield name="login.username" label="Username"></s:textfield>
	<s:password name="login.password" label="Password"></s:password>
	<s:submit></s:submit>
</s:form>


像这样是不会出错的

<form action="/user/log.action" method="post">
    <table align="center">
    <caption><h3>用户登录</h3></caption>
        <tr>
            <td>用户名:<input type="text" name="username"/></td>
        </tr>
        <tr>
            <td>密&nbsp;&nbsp;码:<input type="text" name="password"/></td>
        </tr>
        <tr align="center">
            <td><input type="submit" value="登录"/><input type="reset" value="重填" /></td>
        </tr>
    </table>
</form>


像这样是会出错的
分享到:
评论
5 楼 hongfeng1126 2011-08-07  
<form action="/user/log.action" method="post">  改成
<form action="<%=request.getContextPath() %>/user/log.action" method="post">就ok了。 
4 楼 fish2007 2009-02-15  
知道strtus2 的默认命名空间和 跟命名空间分别在什么地方吗
3 楼 justry 2008-11-10  
高手多多啊。

楼主,写一篇 struts1 的标签 和struts2 标签 用法 示例呗。
可能我没说明白。我想要的是比如
struts1 中<bean:write name="USER" scope="session" property="userName" fliter="false"/>
strut2中怎么写?

类似这样的东东,楼主写一篇文章好吗?
2 楼 zyx_0219 2008-08-05  
<form action="<%=request.getContextPath() %>/mng/xxn.action" method="post">这么写绝对不会出问题
1 楼 我很丑,但是我也不温柔 2008-07-10  

相关推荐

Global site tag (gtag.js) - Google Analytics