|
Up
Design
About
Screen shots
public class ChordManServlet extends HttpServlet { static final long serialVersionUID = 1L; public ChordManServlet() { super(); } public void init(ServletConfig config) throws ServletException { super.init(config); } public void destroy() { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { doGet(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // get/set a string table for the user ResourceBundle stringTable = Utils.getStringTable(request); // check for a current chord list... HttpSession session = request.getSession(); ArrayListchordList = (ArrayList )session.getAttribute("chordList"); // and create a new one if necessary if (chordList == null) { // create a new chord list chordList = new ArrayList (); // and store it in the session context session.setAttribute("chordList", chordList); // the chord list should contain one chord (for now) Chord chord = new Chord(); chordList.add(chord); } // set a default status message request.setAttribute("statusMsg", " "); // read any incoming parameters // (back from NewChordDescServlet) String tuning = request.getParameter("tuning"); String style = request.getParameter("style"); // add the params to the session chord Chord chord = (Chord)chordList.get(0); if (tuning != null) chord.setTuningName(tuning); if (style != null) chord.setStyleName(style); // include common header stuff request.setAttribute("title", "Chord Manager"); // include status line processing RequestDispatcher dispatcher = request.getRequestDispatcher("/status"); if (dispatcher != null) dispatcher.include(request, response); // forward to the view dispatcher = request.getRequestDispatcher("index.jsp"); if (dispatcher != null) dispatcher.forward(request, response); } public String getServletInfo() { return "Root ChordMan servlet"; } }