Package javango.polls.model

Examples of javango.polls.model.Choice


      context.put("error_message", "You didn't select a valid choice");
      context.put("form", form);
      return renderToResponse("javango/polls/templates/detail.ftl", context);
    }
   
    Choice selected_choice = (Choice)form.getCleanedValue(form.choice);

    int votes = selected_choice.getVotes() == null ? 0 : selected_choice.getVotes().intValue();
    selected_choice.setVotes(votes + 1);
    // due to the way hibernate works this will automatically save when the middleware commits
    return new HttpResponseRedirect("/polls/" + poll_id + "/results/");
  }
View Full Code Here


        context.put("form", form);
        return renderToResponse("src/main/webapp/templates/detail.html", context);
      }
     
      Long choice = (Long)form.getCleanedData().get("choice");     
      Choice selected_choice = modelFactory.dao(Choice.class).get(choice);
     
      if (selected_choice == null) {
        Map<String, Object> context = new HashMap<String, Object>();
        context.put("poll", p);
        context.put("error_message", "You didn't select a valid choice");
        context.put("form", form);
        return renderToResponse("src/main/webapp/templates/detail.html", context);
      } else {
        int votes = selected_choice.getVotes() == null ? 0 : selected_choice.getVotes().intValue();
        selected_choice.setVotes(votes + 1);
        // due to the way hibernate works this will automatically save when the middleware commits
        return new HttpResponseRedirect("/polls/" + poll_id + "/results/");
      }
    } catch (DaoException e) {
      throw new HttpException(e);
View Full Code Here

TOP

Related Classes of javango.polls.model.Choice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.