Change HTML element's CSS style using java -


i using jsp create web page. need use java classes access data need pull website's json (this cannot change).

say have code:

<div class="fruit apple"></div> <div class="fruit banana"></div> //"fruit peach", "fruit orange", , on... style.fruit {display: none;} 

i need change html element using java, not javascript. in jsp file, in <% %> tag.

<% var divclassineedtochange = "banana"; //some sort of java code equivalent to: //document.getelementsbyclass(divclassineedtochange).style.display = "block"; %> 

i cannot find line of java code equivalent above line.

i hope you

you can parse page using dom or sax parser.

for example

documentbuilderfactory factory=documentbuilderfactory.newinstance();     documentbuilder builder=factory.newdocumentbuilder();     document doc=builder.parse(new file(filename)); element e = doc.getelemetbyid(divclassineedtochange); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

php - phpWord - Tables with borders in headers/footers -