<!doctype html>
<html>
<% 
String bgColor = request.getParameter("bgColor");
String thefont = request.getParameter("thefont");
if ((bgColor == null) || (bgColor.trim().equals(""))) { 
  bgColor = "WHITE"; 
  thefont="serif";
} 
%>
<head>
<title>Testing Styles</title>
<style>
body {
    background-color: <%= bgColor %>;
    font-style: <%= thefont%>;
}
</style>

</head>
<body>
<h1 ALIGN="CENTER">Testing Colors and Font Styles</h1>
<hr />
<%
if(bgColor.equals("WHITE")){
%>
<form>
   Color:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input TYPE="TEXT" NAME="bgColor"><br />
   &nbsp;<br />
   Font Style:&nbsp;&nbsp;
   <select TYPE="TEXT" NAME="thefont" >
      <option value="normal">normal</option>
      <option value="italic">italic</option>
   </select>
   <br />
   &nbsp;<br />
   <input TYPE="SUBMIT" VALUE="Try the Style">
<%
}else{
%>
   <h1>Do You like the Background Color  <%= bgColor %> and Font <%= thefont%>?
   <form>
      <input TYPE="SUBMIT" VALUE="Try Another">
   </form>
<%
} 
%>
</body>
</html>

colorfont.jsp