JSP tag which is retrieved as String is not executed -
JSP tag which is retrieved as String is not executed -
i have java class responsible rendering html elements , have predefined tags created them.
public class startdatefield { private static startdatefield object; private startdatefield(){} public static startdatefield getinstance(){ if(object == null){ object = new startdatefield(); } homecoming object; } public string render(){ string field = "<field:text name='first_name' size='65' maxlen='63' style='field' />"; homecoming field; }
}
then tried phone call render method within jsp tag (which has import above class)
<td colspan="2"> <%=startdatefield.getinstance(subpagebean).render()%> </td>
but displays nothing. when go view source shows returned text instead of executing tag. how caused , how can solve it?
<%= someexpression() %>
means: evaluate java look someexpression()
, , write result http response writer. obviously, you're writing <field:text name='first_name' size='65' maxlen='63' style='field' />
straight response.
a jsp tag must in static source code of jsp evaluated.
note jstl standard library of tags. <field:text>
custom jsp tag. it's not jstl tag.
jsp jsp-tags
Comments
Post a Comment