facebook

How to display the result set by jsp and the struts label

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
  • This topic has 1 reply, 2 voices, and was last updated 19 years ago by thp.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #253322 Reply

    SINODATA_QJF
    Member

    I am a chinese,I am poor of English ,but I try to show you the problem I can’t solve!I use the tools of Eclipse(Myeclipse)+Structs+Hibernate+Spring+Jboss,while I deploy the project,and click”确定“(Query),Info”No getter method for property provinceId of bean deptList” will display on the console,but I have the set && get method in my bean.my frament code as following:
    public class DeptInforListForm extends ActionForm {

    private List list;

    private String province_id;

    private String dept_id;

    private String dept_name;

    private String dept_address;

    private String dept_telephone;

    private String dept_fax;

    private String dept_chair;

    private String dept_func;

    private String dept_parent;

    private Integer dept_levels;

    public List getList() {

    return list;
    }
    public void setList(List list) {

    this.list = list;
    }

    public DeptInforListForm(){

    super();
    }
    public DeptInforListForm(LoveManageDepartment LMD){

    this.getLoveManageDepartment(LMD.getId().getProvinceId(),
    LMD.getId().getDeptId(),
    LMD.getDeptName(),
    LMD.getDeptAddress(),
    LMD.getDeptTelephone(),
    LMD.getDeptFax(),
    LMD.getDeptChair(),
    LMD.getDeptFunc(),
    LMD.getDeptParent(),
    LMD.getDeptLevels());
    }

    public void getLoveManageDepartment(String province_id,
    String dept_id,
    String dept_name,
    String dept_address,
    String dept_telephone,
    String dept_fax,
    String dept_chair,
    String dept_func,
    String dept_parent,
    Integer dept_levels){
    this.province_id=province_id;
    this.dept_id=dept_id;
    this.dept_name=dept_name;
    this.dept_address=dept_address;
    this.dept_telephone=dept_telephone;
    this.dept_fax=dept_fax;
    this.dept_chair=dept_chair;
    this.dept_func=dept_func;
    this.dept_parent=dept_parent;
    this.dept_levels=dept_levels;
    }

    public ActionErrors validate(
    ActionMapping mapping,
    HttpServletRequest request) {
    return null;
    }

    public void reset(ActionMapping mapping, HttpServletRequest request) {

    }

    /**************get and set method***************************/

    public String getProvince_id(){

    return this.province_id;
    }

    public void setProvince_id(String province_id){

    this.province_id=province_id;
    }
    public String getDept_id(){

    return this.dept_id;
    }

    public void setDept_id(String dept_id){

    this.dept_id=dept_id;
    }
    public String getDept_name() {

    return dept_name;
    }

    public void setDept_name(String dept_name) {

    this.dept_name = dept_name;
    }

    public String getDept_address() {

    return dept_address;
    }

    public void setDept_address(String dept_address) {

    this.dept_address = dept_address;
    }

    public String getDept_telephone() {

    return dept_telephone;
    }

    public void setDept_telephone(String dept_telephone) {

    this.dept_telephone = dept_telephone;
    }

    public String getDept_fax(){

    return this.dept_fax;
    }

    public void setDept_fax(String dept_fax){

    this.dept_fax=dept_fax;
    }
    public String getDept_chair(){

    return this.dept_chair;
    }

    public void setDept_chair(String dept_chair){

    this.dept_chair=dept_chair;
    }

    public String getDept_func(){

    return this.dept_func;
    }

    public void setDept_func(String dept_func){

    this.dept_func=dept_func;
    }

    public String getDept_parent(){

    return this.dept_parent;
    }

    public void setDept_parent(String dept_parent){

    this.dept_parent=dept_parent;
    }

    public Integer getDept_levels(){

    return this.dept_levels;
    }

    public void setDept_levels(Integer dept_levels){

    this.dept_levels=dept_levels;
    }
    and the JSP file is:

    <%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
    <%@ include file=”taglibs.jsp” %>

    <html>
    <head>
    <title></title>
    <body bgcolor=”white”>
    <html:form action=”/deptInforList” >
    显示全部部门:<html:submit property=”dept_button” ><bean:message key=”dept_button”/></html:submit>
    </html:form>
    <table width=”98%” border=”1″ bgcolor=”#336699″ bordercolordark=”#FFFFFF” bordercolorlight=”#A0A0A4″ cellpadding=”3″ cellspacing=”0″ >
    <tr>
    <td>省份代码</td>
    <td>部门代码</td>
    <td>部门名称</td>
    <td>部门地址</td>
    <td>部门电话</td>
    <td>部门传真</td>
    <td>部门负责人</td>
    <td>部门职能</td>
    <td>上级部门</td>
    <td>部门层次</td>
    <td>修改</td>
    </tr>
    <logic:present name=”deptInforListForm” property=”list”>
    <logic:iterate id=”deptList” name=”deptInforListForm” property=”list” >
    <tr>
    <td><bean:write name=”deptList” property=”provinceId” /></td>
    <td><bean:write name=”deptList” property=”deptId” /></td>
    <td><bean:write name=”deptList” property=”deptName” /></td>
    <td><bean:write name=”deptList” property=”deptAddress” /></td>
    <td><bean:write name=”deptList” property=”deptTelephone” /></td>
    <td><bean:write name=”deptList” property=”deptFax” /></td>
    <td><bean:write name=”deptList” property=”deptChair” /></td>
    <td><bean:write name=”deptList” property=”deptFunc” /></td>
    <td><bean:write name=”deptList” property=”deptParent” /></td>
    <td><bean:write name=”deptList” property=”deptLevels” /></td>
    </tr>
    </logic:iterate>
    </logic:present>
    </table>
    </body>
    </html>

    and my DB class is

    public abstract class AbstractLoveManageDepartment implements java.io.Serializable {

    // Fields

    private LoveManageDepartmentId id;
    private String deptName;
    private String deptAddress;
    private String deptTelephone;
    private String deptFax;
    private String deptChair;
    private String deptFunc;
    private String deptParent;
    private Integer deptLevels;

    // Constructors

    /** default constructor */
    public AbstractLoveManageDepartment() {
    }

    /** full constructor */
    public AbstractLoveManageDepartment(LoveManageDepartmentId id, String deptName, String deptAddress, String deptTelephone, String deptFax, String deptChair, String deptFunc, String deptParent, Integer deptLevels) {
    this.id = id;
    this.deptName = deptName;
    this.deptAddress = deptAddress;
    this.deptTelephone = deptTelephone;
    this.deptFax = deptFax;
    this.deptChair = deptChair;
    this.deptFunc = deptFunc;
    this.deptParent = deptParent;
    this.deptLevels = deptLevels;
    }

    // Property accessors

    public LoveManageDepartmentId getId() {
    return this.id;
    }

    public void setId(LoveManageDepartmentId id) {
    this.id = id;
    }

    public String getDeptName() {
    return this.deptName;
    }

    public void setDeptName(String deptName) {
    this.deptName = deptName;
    }

    public String getDeptAddress() {
    return this.deptAddress;
    }

    public void setDeptAddress(String deptAddress) {
    this.deptAddress = deptAddress;
    }

    public String getDeptTelephone() {
    return this.deptTelephone;
    }

    public void setDeptTelephone(String deptTelephone) {
    this.deptTelephone = deptTelephone;
    }

    public String getDeptFax() {
    return this.deptFax;
    }

    public void setDeptFax(String deptFax) {
    this.deptFax = deptFax;
    }

    public String getDeptChair() {
    return this.deptChair;
    }

    public void setDeptChair(String deptChair) {
    this.deptChair = deptChair;
    }

    public String getDeptFunc() {
    return this.deptFunc;
    }

    public void setDeptFunc(String deptFunc) {
    this.deptFunc = deptFunc;
    }

    public String getDeptParent() {
    return this.deptParent;
    }

    public void setDeptParent(String deptParent) {
    this.deptParent = deptParent;
    }

    public Integer getDeptLevels() {
    return this.deptLevels;
    }

    public void setDeptLevels(Integer deptLevels) {
    this.deptLevels = deptLevels;
    }

    Of course:other class LoveManageDepartment inherite it. And the class LoveManageDepartmentId is

    public class LoveManageDepartmentId implements java.io.Serializable {

    // Fields

    private String provinceId;
    private String deptId;

    // Constructors

    /** default constructor */
    public LoveManageDepartmentId() {
    }

    // Property accessors

    public String getProvinceId() {
    return this.provinceId;
    }

    public void setProvinceId(String provinceId) {
    this.provinceId = provinceId;
    }

    public String getDeptId() {
    return this.deptId;
    }

    public void setDeptId(String deptId) {
    this.deptId = deptId;
    }
    finally the Hibernate mapping is:

    <hibernate-mapping>
    <class name=”com.db.LoveManageDepartment” table=”love_manage_department” schema=”dbo” catalog=”love_card”>
    <composite-id name=”id” class=”com.db.LoveManageDepartmentId”>
    <key-property name=”provinceId” type=”java.lang.String”>
    <column name=”province_id” length=”2″ />
    </key-property>
    <key-property name=”deptId” type=”java.lang.String”>
    <column name=”dept_id” length=”6″ />
    </key-property>
    </composite-id>
    <property name=”deptName” type=”java.lang.String”>
    <column name=”dept_name” length=”30″ not-null=”true” />
    </property>
    <property name=”deptAddress” type=”java.lang.String”>
    <column name=”dept_address” length=”30″ not-null=”true” />
    </property>
    <property name=”deptTelephone” type=”java.lang.String”>
    <column name=”dept_telephone” length=”20″ not-null=”true” />
    </property>
    <property name=”deptFax” type=”java.lang.String”>
    <column name=”dept_fax” length=”20″ not-null=”true” />
    </property>
    <property name=”deptChair” type=”java.lang.String”>
    <column name=”dept_chair” length=”20″ not-null=”true” />
    </property>
    <property name=”deptFunc” type=”java.lang.String”>
    <column name=”dept_func” not-null=”true” />
    </property>
    <property name=”deptParent” type=”java.lang.String”>
    <column name=”dept_parent” length=”4″ not-null=”true” />
    </property>
    <property name=”deptLevels” type=”java.lang.Integer”>
    <column name=”dept_levels” not-null=”true” />
    </property>
    </class>
    </hibernate-mapping>

    Thank you!

    #253327

    thp
    Member

    I can’t see what kind of elemetns are in your list;
    It seems that they (at least one) don’t have an attribute “provinceId” / method getProvinceId();
    You should figure that out first.

    Regards

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How to display the result set by jsp and the struts label

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