Hi,
This problem is seen in more than one JSF components. The workaround is rather
surprising. Once I add the source code to my project I will analyze the bug.
In HtmlPicklistRenderer class - method encodeEnd
There is a statement -
Set lookupSet = HtmlRendererUtils.getSubmittedOrSelectedValuesAsSet(
true, uiComponent, facesContext, converter);
If the component is marked as enabled then this lookupSet will have nothing.
However if you disable the component then lookupSet will contain all the values
that are pre-selected on the right hand select list.
As of now the workaround is to initially disable the component, get the values
and then enable the component via calling some action method.
~madhav
________________________________
From: Bruno Aranda [mailto:[EMAIL PROTECTED]
Sent: Friday, December 22, 2006 3:30 PM
To: MyFaces Discussion
Cc: [EMAIL PROTECTED]
Subject: Re: selectManyPicklist for edit
Chintan, you should send this kind of messages to the users list of myfaces,
never to the developers itself if you want to have a fast answer ;-) Now I am
on holidays and I cannot help you on this, but it seems this may be a bug. Feel
free to take a look at the SelectManyListRenderer class on the sandbox sources
to see if you can debug/fix the problem and submit a patch with the possible
solution in the JIRA tracker. If you don“t feel in the mood to do that, just
open a JIRA ticket with the bug,
Thanks,
Bruno
On 22/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:
Hi Bruno,
I am facing one issues with selectManyPickList. I am putting my code here.
JSP code:
<t:panelGroup>
<t:panelGrid columns="3">
<t:outputLabel value="ABC"/>
<t:outputLabel value=":"/>
<%-- Sandbox component --%>
<s:selectManyPicklist size="10" style="width:175px;"
valueChangeListener="#{accessDelegationController.selectionChangedForOperations
}"
value="#{accessDelegationController.selectedOperationsList}"
immediate="true">
<f:selectItems
value="#{accessDelegationController.operationsList }" />
</s:selectManyPicklist>
</t:panelGrid>
</t:panelGroup>
Java Code:
Creating 2 Lists. one for SelectedValues and other for default values.
private List selectedOperationsList = new ArrayList();
private List operationsList = new ArrayList();
//here both lists have getter and setter method(which i have not mentioned here)
//logic to add values in above lists. (Note: I am iterating the values which i
am getting from backend. and adding to selectedOperationList list)
List OperationList1 = (List)Service1.getCreatedOperationRulesList();
//Iterator for selected operation
Iterator iter = OperationList1.iterator();
int i = 0;
while( iter.hasNext()){
Operation operation = (Operation)OperationList1.get(i);
selectedOperationsList.add(new
SelectItem(Integer.toString(operation.getId()),operation.getName()));
i++;
iter.next();
}
//same for default operation lists
List operationList2=(List)Service2.getOperationsList();
Iterator iter1 = operationList2.iterator ();
int j = 0;
while(iter1.hasNext()){
Operation operation1 =
(Operation)operationList2.get(j);
operationsList.add (new
SelectItem(Integer.toString(operation1.getId()),operation1.getName()));
j++;
iter1.next();
}
While rendering only left-hand side value comes.( i mean operationsList).
Right-hand side box(selecteOperationsList) contains no values. though both the
lists are having values in it.
I dont know what is the problem? can you please help me?
Thanks
Chintan
Bruno Aranda wrote:
>
> What type are you passing to the value attribute of the
> selectManyPicklist? It works the same ay as the other
> selectManyComponents. You have to pass an array with the items you
> want to be preselected to the value attribute...
> Can you show some of your code?
>
> Regards,
>
> Bruno
>
> 2006/1/2, Alin Dosoniu <[EMAIL PROTECTED]>:
>>
>> Hello,
>>
>> I want to use selectManyPicklist component for editing a list of values
>> that
>> were selected on a previous access of the page. I don't know how I can
>> have
>> some elements in selected option. I tried to use the "value" attribute of
>> selectManyPicklist but I get this error:
>>
>> Caused by: org.apache.jasper.JasperException: Value is no
>> String and component body:fn:invTypeswith path: {Component-Path : [Class:
>> javax.faces.component.UIViewRoot,ViewId:
>> /app/programmings_new.jsp][Class:
>> javax.faces.component.html.HtmlPanelGrid,Id:
>> _idJsp13][Class:
>> javax.faces.component.UINamingContainer ,Id: body][Class:
>> javax.faces.component.html.HtmlPanelGroup,Id:
>> _idJsp19][Class: javax.faces.component.html.HtmlForm,Id:
>> fn][Class: javax.faces.component.html.HtmlPanelGrid,Id:
>> _idJsp20][Class:
>> javax.faces.component.html.HtmlPanelGroup,Id:
>> _idJsp33][Class:
>> org.apache.myfaces.custom.picklist.HtmlSelectManyPicklist,Id:
>> invTypes]} does not have a Converter
>> at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
>> at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
>> (ApplicationFilterChain.java:252)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>
>> I used the selectManyPicklist component to successfully select some items
>> from available list when made the save of the object. But now I want to
>> edit
>> the object.
>>
>> Thank you,
>> Alin.
>>
>>
>
>
Quoted from:
http://www.nabble.com/selectManyPicklist-for-edit-tf836354.html#a2171027
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***