Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,581 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,518 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Calling jsp page from servlet

 
Reply to this topicStart new topic

Calling jsp page from servlet

sukahati
post 10 May, 2008 - 04:32 AM
Post #1


New D.I.C Head

*
Joined: 10 May, 2008
Posts: 2

Hi,
How to call jsp page from a servlet?
Please refer to my code below. I'm using response.sendRedirect("/surf.jsp"); but it doesnt work. Please help

CODE

import java.io.*;
import java.lang.*;
import java.util.Enumeration;

import javax.servlet.*;
import javax.servlet.http.*;

public class OpenOption extends HttpServlet {
    Parser parser;
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
      String option = new String();
        
    PrintWriter out = response.getWriter();
    
    
    option = request.getParameter("selectedOption");  
    if (option == "surfthenet"){
        response.sendRedirect("/surf.jsp");
    }
  }
  public void doPost(HttpServletRequest request,
          HttpServletResponse response)
          throws ServletException, IOException {
          doGet(request, response);
  }
  
  }
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/8/08 12:35AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month