title: Getting confuse of big picture of how to work in web project
body: <p>I am trying to make a simple web app and I have completed making a register and login form. Now I have questions in my database and I wanted to display the question when the login is success and let the user to answer the question of the quiz . </p>
  
  <p>But the problem is I am new to this and I am not getting how should I work with. If anyone would help me to guide a way to do it then I would be very greatful. 
  <a href="https://i.stack.imgur.com/PjpgV.png" rel="nofollow noreferrer">this is what i have done till now </a></p>
  
  <p>In <code>Quiz.java</code></p>
  
  <pre><code>package com.quiz.model;
  
  public class Quiz {
  private int id;
  private String question;
  private String ans1;
  private String ans2;
  private String ans3;
  public int getId() {
      return id;
  }
  public void setId(int id) {
      this.id = id;
  }
  public String getQuestion() {
      return question;
  }
  public void setQuestion(String question) {
      this.question = question;
  }
  public String getAns1() {
      return ans1;
  }
  public void setAns1(String ans1) {
      this.ans1 = ans1;
  }
  public String getAns2() {
      return ans2;
  }
  public void setAns2(String ans2) {
      this.ans2 = ans2;
  }
  public String getAns3() {
      return ans3;
  }
  public void setAns3(String ans3) {
      this.ans3 = ans3;
  }
  
  }
  </code></pre>
  
  <p>QuizDaoImpl.java</p>
  
  <pre><code>public class QuizDaoImpl implements QuizDao {
  private JdbcTemplate template;
  @Autowired
  DataSource dataSource;
  public void setTemplate (JdbcTemplate template){
      this.template = template;
  }
  public List&lt;Quiz&gt; getQuestion() {
      List questionList = new ArrayList();
      String sql = "select * from question";
      JdbcTemplate template = new JdbcTemplate(dataSource);
      questionList = template.query(sql, new QuizRowMapper());
      return questionList;
  }
  
  public void insertQuestion() {
      // TODO Auto-generated method stub
  
  }
  
  }
  </code></pre>
  
  <p>QuizRowMapper.java</p>
  
  <pre><code>public class QuizRowMapper implements RowMapper{
  
  public Quiz mapRow(ResultSet rs, int row) throws SQLException {
      Quiz quiz = new Quiz();
      quiz.setId(rs.getInt("idquestion"));
      quiz.setQuestion(rs.getString("question"));
      quiz.setAns1(rs.getString("ans1"));
      quiz.setAns2(rs.getString("ans2"));
      quiz.setAns3(rs.getString("ans3"));
      return quiz;
  }
  
  }
  </code></pre>
  
  <p>HomePageController.java</p>
  
  <pre><code>@Controller
  public class HomePageController {
  
  @Autowired
  UserDaoImpl userDaoImpl;
  @RequestMapping("/register")
  public ModelAndView registerUser(@ModelAttribute user use){
      return new ModelAndView("register");
  
  }
  @RequestMapping("/insert")
  public ModelAndView successMessage(@ModelAttribute user use){
      if(use != null){
          userDaoImpl.insertData(use);
      }
      return new ModelAndView("success" ,"name", use.getuName());
  }
  @RequestMapping("/login")
  public ModelAndView getUserList(@ModelAttribute user u){
      List&lt;user&gt; userList = userDaoImpl.getData();
      int len = userList.size();
      for(int i = 0;i&lt; len ; i++){
          String userr = userList.get(i).getuName();
          if(userr.equals(u.getuName())){
              return new ModelAndView("quiz","name", u.getuName());
          }
      }
      return new ModelAndView("register");
  }
  @RequestMapping("/userSign")
  public ModelAndView getUser(String name){
  
      List&lt;user&gt; userList = userDaoImpl.getData();
      int len = userList.size();
      for(int i = 0;i&lt;len ; i++){
          String userr = userList.get(i).getuName();
          if(userr.equals(name)){
              return new ModelAndView("quiz","name", name);
          }
      }
      return new ModelAndView("error","name",name);
  }
  }
  </code></pre>