html标签库struts

发布于 2024-12-19 18:14:37 字数 723 浏览 3 评论 0原文

在我的时区下午好。

我对这个标签库和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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过去的过去 2024-12-26 18:14:37

单独使用的 property 属性被假定为引用 ActionForm 属性。

一般来说,ActionForm 属性是将表单元素发送到视图层的首选方式。如果您不使用正常机制,则需要提供 name 属性来显式取消输入表单元素与范围内的 ActionForm 的关联。

您还可以使用纯 HTML 标记并使用 JSP EL 来提供值,或者根本不使用输入标记并仅显示该值。

The property attribute, used alone, is assumed to refer to an ActionForm 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 the name attribute to explicitly dis-associate the input form element from the ActionForm 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文