Hi, The problem is solved.
BR Rafal Dnia 28-12-2009 o godz. 16:53 Rafał Laczek <rafal_lac...@wp.pl> napisał(a): > Hi, > I have prepared test application where after the log in the user can > choose from combo box the country and then the chosen country is added > to arraylist. > Combobox is in html page and business logic and presentation layer are > in JSP. > Now I want to refactor the project in order the business logic to be > included in Serwlet and presentation layer will be in JSP. > I would like to ask you to point me and advise me how to do that in most > professional way. > Bellow I give you the files: > FORM.HTML > <body> > <h3 style='font-size:40px' align='center';>Test Application</h3> > <pre> > <form action="result.jsp" method="get"> > <p>First name <input type="text" name="firstName" /></p> > <p>Surname <input type="text" name="surname" /></p> > Male<input type="radio" name="sex" value="male" /> > Female<input type="radio" name="sex" value="female" /><br> > Preferable country to live <select name="countryType"> > <option value="poland">Poland</option> > <option value="norway" selected>Norway</option> > <option value="hungary">Hungary</option> > <option value="vietnam">Vietnam</option> > <option value="uk">UK</option> > <option value="france">France</option> > </select> > <p><input type="submit" /></p> > </form> > </pre> > </body> > > RESULT.JSP > <body> > <h3 style='font-size:40px' align='center';>Test Application</h3> > > <%ArrayList arraylist = (ArrayList)session.getAttribute("arraylist"); > > if(arraylist == null){ > arraylist = new ArrayList(); > session.setAttribute("arraylist",arraylist); > } > > String firstName = request.getParameter("firstName"); > String surname = request.getParameter("surname"); > String sex = request.getParameter("sex"); > String countryType = request.getParameter("countryType"); > if(firstName !=null && surname !=null){ > Testapplication.Person person1 = new Testapplication.Person(); > person1.setFirstName(firstName); > person1.setSurname(surname); > person1.setSex(sex); > person1.setCountryType(countryType); > //The object person1 is added to arraylist > arraylist.add(person1); > } > > out.println("The list contains " +arraylist.size()+ " persons"); > %> > > <div class="results"> > <table border="1"; style="height: 40px;width: 500px; background:white;" > > <tr><th colspan="5"><strong>Results:</strong></th></tr> > <tr> > <td><strong>First name</strong></td> > <td><strong>Surname</strong></td> > <td><strong>Sex</strong></td> > <td><strong>Country</strong></td> > </tr> > > <%/*ListIterator it = arraylist.listIterator(); > while (it.hasNext()){ > Person person =(Person)it.next();*/%> > > <% for (Iterator it = arraylist.iterator(); it.hasNext();){ > Person person =(Person)it.next();%> > > <tr> > <td> > <% out.println(person.getFirstName());%> > </td> > <td> > <%out.println(person.getSurname());%> > </td> > <td> > <%out.println(person.getSex());%> > </td> > <td> > <%out.println(person.countryType());%> > </td> > </tr> > <%}%> > </table> > > <br/><input type=button value="Add new > record"onClick="document.location='form.html'"> > </div> > </body> > > ---------------------------------------------------- > Weź udział w badaniu, > zgarnij nagrody: > http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fpentagon24.html&sid=940 > > > -- > You received this message because you are subscribed to the Google > Groups "Java EE (J2EE) Programming with Passion!" group. > To post to this group, send email to > java-ee-j2ee-programming-with-passion@googlegroups.com > To unsubscribe from this group, send email to > java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en ---------------------------------------------------- Zobacz jak Renifer czyta życzenia bożonarodzeniowe! Wybierz swoją postać i wyślij życzenia! http://klik.wp.pl/?adr=http%3A%2F%2Fspeakingsanta.com%2F&sid=936 -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en