Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
18
rated 0 times [  20] [ 2]  / answers: 1 / hits: 16612  / 12 Years ago, wed, september 12, 2012, 12:00:00

I want to programmatically show a div tag after some processing has completed while rendering a JSP. What's the best way to do this using Java? Using jQuery I would do this:



$('#mydiv').removeClass(hide_me);


...or...



$('#mydiv').show();


How can I do this programmatically in Java while rendering the page?


More From » java

 Answers
37

Assuming you have the standard JSP setup including JSTL and have mapped it to 'c' you could just do:



<c:if test=${myCondition}>
<div id=mDiv>
content
</div>
</c:if>


It does seem from the comments like there is some confusion about rendering JSP on the server vs rendering content in the browser. Everything that happens in the JSP is server side work that has to completely finish before the browser receives the generated document and starts drawing it. You can't use JSP to change content that is already on the user's screen. You need javascript, html5, etc, for that.


[#83109] Tuesday, September 11, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cristinadomoniquel

Total Points: 320
Total Questions: 94
Total Answers: 94

Location: Moldova
Member since Sat, Aug 6, 2022
2 Years ago
;