Struts2 Textarea调整大小 [英] Struts2 Textarea Resize

查看:90
本文介绍了Struts2 Textarea调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想要做的就是在Struts2 Textarea上隐藏调整大小的句柄。但随着我的尝试,我有了意想不到的结果。用我的代码,我告诉它在x& y方向滚动条,然后我告诉调整大小为'无'

我期望调整大小的句柄消失,但它的确溢出只是包装到下一个而不是滚动。

 < s:textarea name =newsStringcols =65rows =17style =overflow:scroll; resize:none;>< / s:textarea> 

那么我应该如何正确地隐藏调整大小的句柄并保持滚动?如果可以的话。

解决方案在Struts2标签中, class style 属性被命名为 cssClass cssStyle p>

这将起作用:

 < s:textarea name =newsString cols =65rows =17
cssStyle =overflow:scroll; resize:none; />

事实上,由于不存在的属性导致编译错误,因为< s:textarea> 标记(例如< s:file> 标记,也许还有其他标记),



lockquote

动态属性允许: true

官方文档中指定的),那意味着你将要编写的所有东西(不是有效的Struts2属性)都将在HTML中进行报告,而不进行任何解析(例如,当 CSS3-4 HTML5 细节引入了新的特性,不需要改变标签以保持最新,让我们考虑< $ gt;中的multiple =multiple属性。 s:file /> ...)


Basically what I'm trying to do is 'hide' the resize handle on a Struts2 Textarea. But with my attempt at it I had and unexpected result. With my code I told it to overflow in the x & y direction with a scrollbar then I told the resize to be 'none'

I expected the resize handle to disappear which it did but the overflow is just wrapping down to the next line instead of scrolling.

<s:textarea name="newsString" cols="65" rows="17" style="overflow: scroll; resize: none;"></s:textarea>

So how should I properly go about hiding the resize handle and still having it scroll? If that is at all possible.

解决方案

In Struts2 tags, class and style attributes are named cssClass and cssStyle.

This will work:

<s:textarea name="newsString" cols="65" rows="17" 
            cssStyle="overflow: scroll; resize: none;" />

The fact that you wasn't getting compilation errors due to an inexistent attribute, is because <s:textarea> tag (like <s:file> tag and maybe some others), has

Dynamic Attributes Allowed: true

(as specified in the official documentation), that means that all you will write (that is not a valid Struts2 attribute) will be reported in the HTML without any parsing (so when, for example, CSS3-4 and HTML5 specifics introduces new features, there is no need to alter the tag to stay up to date, let's think to the multiple="multiple" attribute in <s:file />...)

这篇关于Struts2 Textarea调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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