Change Background and Foreground Color using Servlet

      Comments Off on Change Background and Foreground Color using Servlet

.Change Background and Foreground Color using Servlet

Change Background and Foreground Color using Servlet

Change Background and Foreground Color using Servlet tutorial includes step by step guide to learn  how you can change background color and foreground color of the Servlet based of the request from the user.

Here we will create one index page for the selection of the foreground color and background. User will select color and click on submit button. On click on submit button we have to redirect user to the Servlet, which will select foreground color and background color based on the request.

 

File: index.jsp

<html>
<head><title> Change Background and Foreground Color using Servlet</title> </head>
        <body>
                <form method="get" action="./ColorGeneratorServlet">
                        Back Color 
                        
                        <select name="bc">
                                <option value="red"> Red </option>
                                <option value="green"> Green </option>
                                <option value="blue"> Blue </option>
                        </select>
                                
                        <br>
                        Fore Color 
                        
                        <select name="fc">
                                <option value="red"> Red </option>
                                <option value="green"> Green </option>
                                <option value="blue"> Blue </option>
                                                                            
                        </select>
                                
                        <br>
                        
                        <input type="submit" value="Go">
                </form>
        </body>
</html>

 

Continue Reading…