Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I check if variable exists in a jsp page for post in index?

well this is what I want to do. I have a website that is supposed to show post created from an Admin dashboard in index page using jsp as language, I did this in Php but I can’t find how to do it in jsp in this case, how can I check if the variable "pageno" exists to begin with?

in php is like:

if(isset($_GET['pageno'])){
$pageno = $_GET['pageno'];
}else{$pageno = 1;
}

how can I do this in jsp?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’ve been trying to search but no luck.

Thanks a bunch in advance!

>Solution :

i think you are asking about jsp java blow code will help you to check the value of variable in jsp java.

<%
boolean exist = false;
        int pageno =request.getParameter("pageno");
        if(pageno !=null){
            exist  = true;
            out.println(pageno);
        }else{
            exist = false;
            out.println("page num donot exist");
        }
    %>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading