1

Hi I have a class it contains a boolean value. I want to access its value in JSP page, if this value is false a link will show and if it true link will not show. I have also tried using getter method but it is not working, is there any way to this. My code is as below-

     public class Test { 
            public static boolean isMonitoringStarted;
        }

And in my JSP page I am trying this, but its not working -

        <c:if test="${!Test.isMonitoringStarted}" > 
             <a herf="#">Test</a>
        </c:if>

Please help me. Thanks in advance.

6
  • @Nambari: really? And whoever upvoted his nonsensicial comment: really? Commented Dec 13, 2013 at 20:24
  • @BalusC: Otherwise how container knows which package Test class is in? Will remove the comment if it is non-sensicial, no issues ther.e Commented Dec 13, 2013 at 20:25
  • It's not a bean instance so you can't do that. You could decorate it with a bean. Commented Dec 13, 2013 at 20:26
  • @Nambari: OP isn't using scriptlets. Please leave that dark cave and catch up with new techniques introduced along with JSP 2.0 more than a decade ago. Commented Dec 13, 2013 at 20:27
  • @BalusC: Ok, I agree it is jstl, but how container resolve Test in this jstl case? Commented Dec 13, 2013 at 20:28

2 Answers 2

1

Check my solution ( Use Custom JSTL function ) Getting java.util.Calendar.YEAR in Spring message code

Sign up to request clarification or add additional context in comments.

Comments

0

You could add isMonitoringStarted to request/session attribute and use ${isMonitoringStarted} in your jsp.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.