将属性标记中的值提交给操作表单 [英] Submitting the value in the property tag to the action form

查看:169
本文介绍了将属性标记中的值提交给操作表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JSP:

 < s:form action =addfriend> 
< s:property value =用户名/>
< s:submit value =Add friend/>
< / s:form>

此代码是否在属性中提交值标记到行为表单中?

解决方案

不, property tag doesn不会生成输入字段。只需描述属性标签即可此处。它用于将值栈中的值打印到JSP输出。要将值提交给操作,表单需要生成一个标签,该标签生成HTML input 标签或 textarea 标签。这就是 textfield 标签提供。

 < s:textfield name =Usernamevalue =%{Username}/> 

请注意,还有许多其他生成输入字段的标记,您可以看到在HTML浏览器中生成的输出源窗口。

The JSP:

<s:form action = "addfriend">
  <s:property value="Username" />
  <s:submit value="Add friend" />
</s:form>

Does this code submit the value in the property tag to the action form?

解决方案

No, property tag doesn't generate input fields. Merely description of the property tag you can find here. It's used to print the value from the value stack to JSP output. To submit the value to the action the form needs to have a tag which generate a HTML input tag or textarea tag. That's what the textfield tag provides.

<s:textfield name="Username" value="%{Username}"/>

Note, there are many other tags that generate input fields, you can see the output generated in HTML browser source window.

这篇关于将属性标记中的值提交给操作表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆