On 6/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello,
I am having some problems with getting a session attribut in my JSP.
A have a JSP where the user can make a search based on information he must
enter in a form.
The result of the search must be displayed in a table.
To display the result I do:
<logic:notEmpty name="cautionVOs" scope="session">
<tr>
<td>
<div style="overflow:auto; height:100px;">
<table class="result">
<logic:iterate id="cautionVOs" name="remPayVO" type="RemPayVO">
<tr>
<td><html:radio styleClass="radio" name="remPayVO"
property="paymentId"
value="<%=
remPayVO.getPaymentId().toString() %>"
onclick="forward
('prepare','/modifycautionmanagement.do','ModifyCautionForm');waiting();"
/>
</td>
<td><bean:write name="remPayVO" property=
"dateModifStatut" /></td>
<td><bean:write name="remPayVO" property="modePay"
/></td>
<td><bean:write name="ModifyCautionForm" property=
"compteFacturation" /></td>
<td><bean:write name="remPayVO" property="montant"
/></td>
<td><bean:write name="remPayVO" property=
"commentaire" /></td>
</tr>
</logic:iterate>
</table>
</div>
</td>
</tr>
</logic:notEmpty>
The problem is that I get the error javax.servlet.jsp.jspException: No
Collection found, and i think i get it with <logic:notEmpty name=
"cautionVOs" scope="session">
Here is a piece of my Action class:
*****
ModifyCautionForm modifyCautionForm = (ModifyCautionForm)form;
errors = modifyCautionForm.validate(mapping, request);
purgeSession(request);
RechercheCautionVO rechercheCautionVO = new RechercheCautionVO();
rechercheCautionVO.setCompteFacturation(modifyCautionForm.getCompteFacturation
());
rechercheCautionVO.setPaymentMethod(modifyCautionForm.getModePay());
rechercheCautionVO.setMontant(modifyCautionForm.getMontant());
rechercheCautionVO.setDate(date);
rechercheCautionVO.setPaymentID(modifyCautionForm.getPaymentID());
rechercheCautionVO.setBanque(modifyCautionForm.getBanque());
rechercheCautionVO.setAgence(modifyCautionForm.getAgence());
rechercheCautionVO.setCompte(modifyCautionForm.getCompte());
rechercheCautionVO.setNumPiece(modifyCautionForm.getNumPiece());
Collection cautions = null;
try {
PaymentDelegate payDelegate = new PaymentDelegate();
cautions = payDelegate.getAccountCaution(rechercheCautionVO);
log.debug("*** cautions size " + cautions.size());
log.debug("*** cautions is empty? " + cautions.isEmpty());
request.getSession().setAttribute( SESSION_REMPAYVOS, cautions);
Collection col = (Collection)request.getSession
().getAttribute(SESSION_REMPAYVOS);
log.debug("*** cautions is empty? " + col.isEmpty());
modifyCautionForm.setCautionVOs(cautions);
Iterator it = modifyCautionForm.getCautionVOs().iterator();
while(it.hasNext()){
RemPayVO rpVO = (RemPayVO)it.next();
log.debug("paymentID: " + rpVO.getPaymentId());
}
****
(SESSION_REMPAYVOS = "cautionVOs")
When I look at the log I can verify that cautions is not null, and neither
is the session attribute.
But if i add
<% Collection col = (Collection)request.getSession().getAttribute(
"cautionVos"); %>
in my JSP right before
<logic:notEmpty name="cautionVOs" scope="session">
I get a java.lang.NullPointerException
Somewhere between my action class and my jsp the session attribute is set
to null.
Are you sure that it is the <logic:notEmpty> that is causing the
problem? The reason I'm asking is that your <logic:iterate> doesn't
seem to tie up with what you have in <logic:notEmpty> and doesn't
match what you say your session attribute is. Looks to me like you
have the "id" and "name" attributes the wrong way round - should be:
<logic:iterate name="cautionVOs" id="remPayVO" type="RemPayVO">
Niall
Does anyone have some idea of what is happening??
Thanks in advance!!
Marianne
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]