title: How to be an admin? jsp page
body: <p>Good day!
  I have this assignment in programming.
  create a simple web page using jsp tomcat and mysql.
  here are the objectives:</p>
  
  <ol>
  <li>create a login/register/change password/log out box- CHECK the data saves to mysql database.</li>
  </ol>
  
  <p>2.create a CONTACT US Page, where users can write questions/problems- CHECK </p>
  
  <p>my problem:
  3.create an admin login where the admin can check the name the email the username and the problems users wrote. it is like printing the mysql database and put it inside a web page.</p>
  
  <p>here is my data:</p>
  
  <pre><code>CREATE TABLE `members` (
    `id` int(10) unsigned NOT NULL auto_increment,
    `first_name` varchar(45) NOT NULL,
    `last_name` varchar(45) NOT NULL,
    `email` varchar(45) NOT NULL,
    `uname` varchar(45) NOT NULL,
    `pass` varchar(45) NOT NULL,
    `regdate` date NOT NULL,
     problem char(250) NOT NULL
    PRIMARY KEY  (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>i was thinking of this syntax.:</p>
  
  <pre><code>&lt;%
     if ((session.getAttribute("userid") == admin) || (session.getAttribute("userid") == "")) {
     %&gt;
      &lt;a href="adminpage.jsp"&gt;click here admin&lt;/a&gt;;
      &lt;%
      }
  %&gt;
  </code></pre>
  
  <p>and i have this error:</p>
  
  <pre><code>An error occurred at line: 24 in the jsp file: /login.jsp
  admin cannot be resolved to a variable
  21: %&gt;
  22: 
  23: &lt;%
  24:    if ((session.getAttribute("userid") == admin) || (session.getAttribute("userid") == "")) {
  25:    %&gt;
  26:     &lt;a href="adminpage.jsp"&gt;click here admin&lt;/a&gt;;
  27:     &lt;%
  </code></pre>
  
  <p>could you guys help me with this? </p>
  
  <p>i just want an admin login that can have special features like check question link and when the admin will click it, it will go to a website where there is a table that has the name email and problem of the user. </p>
  
  <p>thanks</p>
  
  <p>EDIT HERE IS THE WHOLE CODE WHERE I PUT THE SYNTAX:</p>
  
  <pre><code>&lt;img src="smiley.jpg" height="50" width="1000"&gt;
  &lt;font face="calibri"&gt;
  &lt;%@ page import ="java.sql.*" %&gt;
  &lt;%
      String userid = request.getParameter("uname");    
      String pwd = request.getParameter("pass");
      Class.forName("com.mysql.jdbc.Driver");
      Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/users",
              "root", "");
      Statement st = con.createStatement();
      ResultSet rs;
      rs = st.executeQuery("select * from members where uname='" + userid + "' and pass='" + pwd + "'");
      if (rs.next()) {
          session.setAttribute("userid", userid);
          //out.println("welcome " + userid);
          //out.println("&lt;a href='logout.jsp'&gt;Log out&lt;/a&gt;");
          response.sendRedirect("success.jsp");
      } else {
          out.println("Invalid password &lt;a href='index.jsp'&gt;try again&lt;/a&gt;");
      }
  %&gt;
  
  
  
  &lt;%
  if (((String)session.getAttribute("userid").equals("admin")) &amp;&amp; (session.getAttribute("userid")!=null)) {
  %&gt;
  &lt;a href="adminpage.jsp"&gt;click here admin&lt;/a&gt;;
  &lt;%
  }
  %&gt;
  </code></pre>