Free Data Structures and Algorithms Course









Subscribe below and get all best seller courses for free !!!










OR



Subscribe to all free courses

"Online Tweeter Enterprise Application" : Creating a JSP page in NetBeans Web module - Part 6

Lets continue building "Online Tweeter Enterprise Application" in NetBeans. In this section of tutorial, you will create a Java Server Pages (JSP) by name "tweets.jsp". A JSP page is like a User Interface for Web Application. Its like a dynamic web page having html with java embedded into it.

Step 1:
Open "Tweeter-war" project and right click Web Pages and then select New and than Other as shown in fig below.





Step 2: On clicking Other a dialog box appears by name New File. In the Categories: list select Web and in the File Types: select JSP as shown in fig below.




Step 3: Click

.
New JSP dialog box gets open. It prompts us to enter values for the File Name: , Project: , Location: , Folder: , Created File: and Options: .Enter the required values as per fig shown below.




Step 4: Click




 

A new jsp page gets created by the name tweets.jsp in the "Tweeter-war" module.Kindly add or remove additional code provided below. 

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <title>Tweeter</title>
    </head>
    <body>
        <table border="0" bgcolor="aquagreen" cellpadding="0" cellspacing="0" width="60%">
            <tr>
                <td>
                    <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td valign="middle" align="center" style="padding-right:0px; padding-left:0px; padding-bottom:0px; font:24px/30px Georgia; width:228px; color:#FFFFFF; padding-top:0px; height:37px;">
                                What's happening ?. !!!
                            </td>
                        </tr>
                    </table>                    
                </td>
            </tr>
            <tr align="left" valign="top">
                <td height="20">
                    <hr />
                </td>
            </tr>
            <tr>
                <td>
                    <form name="tweetsForm" action="TweetsSubmit" method="post">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td align="right" valign="top">
                                    UserName:
                                </td>
                                <td>
                                    <input type="text" name="txtUsername" size="50" maxlength="75"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <br/>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" valign="top">
                                    Your Tweet:
                                </td>
                                <td>
                                    <textarea name="txtTweet" cols="38" rows="6"></textarea> 
                                </td>                                    
                            </tr>
                            <tr align="left">
                                <td height="20">
                                    <hr />
                                </td>
                                <td height="20">
                                    <hr />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="left">
                                    <input type="submit" value="Tweet" />
                                </td>
                            </tr>
                        </table>
                    </form>
                </td>
            </tr>            
        </table>
    </body>
</html>



Output of the jsp on browser window : 


tweets.jsp is a simple web page having few html components which prompts user to enter UserName , Tweet he/she wants to publish and than click on Submit button.  

In the next section of this blog (part 7) you will learn how to create a Singleton Session Bean in NetBeans for this application in the Web module. 
 
© 2021 Learn Java by Examples Template by Hubberspot