0
votes
<% String qDescription = null;

if (questionList == null || questionList.isEmpty()){
    System.out.println("Empty");
}else{
    System.out.println("Retrieval successful");


        SurveyQuestionBean questionBean= (SurveyQuestionBean)questionList.get(0);
        qDescription = questionBean.getQuestionDescription();
        System.out.println("qDescription HERE: " + qDescription);

}
%>
<td>
    <textarea name="q_description" id="q_description" class="mlselect" cols='100' rows='5' ><%=qDescription%></textarea>
                        </td>       

I am trying to display the qDescription variable from the Scriptlet to the textarea. The system.out println grabs the correct data, however when i do the assignment it displays null. i understand that Scriptlet is not advisable, but i have to implement it this way. Any help will be appreciated, thank you in advance.

2
try this <textarea name="q_description" id="q_description" class="mlselect" cols='100' rows='5' value="${qDescription}" /> - SparkOn
@M.Sharma thanks for your reply, but upon putting the line of code in the whole page went disorientated. - user2505231
@user2505231 i get the data correctly if use your code and hardcode the variable - Santhosh
disoriented in the sense? - SparkOn
some textboxes i have in the page went missing, and the alignment of my textarea is off too. @M.Sharma - user2505231

2 Answers

0
votes

You have to close your else clause with a %> for jsp page to work properly.

0
votes

try this:

<%out.println(qDescription); %>