944,066 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 4001
  • JSP RSS
Mar 22nd, 2006
0

need HELP .jpf/weblogic/jsp - with CODE

Expand Post »
hi everybody,
i'm new in weblogic workshop/JSP/jpf.....
please help me out for the following problem.
i need to pass an Object-Array to next page.

i've 2 classes - ExamForm, Question
i've 2 jsp pages - TakeTest.jsp, PreviewTestAnswers.jsp
i've 1 pageflowcontroller - StudentController.jpf
in .jpf i've following action methods - TakeTest(), SavetakingTest(),

please see the code that i used.
and help me to get "question" with selected "answer".

to tell you more -- i was using <netui-data:repeater> to display Question with QuestionText, multiple choices (in a group radio button).
thanks in advance.


/******* ExamForm ***********/
public class ExamForm extends FormData
{
private Exam exam;
private Question[] question;
public void setExam (Exam value) { this.exam = value;}
public void setQuestion (Question[] value) { this.question = value;}
public Exam getExam (){ return this.exam;}
public Question[] getQuestion (){ return this.question;}
}
/******* Question *********/
public class Question implements Serializable
{
public String questionID;
public String questionText;
public String choiceA;
public String choiceB;
public String choiceC;
public String choiceD;
public String answer;
public Question() {}
public Question(String id,String text,String a,String b,String c,String d, String ans)
{
this.questionID = id;
this.questionText = text;
this.choiceA = a;
this.choiceB = b;
this.choiceC = c;
this.choiceD = d;
this.answer = ans;
}
public void setQuestionID(String value){ this.questionID = value;}
public void setQuestionText(String value){ this.questionText = value;}
public void setChoiceA (String value){ this.choiceA = value;}
public void setChoiceB (String value){ this.choiceB = value;}
public void setChoiceC (String value){ this.choiceC = value;}
public void setChoiceD (String value){ this.choiceD = value;}
public void setAnswer (String value) { this.answer = value;}
public String getQuestionID () { return this.questionID;}
public String getQuestionText () { return this.questionText;}
public String getChoiceA () { return this.choiceA;}
public String getChoiceB () { return this.choiceB;}
public String getChoiceC () { return this.choiceC;}
public String getChoiceD () { return this.choiceD;}
public String getAnswer () { return this.answer;}
}
/******** TakeTest.jsp *******/
<html>
<netui:form action="SaveTakingTest">
<table><tr><td><b>Select Test</b></td></tr>
<tr><td><netui-data:repeater dataSource="{actionForm.question}">
<netui-data:repeaterItem>
<tr><td><netui:hidden dataSource="{container.item.questionID}" />
<netui:label value="{container.item.questionText}" /></td></tr>
<tr><td><netui:radioButtonGroup dataSource="{container.item.answer}">
<table><tr><td><netui:radioButtonOption value="A"><netui:label value="{container.item.choiceA}" /></netui:radioButtonOption>
</td></tr>
<tr>
<td><netui:radioButtonOption value="B"><netui:label value="{container.item.choiceB}" /></netui:radioButtonOption></td>
</tr>
<tr>
<td><netui:radioButtonOption value="C"><netui:label value="{container.item.choiceC}" /></netui:radioButtonOption></td>
</tr>
<tr>
<td><netui:radioButtonOption value="D"><netui:label value="{container.item.choiceD}" /></netui:radioButtonOption></td>
</tr> </table> </netui:radioButtonGroup></td></tr>
</netui-data:repeaterItem></table></netui-data:repeater>
</td></tr> <tr> <td><netui:button value="SAVE" /></td>
</tr> </table>
</netui:form>
</html>

/******** PreviewTestAnswers.jsp ***********/
<html>
<netui:form action="SavePreviewTest">
<table>
<tr>
<td colspan="2"><b>Selected Test Answer</b></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="2">
<netui-data:repeater dataSource="{actionForm.question}">
<netui-data:repeaterHeader>
<table>
<tr>
<td>Question Text</td>
</tr>
</netui-data:repeaterHeader>
<netui-data:repeaterItem>
<tr >
<td><netui:hidden dataSource="{actionForm.question.questionID}" />
<netui:label value="{actionForm.question.questionText}" /></td>
</tr>
<tr>
<td><netui:label value="{actionForm.question.answer}" /></td>
</tr>
</netui-data:repeaterItem>
<netui-data:repeaterFooter>
</table>
</netui-data:repeaterFooter>
</netui-data:repeater>
</td>
</tr>
<tr>
<td><netui:button value="SAVE" /></td>
<td></td>
</tr>
</table>
</netui:form>

</html>
/*********** StudentController.jpf ********************/
/**
* @jpf:action
* @jpf:forward name="success" path="TakeTest.jsp"
*/
protected Forward TakeTest(ExamForm eForm) throws Exception
{
Question[] rec = dbControl.getQuestionsInTest("470CFA9C-9996-4453-ADCF-9100DDF3043B");
ExamForm exForm = new ExamForm();
eForm.setQuestion(rec);
return new Forward("success",eForm);
}

/**
* @jpf:action
* @jpf:forward name="success" path="PreviewTestAnswers.jsp"
*/
protected Forward SaveTakingTest(ExamForm dbForm)
{
/// HOW CAN I HANDLE HERE TO QUESTION + QUESTION'S ANSWER
getRequest().setAttribute("qqq",dbForm);
return new Forward("success",dbForm);
}
/**
* @jpf:action
* @jpf:forward name="success" path="StudentDefault.jsp"
*/
protected Forward SavePreviewTest(ExamForm dbForm)
{
return new Forward("success");
}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
x19dotnet is offline Offline
4 posts
since Mar 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: Help needed for weblogic/JSP/netui-tag
Next Thread in JSP Forum Timeline: JSP Homeland security level





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC