You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christophe Rikelynck <CR...@vdab.be> on 2001/09/25 12:18:54 UTC

request.setAttribute("variable", value) bug

I have an action class "BeforeSelectQuestionAction.java" where I get all questions from the database and put them to the request with request.setAttribute("questions", questions).

When i surf to "BeforeSelectQuestion.do" there is no problem and in the jsp page that follows I see all questions in the select box.
In the select box, i added an option "Select question" that is default selected, so that the user just doesn't click the submit button.

When this option is selected and submitted to the "SelectQuestionAction.java" action class, this one will forward again to BeforeSelectQuestion.do, where again all questions are put to the request. But in the jsp page that follows "BeforeSelectQuestionAction.java" (the one where I select a question), the bean "questions" is null.

When i surf directly to the action class, there is no problem, but when I select the default option "Select question" I receive an error that tells that the bean "questions" is null. What is the problem?

Everything works fine when i use HttpSession, but I want to use request.getParameter and request.setParameter.

Can anyone help me? Thanks.


RE: request.setAttribute("variable", value) bug

Posted by Hans Gilde <hg...@environments.com>.
Sounds like a logic problem, are you sure that the logic in the action class
isn't branching around the part where it adds the questions? Maybe if you
send your code...

-----Original Message-----
From: Christophe Rikelynck [mailto:CRIKELYN@vdab.be]
Sent: Tuesday, September 25, 2001 6:19 AM
To: <struts-user
Subject: request.setAttribute("variable", value) bug


I have an action class "BeforeSelectQuestionAction.java" where I get all
questions from the database and put them to the request with
request.setAttribute("questions", questions).

When i surf to "BeforeSelectQuestion.do" there is no problem and in the jsp
page that follows I see all questions in the select box.
In the select box, i added an option "Select question" that is default
selected, so that the user just doesn't click the submit button.

When this option is selected and submitted to the
"SelectQuestionAction.java" action class, this one will forward again to
BeforeSelectQuestion.do, where again all questions are put to the request.
But in the jsp page that follows "BeforeSelectQuestionAction.java" (the one
where I select a question), the bean "questions" is null.

When i surf directly to the action class, there is no problem, but when I
select the default option "Select question" I receive an error that tells
that the bean "questions" is null. What is the problem?

Everything works fine when i use HttpSession, but I want to use
request.getParameter and request.setParameter.

Can anyone help me? Thanks.