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 badges
Add a ment  | 

2 Answers 2

Reset to default 5

If 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 badges
Add a ment  | 

2 Answers 2

Reset to default 5

If 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