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 -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -