User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 456,593 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,520 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1152 | Replies: 2 | Solved
Reply
Join Date: Aug 2007
Posts: 184
Reputation: ceyesuma is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Junior Poster

jsp code

  #1  
Sep 6th, 2007
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>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,012
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: jsp code

  #2  
Sep 7th, 2007
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.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Aug 2007
Posts: 184
Reputation: ceyesuma is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Junior Poster

Re: jsp code

  #3  
Sep 8th, 2007
Thanks. Back to the drawing board.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 6:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC