Hi, I m trying to write a custom tag for S2. I've prepared taglib.tld file specifying the tag name & its attribute.
I've taken size as one of its optional attribute. But I don't know what to write after this. When I looked into the source from S2 distribution and some other plugin sources, I've found writing few more classes (classes extending AbstractUITag, UIBean). I've tried this. I didn't understand the program flow and why I m need to write those classes. I've no clue. Even I wrote those classes and when I've used the 'size' in tag.ftl file, I m getting FreeMarker error "Expecting a string, date or number here, Expression parameters.size is instead a freemarker.ext.beans.SimpleMethodModel". Classes I wrote by seeing other source files: public class NewTagComponent extends UIBean { private static final String TEMPLATE = "newtag"; protected String size; public NewTagComponent(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); } @Override public void evaluateParams() { super.evaluateParams(); if(size != null) addParameter("size", findString("size")); } @Override protected String getDefaultTemplate() { return TEMPLATE; } public void setSize(String size) { this.size = size; } } public class NewTag extends AbstractUITag { private static final long serialVersionUID = 7468575457921917799L; protected String size; @Override public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new NewTagComponent(stack, req, res); } @Override public void populateParams() { super.populateParams(); NewTagComponent comp = (NewTagComponent) component; comp.setSize(size); } public void setSize(String size) { this.size = size; } } newtag.ftl: -- ${parameters.size} -- <input type="text" name="${parameters.name?html}" /> What am I doing wrong and what all do I need to write a custom tag for S2. Can some one please direct me to some link or resource on this topic. Regards, ManiKanta