Can you destroy a java bean?

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #248987 Reply



    I’m new to JSP and I tried to create this web application which simply echoes user request info back.

    The helper class User is defined as :

    package com.apress.faq;

    public class User {
    private String firstName;
    private String surname;
    private String loginName;
    private int age;

    public String getFirstName() {return firstName;}
    public void setFirstName(String newFirstName) {this.firstName = newFirstName; }

    public String getSurname() {return surname; }
    public void setSurname(String newSurname) {surname = newSurname; }

    public String getLoginName(){return loginName;}
    public void setLoginName(String newLoginName) {loginName = newLoginName;}

    public int getAge(){return age;}
    public void setAge (int newAge) {age = newAge;}

    The welcome.jsp file first displays a form for the user to enter their first name, surname, login and age. The form then passes the request to “processing_page.jsp” which looks like this (NB. I have only included a fragment):

    if((user.getFirstName() == null)||(user.getSurname()==null)||(user.getLoginName()== null)||(user.getAge()== 0) ) {
    <p> You have not filled out the registration form parameters.<p>
    <br><p> <a href=”welcome.jsp”>Please return to the welcome page and fill out the required
    } else {
    <jsp:forward page =”welcome.jsp”>
    <jsp:param name=”form_complete” value=”true”/>

    It appears to work fine, for the most part, but what I’, finding is that if I don’t place all the values into the form, I get redirected to the code which states that the registration form has not been completed, sent back to welcome.jsp, but for some reason, the user attributes don’t change value. Can a bean’s values not change ? It doesn’t seem to want to pick up the new values in the form when resubmitted.

    #249027 Reply

    Riyad Kalla

    Moving to OT > Soft Dev

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Can you destroy a java bean?

You must be logged in to post in the forum log in