admin管理员组文章数量:1024174
I have a jsp page, which imports another jsp. This import is wrapped into div tag. Also I have parameter with values "true/false", which arrives from servlet as a request parameter. I wonder what's the way to change mentioned visibility(with the help of "style.display" attribute) using the request parameter value. The div should be visible/invisible immediately after page loads. Any ideas? Thanks in advance.
I have a jsp page, which imports another jsp. This import is wrapped into div tag. Also I have parameter with values "true/false", which arrives from servlet as a request parameter. I wonder what's the way to change mentioned visibility(with the help of "style.display" attribute) using the request parameter value. The div should be visible/invisible immediately after page loads. Any ideas? Thanks in advance.
Share Improve this question edited Jun 17, 2012 at 17:23 Vyacheslav Sermyazhko asked Jun 17, 2012 at 17:17 Vyacheslav SermyazhkoVyacheslav Sermyazhko 3592 gold badges4 silver badges13 bronze badges2 Answers
Reset to default 5If you don't want to display a JSP fragment (it can be a fragment that import another JSP) I would avoid to use "style.display
attribute and I would do this:
<c:if test="${myVariable}">
// import jsp, whatever you want
</c:if>
This is better that to import the jsp and them hide it.
you can use
<%
if("true".equalsIgnoreCase((String)request.getAttribute("true"))){
%>
<div class="message_div">
// div given for style .. if div is not there too its fyn
//import jsp here
</div>
<%
}
%>
I have a jsp page, which imports another jsp. This import is wrapped into div tag. Also I have parameter with values "true/false", which arrives from servlet as a request parameter. I wonder what's the way to change mentioned visibility(with the help of "style.display" attribute) using the request parameter value. The div should be visible/invisible immediately after page loads. Any ideas? Thanks in advance.
I have a jsp page, which imports another jsp. This import is wrapped into div tag. Also I have parameter with values "true/false", which arrives from servlet as a request parameter. I wonder what's the way to change mentioned visibility(with the help of "style.display" attribute) using the request parameter value. The div should be visible/invisible immediately after page loads. Any ideas? Thanks in advance.
Share Improve this question edited Jun 17, 2012 at 17:23 Vyacheslav Sermyazhko asked Jun 17, 2012 at 17:17 Vyacheslav SermyazhkoVyacheslav Sermyazhko 3592 gold badges4 silver badges13 bronze badges2 Answers
Reset to default 5If you don't want to display a JSP fragment (it can be a fragment that import another JSP) I would avoid to use "style.display
attribute and I would do this:
<c:if test="${myVariable}">
// import jsp, whatever you want
</c:if>
This is better that to import the jsp and them hide it.
you can use
<%
if("true".equalsIgnoreCase((String)request.getAttribute("true"))){
%>
<div class="message_div">
// div given for style .. if div is not there too its fyn
//import jsp here
</div>
<%
}
%>
本文标签: javaMaking HTML element visibleinvisible depending on HttpServletRequest parameterStack Overflow
版权声明:本文标题:java - Making HTML element visibleinvisible depending on HttpServletRequest parameter - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745566657a2156489.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论