| | |
need HELP .jpf/weblogic/jsp - with CODE
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Solved Threads: 0
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");
}
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");
}
![]() |
Similar Threads
- jsp,eclipse and weblogic server (JSP)
- can any one send me a jsp source code of an e-banking project (JSP)
- jsp not running & can't view the jsp source code on tomcat (JSP)
- can any one send me a jsp source code of an e-banking project (JSP)
- <jsp:include> Not Printing On Web Page, But In Source Code (JSP)
- Help needed for weblogic/JSP/netui-tag (JSP)
Other Threads in the JSP Forum
- Previous Thread: Help needed for weblogic/JSP/netui-tag
- Next Thread: JSP Homeland security level
| Thread Tools | Search this Thread |
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient project read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write





