Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please Needed with Struts Tags  RSS feed

 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
I am new to Struts Please help me out with this

I have these varibles in QuestionFlow class
private String oid = null;
private Integer positionNumber = null;
private Integer sectionNumber = null;
private String activeInd = null;
private Question question = null;

I have these variable in Question class
private String oid = null;
private String questionDescription = null;
private QuestionType type = null;
private String questionText = null;
private Collection questionValues = null;

My Action class code returns a collection of QuestionFlow and i am setting this collection to request.setAttribute() method

Collection questionFlows = section.getQuestionFlows();
request.setAttribute("questions", questionFlows );

My JSP code looks like this

<logic resent name="questions">
<logic:iterate id="question" name="questions" >

<bean:write name = "question" property = "positionNumber" />
<bean:write name = "question" property = "sectionNumber" />
<bean:write name = "question" property = "question.questionText" />
<bean:write name = "question" property = "question.type" />

</logic:iterate>
</logic resent>

My Question is How do i get the value of question oid?? If i say <bean:write name = "question" property = "question.oid" /> its printing the oid of QuestionFlow class?
and if i write

<bean efine id="quest" name="quest" property="question.question"/>
<bean:write name = "quest" property = "oid"/>

then it throws this error
javax.servlet.jsp.JspException: No getter method for property: "oid" of bean: "quest"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:986)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:225)
at org.apache.jsp.pages.QuestionList_jsp._jspx_meth_bean_write_4(org.apache.jsp.pages.QuestionList_jsp:339)
at org.apache.jsp.pages.QuestionList_jsp._jspService(org.apache.jsp.pages.QuestionList_jsp:156)
.......................................

Please Help me,
Thanks...
 
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you just printing the attribute? Why not give EL a try? If you have set the bean to request.setAttribute("question", questionBean)... You can simple call the attributes like this...

The question is ${question.oid}


does that help?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!