I don’t want to declare those variables in Action class again
Employee POJO:
package com.pojo;
import java.io.Serializable;
public class Employee{
String name;
Address address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
AddressPOJO:
package com.pojo;
import java.io.Serializable;
public class Address{
String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
JSP:
<body>
<s:form action="beanEx">
<s:textfield label="name" name="name"/>
<s:textfield label="email" name="email"/>
<s:submit value="Submit"/>
</s:form>
</body>
I want to populate the values automatically set the values in Action class
Can anybody help me out……..
Have two objects in your action class with getter/setter
then in your jsp do like this:
Basically earlier you were pointing to the field now you are pointing to the field inside an object.