protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
//			HttpSession session = request.getSession();
					
		try {
			Date today = new Date();
	        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
	        
	        String username = (String) request.getSession().getAttribute("username");
			String content = request.getParameter("newpost");
			String date = sdf.format(today);
			
			String file;
			String path = System.getenv("OPENSHIFT_DATA_DIR");
		      if (path == null) {
		         file = getServletContext().getRealPath("./post.txt");
		      } else {
		         file = path + "./post.txt";
		      }
			
			Post newPost = new Post(date, username, content);
			PostList postList = new PostList(file);
			postList.addPostToFile(newPost);
			
			ArrayList<Post> currentList = postList.getPostList();
			request.setAttribute("postList", currentList);
			
			System.out.println("Post List: " + postList.toString());

			request.getRequestDispatcher("viewposts.jsp").forward(request, response);
//			response.sendRedirect("viewposts.jsp");
		} catch (Exception e) {
			System.out.println("Error: " + e.getMessage());
		}

		
	}