0

I am in the middle of learning jsf.

 <form action="addStatus" method="GET">

I have a jsf page that passes this form into "addStatus for processing"

The code as follow:

<%--
file: AddCustomer.jsp--%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>SecondBankWEB AddCustomer.jsp</title>    </head>
<body>
    <h1>AddCustomer JSP Page</h1>
    <form action="addStatus" method="GET">
        <table>
            <tr>
                <td align="right">Name:</td>
                <td align="left"><input type="text" name="name" length="30"/></td>                    
            </tr>
            <tr>
                <td align="right">Password:</td>
                <td align="left"><input type="text" name="password" length="30"/></td>                    
            </tr>
            <tr>
                <td align="right">Postal:</td>
                <td align="left"><input type="text" name="postal" length="30"/></td>                    
            </tr>

             <tr>
                <td align="right">Phone: </td>
                <td align="left"><input type="text" name="phone" length="30"/></td>                    
            </tr>

             <tr>
                <td align="right">Email: </td>
                <td align="left"><input type="text" name="email" length="30"/></td>                    
            </tr>
        </table>
        <p><input type="submit" value="Submit"/></p>




    </form>

</body> </html>

and this is the AddStatus.jsf

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>SecondBankWEB AddStatus.jsp</title>
</head>
<body>

    <%
        ArrayList data = (ArrayList)request.getAttribute("data");
    %>

     <table>
        <tr>
            <td align="right">Name:</td>
            <td align="left"><%= (String)data.get(0)%></td>                    
        </tr>
        <tr>
            <td align="right">Password</td>
            <td align="left"><%= (String)data.get(1)%></td>                    
        </tr>


    </table>


    <p>Status: <%= (String)data.get(3)%></p>
    <br>
    <font color=navy>
        <hr>
        <h1>Select Choice <br><br>
            <a href="addCustomer"> Add a Customer</a><br><br>
            <a href="listCustomers"> List customers</a>
        </h1>
     </font> -->
</body>

However, when ever i hit the submit button, i will be redirected the addstatus page which does not display a single thing. What am i doing wrong here?

Aritz
  • 30,971
  • 16
  • 136
  • 217
user2760642
  • 137
  • 1
  • 9
  • it displays this as url "http://localhost:8080/SHS-war/SHS/addStatus?name=xccxc&password=ccx&postal=cxcx&phone=xccx&email=xccx" which looks correct but the page is empty. (not content loaded) – user2760642 Mar 22 '14 at 10:12
  • 1
    While you've a form to submit (data to send to the server side), you should make the transfert's method `POST` instead of `GET`. – Omar Mar 22 '14 at 11:30
  • 1
    Which JSF version are you dealing with? The use of scriptlets is totally discouraged and deprecated since 2.0: http://stackoverflow.com/questions/12330934/how-do-i-embed-java-code-inside-jsf-page – Aritz Mar 22 '14 at 12:47
  • Is it intentional that the second source code finishes with end of comment? --> – Leos Literak Mar 22 '14 at 14:24

0 Answers0