Question

I am getting data into resultset and convert it RowSetDynaClass. I am passing this RowSetDynaClass in Display tag to display list. I am also using Decorator to generate dynamic link . below are code on jsp page ...

<%  RowSetDynaClass resultSetSearch = (RowSetDynaClass)request.getAttribute("rowSetSearchDyna"); %>
...
<display:table name="requestScope.resultSetSearch.rows" excludedParams="serialno status" pagesize="10" export="true" id="sessionresult" 
                               class="displayTable"  requestURI="" decorator="com.hpcfte.decorator.GraphLinkDecorator">
                    <display:column title="No."><%=pageContext.getAttribute("sessionresult_rowNum")%></display:column>
                    <display:column property="sessionid" href="graph" title="Sessionid" >

                    </display:column>
                    <display:column property="usercomment" title="Session Name" />
                    <display:column property="meterid" title="Meterid" />
                    <display:column format="{0,date,yyyy-MM-dd hh:mm:ss}" property="startdatetime" title="Start Date Time" />
                    <display:column format="{0,date,yyyy-MM-dd hh:mm:ss}" property="enddatetime" title="End Date Time" />
                    <display:column property="graph" title="Show Graph" />                          
                     <display:caption> Session Information  </display:caption>
                </display:table>

My decorator class

public String getGraph(){
       // SessionInfo sessionData = (SessionInfo)getCurrentRowObject();
      RowSetDynaClass sessionData=(RowSetDynaClass) getCurrentRowObject();
        //String showGraph  = "<a href=\"javascript:send("+sessionData.getStartDateTime()+","+sessionData.getEndDateTime()+")\"> show graph </a>";
        String showGraph  = "<a href=\"javascript:send()\"> show graph </a>";

        return showGraph;
    }

this code give error

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception: [.LookupUtil] Error looking up property "graph" in object type "com.hpcfte.decorator.GraphLinkDecorator". Cause: null

when i comment RowSetDynaClass sessionData=(RowSetDynaClass) getCurrentRowObject(); this line it working fine.

I want to access current row startdatetime and enddatetime in my decorator class. how i can do. i also tried with session info class that have corresponding filed and getter and setter method but still same error. below is session info class .

public class SessionInfo {


 private String sessionId;
 private String meterId;
 private Date startDateTime;
 private Date endDateTime;
 private String userComment;
 private boolean status;

    public Date getEndDateTime() {
        return endDateTime;
    }

    public void setEndDateTime(Date endDateTime) {
        this.endDateTime = endDateTime;
    }

    public String getMeterId() {
        return meterId;
    }

    public void setMeterId(String meterId) {
        this.meterId = meterId;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public Date getStartDateTime() {
        return startDateTime;
    }

    public void setStartDateTime(Date startDateTime) {
        this.startDateTime = startDateTime;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public String getUserComment() {
        return userComment;
    }

    public void setUserComment(String userComment) {
        this.userComment = userComment;
    }

}
Was it helpful?

Solution

I used BasicDynaBean class to get current row object.

public String getGraph(){

       // SessionInfo sessionData = (SessionInfo)getCurrentRowObject();
      BasicDynaBean sessionData=(BasicDynaBean) getCurrentRowObject();

        String showGraph  = "<a href=\"javascript:send("+ sessionData.get("startdatetime")+","+ sessionData.get("enddatetime")+")\"> show graph </a>";

   //  String showGraph  = "<a href=\"javascript:send()\"> show graph </a>";

        return showGraph;
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top