new_2_java -3 Junior Poster

Hello all,

I have an index.jsp that has 3 frames [banner, menu, main]. My menu options are in "menu" frameset, and when I click on a menu option, it calls the servlet, then based on that, it does some processing in my servlet, and forward the request/response to specific JSP.

My index.jsp looks something like this. I need to display all the contents in main frame.

|               banner           |
|home    |                       |
|about   |      main             |
|contact |                       |

The problem is that the JSP is displayed in menu frameset from where the servlet is called, as opposed to main. How can I specify [or force] the calling JSP to be displayed in "main" frame, as opposed to calling fram [menu]?

Here's my menu.jsp that's loaded in menu fram:

<form id="mnu" action="../mainServlet" method="POST" enctype="multipart/form-data">
<input type="submit" name ="btnHome" value="Home" class="btn" />
<input type="submit" name ="btnAbout" value="About" class="btn" />
<input type="submit" name ="btnResource" value="Resource" class="btn" />
<input type="submit" name ="btnContact" value="Contact" class="btn" />

And here's my servlet:

public class MainServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        if (request.getParameter("btnContact") != null) {
            RequestDispatcher rd = request.getRequestDispatcher("/jsp/contact.jsp");
            rd.forward(request, response);
        } else if (request.getParameter("btnHome") != null) {
        } else if (request.getParameter("btnAbout") != null) {
        } else {
        RequestDispatcher rd = request.getRequestDispatcher("/jsp/contact.jsp");
        rd.forward(request, response);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.