problem with selectmanycheckbox
pouria62 Jan 23, 2011 2:56 AMhi experts today i encountered another problem with selectmanycheckbox ;the snippet code including
<h:selectManyCheckbox value="#{conversationBean.oneList}">
<s:selectItems value="#{conversationBean.anotherList}" var="something" label="#{something.name}">
</s:selectItems>
</h:selectManyCheckbox>
and now i need to persist a list of selected(checked) from conversationBean.anotherList into conversationBean.oneList . i don,t know how to? please F1 me.(i mean i,m really get in trouble and really need your help)
more details of my problem is :
my xhtml tags :
<rich:dataTable var="_se" value="#{positionTypeSeverityConversation.GetSeverityTypeName()}">
<h:column>
<h:outputText value="#{_se.name}" />
</h:column>
<h:column>
<h:selectManyCheckbox id="severityList" onchange="submit()"
value="#{positionTypeSeverityConversation.?">
----> here i dont know what to place with ? (?=someKinfOfList)
<s:selectItems var="_seList"
value="#{positionTypeSeverityConversation.GetSeverityList(_se.id)"
label="#{_se.name}" />
<s:convertEntity />
</h:selectManyCheckbox>
</h:column>
</rich:dataTable>
</h:panelGrid>
</rich:panel>
<h:commandButton id="save" value="Save"
action="#{positionTypeSeverityConversation.save()}"
style="FONT-FAMILY: 'Abyssinica SIL';" />
<s:button view="/setting/hr/PositionType.xhtml" id="cancelAdd"
value="Cancel">
<f:param name="positionTypeId" value="#{positionTypeId}" />
</s:button>
with this tag ---> <s:selectItems var="_seList"
value="#{positionTypeSeverityConversation.GetSeverityList(_se.id)"
label="#{_se.name}" /> i fill list check box. and user can select of them.my problem is to sending id's of severityhai's which was selected to
---> <h:selectManyCheckbox id="severityList" onchange="submit()"
value="#{positionTypeSeverityConversation.?">. and atleast i should persist severity's at PositionTypeSeverity table.well i have 3 tables 1-Severity 2-SeverityType 3-PositionTypeSeverity and 1-Severity with 2-SeverityType has n--->1 relation And 1-Severity with 3-PositionTypeSeveity has 1---->n relation.
@Stateful
@Scope(ScopeType.CONVERSATION)
@Name("positionTypeSeverityConversation")
public class PositionTypeSeverityConversationBean implements
PositionTypeSeverityConversation, Serializable {
private static final long serialVersionUID = -3604911984259043624L;
@Logger
private Log log;
@In
private EntityManager entityManager;
private PositionTypeSeverity positionTypeSeverity;
private SeverityType severityType;
@SuppressWarnings("unchecked")
public List<SeverityType> GetSeverityTypeName(){
return (List<SeverityType>) this.entityManager.createQuery(
" from SeverityType s ("
. getResultList();
{
@SuppressWarnings("unchecked")
public List<SeverityType> GetSeverityList(long id) {
return (List<Severity>) this.entityManager.createQuery(
" from Severity s where s.severityType.id = :id("
. setParameter("id", id(
. getResultList();
{
...
with a hql query i did select from Severity and show the list in ---><s:selectItems var="_seList"
value="#{positionTypeSeverityConversation.GetSeverityList(_se.id)"
label="#{_se.name}" /> and do not know how to persist severity's which selectd . i need a java method to persist them.and i know i should send id of the severity's which selected to a list but i couldnt find good example most people use static list to show items and send a name to selectmanycheckbox value;