Accessing netui tag properties in tag development
-------------------------------------------------
Key: BEEHIVE-771
URL: http://issues.apache.org/jira/browse/BEEHIVE-771
Project: Beehive
Type: Test
Components: NetUI
Versions: V1Beta
Environment: WindowsXP SP2, tomcat 5.0.28, MySQL 4.1
Reporter: V.Gnanasegaran
I am trying to develop a custom tag based on the netui textbox. The syntax of
the tag definision is the same and the ony difference is the datasource.
<bjeff:textBoxi dataSource="container.item.modul.tips.field"
style="width:410px;" maxlength="100"/>
The purpose of the tag is to enable/dissable a info. button next to the text
box.
Her is my custom tag code
public class TextBoxiTag extends TextBox {
private Field field;
/**
* @see org.apache.beehive.netui.tags.AbstractClassicTag#getTagName()
*/
public String getTagName() {
return "TextBoxi";
}
/**
* @see javax.servlet.jsp.tagext.BodyTagSupport#doEndTag()
*/
public int doEndTag() throws JspException {
// Finn referanse til actionForm
StringBuilderRenderAppender results = new
StringBuilderRenderAppender(new StringBuilder());
ExpressionEvaluator ee =
ExpressionEvaluatorFactory.getInstance();
ExpressionHandling eh = new ExpressionHandling(this); // param:
INetuiTag
BaseForm formularet = (BaseForm) eh.evaluateExpression(
"{actionForm}", "form", this.pageContext);
String scriptId = null;
// String dataSource = evaluateDataSource().toString();
String dataSource = "{" + this._dataSource + "}";
if (ee.containsExpression(dataSource)) {
Object object = eh.evaluateExpression(
dataSource, "element",
this.pageContext);
if ((object == null) || (!(object instanceof Felt))) {
Logger logger =
Logger.getInstance(this.getClass());
logger.warn(Bundle.getString("Tags_ContentExpressionNull",
dataSource));
return BodyTagSupport.SKIP_PAGE;
}
this.field= (Field) object;
} else {
return BodyTagSupport.SKIP_PAGE;
}
if(hasErrors()) {
reportErrors();
localRelease();
return EVAL_PAGE;
}
String textObject = felt.getFeltVerdi() == null? "" :
felt.getFeltVerdi();
if(textObject == null)
textObject = "";
results.append("<input type=");
results.append("\"text\"");
/////////////////////////////////////////////////
Some code here
/////////////////////////////////////////////////
String regexp = felt.getFeltValideringsuttrykk();
results.append(" onBlur=\"");
results.append(this.getOnBlurJavascript());
results.append("(this,'");
results.append(formularet.getFeilOverskrift());
results.append("<div>");
results.append(StrengUtil.fjernSuffix(felt.getElementTekst(),
FeltUtil.OBLIGATORISK_SUFFIX));
results.append("</div>', '");
String feilmelding = felt.getElementFeilmeldingstekst();
if ((feilmelding == null) ||
(feilmelding.equalsIgnoreCase(BaseController.NULLTEKST))) {
feilmelding = "";
}
results.append(feilmelding);
results.append("', '");
results.append(this.getSisteParam());
results.append("');\"");
results.append("/>");
if(scriptId != null)
results.append(scriptId);
write(results.toString());
localRelease();
return EVAL_PAGE;
}
In the region "Some code here" I would like to retrive those attributes
"maxlength", "style" which I passed through in the jsp tag. I used
this.getValue("maxlength") did NOT retrive the value of maxlength. Have you any
suggession how I can retrieve those values and put it into the textbox tag
attribute using this.setMaxlength() and so on.
An other problem is binding the netui tag datasource variable properly. The
value of the binded datasource in NOT updated with the new value.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira