You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ma...@bull.net on 2007/06/15 09:43:41 UTC
Réf. : Re: No Collection Found problem
Hello Niall,
Actually I did a mistake when i wrote my email, because i already do what
you told me to do, so I still have the same problem:
<%= TEST %>
<% Collection col = (Collection)request.getSession().getAttribute(
"cautionVos"); %>
<%= col.size() %>
<%= col.isEmpty() %>
<logic:notEmpty name="cautionVOs" scope="session">
<tr>
<td align="center" colspan="2">
<table class="result">
<tr>
<td class="header"></td>
<td class="header"><b>Date du paiement</b></
td>
<td class="header"><b>Mode du paiement</b></
td>
<td class="header"><b>Compte de facturation</
b></td>
<td class="header"><b>Montant</b></td>
<td class="header"><b>Commentaire</b></td>
</tr>
</table>
<div style="overflow:auto; height:100px;">
<table class="result">
<logic:iterate name="cautionVOs" id=
"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>
I really think that the problem is with the <logic:notEmpty> tag, because
not even my first table is displayed in the JSP.
And I have an exception if i do
<% Collection col = (Collection)request.getSession().getAttribute(
"cautionVos"); %>
Does anyone have any idea?
Marianne
"Niall
Pemberton" Pour : "Struts Users Mailing List" <us...@struts.apache.org>
<niall.pemberton cc :
@gmail.com> Objet : Re: No Collection Found problem
14/06/2007 20:46
Veuillez
répondre à
"Struts Users
Mailing List"
On 6/14/07, Marianne.Gardes@bull.net <Ma...@bull.net> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Réf. : Re: No Collection Found problem
Posted by Niall Pemberton <ni...@gmail.com>.
On 6/15/07, Marianne.Gardes@bull.net <Ma...@bull.net> wrote:
>
> Hello Niall,
>
> Actually I did a mistake when i wrote my email, because i already do what
> you told me to do, so I still have the same problem:
>
> <%= TEST %>
> <% Collection col = (Collection)request.getSession().getAttribute(
> "cautionVos"); %>
> <%= col.size() %>
> <%= col.isEmpty() %>
>
> <logic:notEmpty name="cautionVOs" scope="session">
> <tr>
> <td align="center" colspan="2">
> <table class="result">
> <tr>
> <td class="header"></td>
> <td class="header"><b>Date du paiement</b></
> td>
> <td class="header"><b>Mode du paiement</b></
> td>
> <td class="header"><b>Compte de facturation</
> b></td>
> <td class="header"><b>Montant</b></td>
> <td class="header"><b>Commentaire</b></td>
> </tr>
> </table>
>
>
> <div style="overflow:auto; height:100px;">
> <table class="result">
> <logic:iterate name="cautionVOs" id=
> "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>
>
> I really think that the problem is with the <logic:notEmpty> tag, because
> not even my first table is displayed in the JSP.
In your original mail you said that you were getting an exception with
the message "No Collection Found" - the "not empty" tag doesn't throw
an exception with that message - but the "iterate" tag does.
> And I have an exception if i do
> <% Collection col = (Collection)request.getSession().getAttribute(
> "cautionVos"); %>
Its hard to help without you telling us details of the exception - and
preferably stack trace.
If I were having the kind of problems you are I would simplify (i.e.
remove a load of stuff) my jsp page - start with just the
<logic:notEmpty> - get that working and then start adding back in the
rest of the page bit by bit.
Niall
> Does anyone have any idea?
>
> Marianne
>
> On 6/14/07, Marianne.Gardes@bull.net <Ma...@bull.net> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org