日期:2014-05-18  浏览次数:20636 次

关于struts的 errorKey属性
<html:text   errorKey= "test "   property= "username "   />

errorKey到底怎么用的啊?搜了一下都是一些“添加了新属性errorkey,errorstyle,   errorstyleclass”但是却没有搜到怎么用的。

<html:errors   property= "test "/> 当然可以显示,但我用
<html:text   errorKey= "test "   property= "username "   /> 就没什么反应了,请高手指教它的用法

文档是这么解释的:
<p> Name   of   the   bean   (in   any   scope)   under   which   our   error   messages   have   been   stored.   If   not   present,   the   name   specified   by   the   <code> Globals.ERROR_KEY </code>   constant   string   will   be   used. </p>   <p> <strong> N.B. </strong>   This   is   used   in   conjunction   with   the   <code> errorStyle </code> ,   <code> errorStyleClass </code>   and   <code> errorStyleId </code>   attributes   and   should   be   set   to   the   same   value   as   the   <code> name </code>   attribute   on   the   &lt;html:errors/&gt;   tag. </p>   <dl> <dt> <b> Since: </b> </dt>   <dd> Struts   1.2.5 </dd> </dl>  

照它的意思,应该和 <html:error   差不多用法

------解决方案--------------------
html:text中
好象没有errorKey属性