English 中文(简体)
在java通过物体进行追踪
原标题:Travesring through an object in java

I have a method that return an object of a class.The object sets the properties of class and returns.
I have to traverse the object and get the value of the properties which the object has set before.

我试图为每个游乐器使用,但未能反向。

请允许我帮助我这样做。 提前感谢。

法典:

public class ConsumerTool {

 public MessageBean getMessages() {
        MessageBean msgBean = new MessageBean();

        msgBean.setAtmId(atmId.trim());
        msgBean.setEventText(eventText.trim());
        msgBean.setEventNumber(eventNumber.trim());
        msgBean.setSeverity(severity.trim());
        msgBean.setSubsystemID(subsystemID.trim());
        msgBean.setUniqueEventID(uniqueEventID.trim());
        msgBean.setTaskID(taskID.trim());
        msgBean.setGenerator(generator.trim());
        msgBean.setGeneratorBuildVsn(generatorBuildVsn.trim());
        msgBean.setDateTime(dateTime.trim());

        this.msgBean = msgBean;
        return msgBean;
    }
}

JavaBean阶级:

public class MessageBean implements java.io.Serializable {  

    public String dateTime;
    public String severity;
    public String eventText;
    public String eventNumber;
    public String generator;
    public String generatorBuildVsn;
    public String atmId;
    public String uniqueEventID;
    public String subsystemID;
    public String taskID;

    //System.out.println("dateTime2222222"+dateTime);

    public String getAtmId() {
        return this.atmId;
    }

    public void setAtmId(String n) {
        this.atmId = n;
    }

    public String getDateTime() {
        return this.dateTime;
    }

    public void setDateTime(String n) {
        this.dateTime = n.trim();
    }

    public String getEventNumber() {
        return this.eventNumber;
    }

    public void setEventNumber(String n) {
        this.eventNumber = n;
    }

    public String getEventText() {
        return this.eventText;
    }

    public void setEventText(String n) {
        this.eventText = n;
    }

    public String getGenerator() {
        return this.generator;
    }

    public void setGenerator(String n) {
        this.generator = n;
    }

    public String getGeneratorBuildVsn() {
        return this.generatorBuildVsn;
    }

    public void setGeneratorBuildVsn(String n) {
        this.generatorBuildVsn = n;
    }

    public String getSeverity() {
        return this.severity;
    }

    public void setSeverity(String n) {
        this.severity = n;
    }

    public String getSubsystemID() {
        return this.subsystemID;
    }

    public void setSubsystemID(String n) {
        this.subsystemID = n;
    }

    public String getTaskID() {
        return this.taskID;
    }

    public void setTaskID(String n) {
        this.taskID = n;
    }

    public String getUniqueEventID() {
        return this.uniqueEventID;
    }

    public void setUniqueEventID(String n) {
        this.uniqueEventID = n;
    }


}

The theme is the object sets the properties of javabean class and I have to get those values from UI.

Jsp

<%
MessageBean consumer = msg.getMessages();

//Now here i want to iterate that consumer object
%>
问题回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...