Package models

Examples of models.Feedback


                String comment = new String();

                if(servletPath.equals("/feedbacks/save")) {
      if(session.getAttribute("user") != null) {

                           Feedback feedback = new Feedback();

         MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                           feedback.setFromId(new Integer(multi.getParameter("newFromUser")));
                           feedback.setToId(new Integer(multi.getParameter("newToUser")));

                           String mode = multi.getParameter("commMode");

                           if(mode.equals("text")) {
                                feedback.setText(multi.getParameter("newTextComm"));
                           }
                           else if(mode.equals("file")) {

                               File f = multi.getFile("newFileComm");

                               if( f != null ) {
                                    InputStream in = new FileInputStream(f);
                               try {


                                           BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                                           String line = null;
                                           while ((line = reader.readLine()) != null) {

                                           comment += line;

                                           }
                                    } catch (IOException e) {

                                    } finally {

                                        if (in != null) in.close();
                                    }
                               }
                           feedback.setText(comment);
                           }
                          feedback.setScore(new Integer(multi.getParameter("newScore")));
                          feedback.save();
                        }
                }

                response.sendRedirect(request.getContextPath());
View Full Code Here


    else if(servletPath.equals("/admin/feedbacks/edit")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {
        page += "_edit";

        String[] tokens = request.getRequestURI().split("/");
         Feedback feedback = Feedback.getById(new Integer(tokens[tokens.length - 1]));
                                 List<User> users = User.getAll();
         request.setAttribute("feedback", feedback);
                                 request.setAttribute("users", users);
                        }
    }
View Full Code Here

                String comment = new String();

                if(servletPath.equals("/admin/feedbacks/save")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {

                           Feedback feedback = new Feedback();

         MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                           feedback.setFromId(new Integer(multi.getParameter("newFromUser")));
                           feedback.setToId(new Integer(multi.getParameter("newToUser")));

                           String mode = multi.getParameter("commMode");

                           if(mode.equals("text")) {
                                feedback.setText(multi.getParameter("newTextComm"));
                           }
                           else if(mode.equals("file")) {

                               File f = multi.getFile("newFileComm");

                               if( f != null ) {
                                    InputStream in = new FileInputStream(f);
                               try {


                                           BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                                           String line = null;
                                           while ((line = reader.readLine()) != null) {
                                   
                                           comment += line;
                                   
                                           }
                                    } catch (IOException e) {
                                      
                                    } finally {
                                   
                                        if (in != null) in.close();
                                    }
                               }
                           feedback.setText(comment);
                           }
                          feedback.setScore(new Integer(multi.getParameter("newScore")));
                          feedback.save();
                        }
                }
                else if(servletPath.equals("/admin/feedbacks/update")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {

                           Feedback feedback = new Feedback();

         MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                           feedback.setId(new Integer(multi.getParameter("editId")));
                           feedback.setFromId(new Integer(multi.getParameter("editFromUser")));
                           feedback.setToId(new Integer(multi.getParameter("editToUser")));

                           String mode = multi.getParameter("commMode");

                           if(mode.equals("text")) {
                                feedback.setText(multi.getParameter("editTextComm"));
                           }
                           else if(mode.equals("file")) {

                               File f = multi.getFile("editFileComm");

                               if( f != null ) {

                                   InputStream in = new FileInputStream(f);

                                    try {


                                           BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                                           String line = null;
                                           while ((line = reader.readLine()) != null) {

                                           comment += line;

                                           }
                                    } catch (IOException e) {

                                    } finally {

                                        if (in != null) in.close();
                                    }
                               }
                           feedback.setText(comment);
                           }
                          feedback.setScore(new Integer(multi.getParameter("editScore")));
                          feedback.update();
                        }
                }

                response.sendRedirect(request.getContextPath() + "/admin/feedbacks");
View Full Code Here

TOP

Related Classes of models.Feedback

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.