我在标记库描述符及其在java中的实现中编写了自己的标记。
public class ProtectedHidden extends AbstractHtmlElementTag {
@Override
protected int writeTagContent(TagWriter tagWriter) throws JspException {
String hash = (String) super.pageContext.getSession().getAttribute("CSRFTokenManager.tokenval");
String oldValue = getDisplayString(getBoundValue(), getPropertyEditor());
String newValue = DESedeEncryption.encrypt(oldValue + "|" + hash.replace("-", ""), hash);
String oldName = (String) super.getPath();
String newName = "zf_" + oldName;
tagWriter.startTag("input");
writeDefaultAttributes(tagWriter);
tagWriter.writeAttribute("type", "hidden");
tagWriter.writeAttribute("name", newName);
tagWriter.writeAttribute("value", processFieldValue(getName(), newValue, "hidden"));
tagWriter.endTag();
return SKIP_BODY;
}
}
我正在尝试设置属性名称,但渲染元素具有旧名称。我试图通过processFieldValue设置名称,但没有任何改变。我该怎么办?