This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Method getWriter() is undefined HttpServlet  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

package com.coursecube.servlets;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

public class LoginServlet extends HttpServlet{
public void service(HttpServletRequest req, HttpServletRequest res)throws ServletException,IOException{
   
//1.Collecting Data
String un = req.getParameter("uname");
String pw = req.getParameter("pword");
String msg="";

//2.Process

if(un.equals(pw)){
       msg="Login Sucees
Welcome to JLC Home page";
}
else{
msg="Login Failed
Invaild Username or Password";
}

   
//3.Preparing The Response:
   PrintWriter out = res.getWriter(msg);
}
}





 
 
Rancher
Posts: 3921
45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getWriter does not take a parameter.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the 3rd step you should be doing -
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!