Could someone just look at this code and point out the obvious errors. It may or may not be obvious on what it is supposed to do. Never the less what I want it to do and the syntex are bad. Could someone just make observations on how to accomplish different aspects of common code practices.

<html>
    <head>
        <title>Account Number</title>
    </head>
    <body>
        <jsp:include page="creditcardCascadeStyleSheet.css" flush="true"/>
        <jsp:useBean id="fileBean" class="creditcardproject.FileBean"/>
        <jsp:useBean id="creditcardBean" class="creditcardproject.CreditCard"/>
  
      
        <h2>Account information</h2>
        
        <form action="interface.jsp" method="post">
            <input type="text" name="accttxtbox" value="Enter Account number">
            <% if(request.getParameter("createacct" != null)){%>
            <jsp:useBean id= "creditCardBean" class = "creditcardproject.CreditCard"/>
            <%long AccountNo=getNewAccount();%>
            <%accttxtbox.value(AccountNo;)%>
            <%  double CreditLimit =creditCardBean.CreditLimit; %> 
            <%  double TotalCharges =creditCardBean.TotalCharges; %> 
            <%  double TotalPayments =creditCardBean.TotalPayments; %> 
            <tr><th>Account</th><th>CreditLimit</th><th>TotalCharges</th><th>TotalPayments</th></tr>
            <tr>
                <td><%= AccountNo %></td>
                <td><%= CreditLimit %></td>
                <td><%= TotalCharges %></td>
                <td><%= TotalPayments %></td>
            </tr>                   
            <%}%>
          
            <% if(request.getParameter("existacct" != null && accttxtbox != null)){%>
            <jsp:useBean id= "creditCardBean" class = "creditcardproject.CreditCard"/>
            long AccountNo= <%= accttxtbox%>;
            <jsp:setProperty name="creditCardBean" property="CreditCard" param="AccountNo"/>
            
            <%  long CreditLimit =creditCardBean.AccountNo; %> 
            <%  double CreditLimit =creditCardBean.CreditLimit; %> 
            <%  double TotalCharges =creditCardBean.TotalCharges; %> 
            <%  double TotalPayments =creditCardBean.TotalPayments; %> 
            <tr><th>Account</th><th>CreditLimit</th><th>TotalCharges</th><th>TotalPayments</th></tr>
            <tr>
                <td><%= AccountNo %></td>
                <td><%= CreditLimit %></td>
                <td><%= TotalCharges %></td>
                <td><%= TotalPayments %></td>
            </tr>                   
            <%}%>
            <select name="action">
                <option value="charge">New Charge</option>
                <option value="payment">Make payment </option>           
            </select>
            <br><br>
            <input type="submit" name="number" value="Submit">
        </form>
  
    </body>
</html>

Recommended Answers

All 2 Replies

Ideally there should be 'zero' Java code in your JSP file. Use JSTL's instead which help in separating the business and presentation to a greater extent. A brief tutorial here.

Thanks. Back to the drawing board.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.