Write an HTML web form and the accompanying servlet for a login

```


Login



Please login:


Name:


Password:








```


```
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Login extends HttpServlet {

public void doPost (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
//The content type of the response body
// should be set first
res.setContentType("text/html");

//Get an output stream to write the response body
ServletOutputStream out = res.getOutputStream();
String homepage = "http://www.csc.calpoly.edu/~mliu/",
name = null, password=null;
String theName = "lucky", thePassword="12345";

name = req.getParameter("name").trim( );
password = req.getParameter("password").trim( );

if (name.equals(theName) && password.equals(thePassword))
out.println(" "=\"REFRESH\" CONTENT=\"0;URL=" + homepage
+ "\">\n");
else
out.println("

Sorry, invalid account "+
" information

");

}
} //end class
```

Computer Science & Information Technology

You might also like to view...

Suppose that, at compile time, the application programmer knows all of the details of the SQL statements to be executed, the DBMS to be used, and the database schema. Explain the advantages and disadvantages of using embedded SQL as compared with JDBC or ODBC as the basis for the implementation.

What will be an ideal response?

Computer Science & Information Technology

VSTO can place objects on a new or existing Word document.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A(n) ____________________ is an organizational folder that includes multiple actions, and can be opened or expanded by clicking the triangle to the left of the set.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A procedure in an application needs to store tax rate data. The county of residence and the tax rate need to be stored. Write the appropriateDimstatements to declare the variables. Write an assignment statement that assigns .08 to the tax rate variable.

What will be an ideal response?

Computer Science & Information Technology