struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Avdic <de...@betterway.net>
Subject Re: logic:Present tag
Date Fri, 23 May 2003 15:06:32 GMT
I am totally confused here.  Why do you need to do this?

If you prepopulate your form the items should be preselected for you.

Thus, if you have a multi-select populated by userContacts
and your selected contacts are stored into alertContacts
if you set the form in your setup action, they should be prepopulated.

IE.

class YourForm() {

ArrayList userContacts; (list of all possible contacts)
String[] alertContacts; (where multiselect will store multiple select contacts>

getters, setters, validator etc.

}

Then your form could look something like this:

<html:form action="/nextAction.do">
<html:select property="alertContacts" multiple="true" >
    <html:options collection="userContacts" property="contactId" 
labelProperty="contactIdLabel" />
</html:select>
</html:form>


Thus, if put the form into the request in the setup action, then there 
will be something in alertContacts, and they will
be preselected.  Otherwise (if the formbean is empty, or if you do not 
put anything in alertContacts) nothing will be preselected.

Make sense?

(I believe this is right.  I know some people have problems with options 
but this (i think) worked before I switched to
optionsCollection tag.)


Mick.Knutson@ubsw.com wrote:

>Can you please verify this for me then:
>
><bean:define id="allContacts" name="alertForm" property="userContacts" />
><bean:define id="selectedContacts" name="alertForm" property="alertContacts" />
>
><c:forEach items="allContacts" var="contact">
>    <option name="${contact.contactId}"
>    <c:forEach items="selectedContacts" var="selected">
>        <c:if test="${contact.contactId} == ${selectedContacts.contactId}" >
>            &nbsp;SELECTED
>        </c:if>
>        />
>    </c:forEach>
></c:forEach>
>
>I have a user that has a list of, say 10 contacts. I want a multi-select that shows all
10 contacts. The user will be able to select multiple contacts to assign to this Alert. So
say the user selected 5 contacts. Whe I redisplay the select, I need those 5 to be pre-selected.
Is the above what I would need to get this to work?
>
>Thanks in advance for you help.
>
>
>-----Original Message-----
>From: Denis Avdic [mailto:denis@betterway.net]
>Sent: Friday, May 23, 2003 3:53 PM
>To: Struts Users Mailing List
>Subject: Re: logic:Present tag
>
>
>You should use JSTL to do that, much easier to do...
>
>It took me approx 1hr to get all the id's and names and properties right 
>when using logic.
>
>It takes me about 1 min to write up the <c:foreach> tag...
>
>
>
>Mick.Knutson@ubsw.com wrote:
>
>  
>
>>I have an iterate question as well, and nobody has responded to my first 3 emails,
so maybe I will try here:
>>
>>I have a simiar issue that I can't resolve and was hoping you could help.
>>I have this logic iterate that does not print anything out even though there are 3
beans in my UserContact[]:
>>
>><bean:define id="state" name="contactListForm" property="userContacts" />
>>
>>
>>   <logic:present scope="request" name="contactListForm" >
>>       <html:select property="userContacts" >
>>       <html:option value="" key="form.select"/>
>>           <logic:iterate id="contact" name="contactListForm" property="userContacts">
>>               <html:options value='<bean:write name="contact" property="contactId"
/>'>
>>           </logic:iterate>
>>       </html:form>
>>   </logic:present>
>>
>>   <logic:notPresent scope="request" name="contactListForm" >
>>       <b><font color="red">NO CONTACTS CREATED YET. PLEASE CREATE AT
LEAST ONE CONTACT!</font></b>
>>   </logic:notPresent>
>>
>>
>>
>>
>>-----Original Message-----
>>From: Caroline Holanda [mailto:spencercaroline@yahoo.com]
>>Sent: Friday, May 23, 2003 3:27 PM
>>To: Struts Users Mailing List
>>Subject: RE: logic:Present tag
>>
>>
>>Gandle,
>>
>>Thanks again for the reply, but I guess your code
>>tests if a property of a collection is not null. What
>>I need is really test if the collection object, that
>>is a DynaActionForm property, is null. Following is
>>the code where I use this:
>>
>> <html:select property="supplyList" multiple="true"
>>size="5" styleClass="Campos" style="width:150">
>>   <logic:present property="supplyColl" >
>>      <html:optionsCollection property="supplyColl" 
>>value="value" label="label"/>  
>>   </logic:present> 
>> </html:select> 
>>
>> supplyColl is a collection of LabelValueBean.
>>
>> Caroline
>>
>>--- "Gandle, Panchasheel" <pgandle@rwjf.org>
>>escreveu: > <logic:present property="propertyName"
>> 
>>
>>    
>>
>>>scope="request">.
>>>this would be for collection
>>>
>>>I think it should be 
>>><logic:present name="coll" scope="request">
>>> <logic:iterate id="idColl" name="coll"
>>>scope="request">
>>>   <!-- for property -->
>>>   <logic:present name="idColl"
>>>property="propertyName">
>>>      <!-- do your things here ...-->
>>>   </logic:present>
>>> </logic:iterate>
>>></logic:present>
>>>
>>>Thanks
>>>Panchasheel
>>>
>>>
>>>-----Original Message-----
>>>From: Caroline Holanda
>>>[mailto:spencercaroline@yahoo.com]
>>>Sent: Friday, May 23, 2003 8:54 AM
>>>To: Struts Users Mailing List
>>>Subject: RE: logic:Present tag
>>>
>>>
>>>I'm sorry, I guess I didn't use the write words. I
>>>want to verify if the properties is not null, and
>>>execute the tag body only if the collection property
>>>is not null. Isn't it the case to use <logic:present
>>>property="propertyName" scope="request">.
>>>
>>> Thanks for any help.
>>> Caroline Holanda
>>>
>>>--- "Gandle, Panchasheel" <pgandle@rwjf.org>
>>>escreveu: > you should probably use 
>>>   
>>>
>>>      
>>>
>>>><logic:notPresent
>>>>
>>>>
>>>>Thanks
>>>>Panchasheel
>>>>609 627 7561
>>>>
>>>>
>>>>-----Original Message-----
>>>>From: Caroline Holanda
>>>>[mailto:spencercaroline@yahoo.com]
>>>>Sent: Thursday, May 22, 2003 5:07 PM
>>>>To: 'Struts Users Mailing List'
>>>>Subject: logic:Present tag
>>>>
>>>>
>>>>Hi List!
>>>>
>>>> How can I test if a form property, like a
>>>>collection, is null with the logic:present tag?
>>>>
>>>> I tried both 
>>>><logic:present property="propertyName"
>>>>scope="request"> and <logic:present
>>>>     
>>>>
>>>>        
>>>>
>>>name="formName"
>>>   
>>>
>>>      
>>>
>>>>property="propertyName" scope="request">, but it
>>>>didn't work.
>>>>
>>>> I can't understand the present tag well. Its
>>>>description say that name attribute correspond to
>>>>     
>>>>
>>>>        
>>>>
>>>a
>>>   
>>>
>>>      
>>>
>>>>JSP bean name, but I have an example application
>>>>that
>>>>uses this tag setting the name to an attribute
>>>>     
>>>>
>>>>        
>>>>
>>>name
>>>   
>>>
>>>      
>>>
>>>>that can be set to the request object and it works
>>>>well.
>>>>
>>>> Thanks.
>>>> Caroline
>>>>
>>>>=====
>>>>******************************
>>>>Cuide das pessoas que vc ama! 
>>>>Elas são presentes de Deus!
>>>>
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>_______________________________________________________________________
>> 
>>
>>    
>>
>>>>Yahoo! Mail
>>>>O melhor e-mail gratuito da internet: 6MB de
>>>>     
>>>>
>>>>        
>>>>
>>>espaço,
>>>   
>>>
>>>      
>>>
>>>>antivírus, acesso POP3,
>>>>filtro contra spam. 
>>>>http://br.mail.yahoo.com/
>>>>
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>---------------------------------------------------------------------
>> 
>>
>>    
>>
>>>>To unsubscribe, e-mail:
>>>>struts-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail:
>>>>struts-user-help@jakarta.apache.org
>>>>
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>---------------------------------------------------------------------
>> 
>>
>>    
>>
>>>>To unsubscribe, e-mail:
>>>>struts-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail:
>>>>struts-user-help@jakarta.apache.org
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>>=====
>>>******************************
>>>Cuide das pessoas que vc ama! 
>>>Elas são presentes de Deus!
>>>
>>>
>>>   
>>>
>>>      
>>>
>>_______________________________________________________________________
>> 
>>
>>    
>>
>>>Yahoo! Mail
>>>O melhor e-mail gratuito da internet: 6MB de espaço,
>>>antivírus, acesso POP3,
>>>filtro contra spam. 
>>>http://br.mail.yahoo.com/
>>>
>>>
>>>   
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>> 
>>
>>    
>>
>>>To unsubscribe, e-mail:
>>>struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail:
>>>struts-user-help@jakarta.apache.org
>>>
>>>
>>>   
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>> 
>>
>>    
>>
>>>To unsubscribe, e-mail:
>>>struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail:
>>>struts-user-help@jakarta.apache.org
>>>
>>>   
>>>
>>>      
>>>
>>=====
>>******************************
>>Cuide das pessoas que vc ama! 
>>Elas são presentes de Deus!
>>
>>_______________________________________________________________________
>>Yahoo! Mail
>>O melhor e-mail gratuito da internet: 6MB de espaço, antivírus, acesso POP3, filtro
contra spam. 
>>http://br.mail.yahoo.com/
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>Visit our website at http://www.ubswarburg.com
>>
>>This message contains confidential information and is intended only 
>>for the individual named.  If you are not the named addressee you 
>>should not disseminate, distribute or copy this e-mail.  Please 
>>notify the sender immediately by e-mail if you have received this 
>>e-mail by mistake and delete this e-mail from your system.
>>
>>E-mail transmission cannot be guaranteed to be secure or error-free 
>>as information could be intercepted, corrupted, lost, destroyed, 
>>arrive late or incomplete, or contain viruses.  The sender therefore 
>>does not accept liability for any errors or omissions in the contents 
>>of this message which arise as a result of e-mail transmission.  If 
>>verification is required please request a hard-copy version.  This 
>>message is provided for informational purposes and should not be 
>>construed as a solicitation or offer to buy or sell any securities or 
>>related financial instruments.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>
>> 
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>Visit our website at http://www.ubswarburg.com
>
>This message contains confidential information and is intended only 
>for the individual named.  If you are not the named addressee you 
>should not disseminate, distribute or copy this e-mail.  Please 
>notify the sender immediately by e-mail if you have received this 
>e-mail by mistake and delete this e-mail from your system.
>
>E-mail transmission cannot be guaranteed to be secure or error-free 
>as information could be intercepted, corrupted, lost, destroyed, 
>arrive late or incomplete, or contain viruses.  The sender therefore 
>does not accept liability for any errors or omissions in the contents 
>of this message which arise as a result of e-mail transmission.  If 
>verification is required please request a hard-copy version.  This 
>message is provided for informational purposes and should not be 
>construed as a solicitation or offer to buy or sell any securities or 
>related financial instruments.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message