java - How to clear bodycontent of a custom tag? -



java - How to clear bodycontent of a custom tag? -

how clear body content placed within custom tag?

<abc:mytag display="true"> <b> clear content </b> <abc:mytag />

based on display="true" boolean flag in tag handler, want clear out content "clear content". tried:

if(display){ getbodycontent(); } else seek { getbodycontent().clear(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); }

but throwing null pointer exception

if have reference custom element can do

for (node child; (child = mycustomelement.getfirstchild()) != null;) { mycustomelement.removechild(child); }

if need reference custom element can like

element mycustomelement = mydocument.getelementsbytagnamens(namespaceforabc, "mytag");

or if aren't using xml namespaces, can do

element mycustomelement = mydocument.getelementsbytagname("abc:mytag");

java jsp jstl

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -