html标签库struts
在我的时区下午好。
我对这个标签库和actionForm的使用有一些小小的疑问。 我想在我的页面中放置一个 inputText ,但是这个输入文本将是只读的。所以我没有在 actionForm 对象中放置任何内容,因为这是一个只读文本(只是为了显示数据)。 我将信息放在请求范围中(request.setAttribute(“readOnly”,“data”))。 在我的jsp中,
<html:form action="action1">
<html:text name="actionForm" property="inputText1"/>
<html:text name="actionForm" property="inputText2"/>
<html:text property="readOnly" readonly="true"/>
<html:form>
这不起作用(如果我删除最后一个字段,一切正常),所以我提出以下问题? 是否可以使用
访问任何范围内的属性,无论 actionForm bean 是什么?文档为我们提供了两个属性来定义我们想要检索值的 bean(名称=bean 的名称和 property=bean 内属性的名称)。但它没有说明任何有关范围(requst,scope)的内容。 那么我可以使用这个标签库还是必须采取其他方式?
提前致谢
Good afternoon in my timezone.
I have a few little doubts regarding the use of this tag library and the actionForm.
I want to put a inputText in my page , but this input text will be read only.So i did not put any thing in the actionForm object because this is a readOnly text(just to display data).
I put the information in the request scope (request.setAttribute("readOnly","data")).
In my jsp i have
<html:form action="action1">
<html:text name="actionForm" property="inputText1"/>
<html:text name="actionForm" property="inputText2"/>
<html:text property="readOnly" readonly="true"/>
<html:form>
This is not working(if i remove the last field everything works fine), so i put the following questions ?
Is it possible using <html:text>
to access attributes in any scope,regardless the actionForm bean ?The documentation provide us with two properties to define the bean from where we want to retrieve the values (name=name of the bean and property=name of the property inside the bean).But it does not say anything about scopes(requst,scope).
So can i use this taglibrary or i have to go by another way ?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单独使用的
property
属性被假定为引用ActionForm
属性。一般来说,
ActionForm
属性是将表单元素发送到视图层的首选方式。如果您不使用正常机制,则需要提供name
属性来显式取消输入表单元素与范围内的ActionForm
的关联。您还可以使用纯 HTML 标记并使用 JSP EL 来提供值,或者根本不使用输入标记并仅显示该值。
The
property
attribute, used alone, is assumed to refer to anActionForm
property.In general, an
ActionForm
property is the preferred way to send form elements to the view layer. If you're not using the normal mechanism, you need to provide thename
attribute to explicitly dis-associate the input form element from theActionForm
in scope.You may also use a plain HTML tag and use JSP EL to provide the value, or not use an input tag at all and simply display the value.