incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francisco Passos" <francisco.pas...@opensoft.pt>
Subject RE: Keeping selectOneChoice selection
Date Mon, 09 Apr 2007 17:26:08 GMT

Sure, thank you.

I should point out I'm using facelets. Furthermore, some variables are in
portuguese, sorry for that. If you find there is something I am doing in a
non-standard fashion, please feel free to advise me, since I've only just
scraped the surface of JSF and Trinidad.

Here's the code then:


------ PAGE CODE: fichaProdConsulta.xhtml ------

<?xml version='1.0' encoding='windows-1252'?>
<trh:html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:tr="http://myfaces.apache.org/trinidad"
	xmlns:trh="http://myfaces.apache.org/trinidad/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:t="http://myfaces.apache.org/tomahawk" id="htmlid">

<trh:head id="headid"/>
<trh:body id="bodyid">
	<f:view>
		<ui:composition template="/templates/mainTemplate.xhtml">
			<ui:define name="PageContent">


				<h3 style="stph3"><tr:outputText value="Ficha de Produto" /></h3>
				<h4 style="stph4"><tr:outputText value="[ Importação ]"
styleClass="stph4"/></h4>

				<div align="center">
					<tr:panelGroupLayout partialTriggers="correntePnifa"
layout="vertical" styleClass="stptable" inlineStyle="width:300px">
						<tr:panelHorizontalLayout styleClass="invisibleTable"
inlineStyle="text-align: center;" partialTriggers="correntePnifa">
							<tr:selectOneRadio id="correntePnifa"
								autoSubmit="true" binding="#{fichaBean.tipoPesquisa}"
								styleClass="stpinputText" layout="horizontal"
value="#{fichaBean.tipoPesquisaSeleccionada}"
								valueChangeListener="#{fichaBean.updatePnifaVisibility}">
								<f:selectItem itemValue="CORRENTE" itemLabel="Corrente" />
								<f:selectItem itemValue="PNIFA" itemLabel="PNIFA" />
							</tr:selectOneRadio>
						</tr:panelHorizontalLayout>
						<tr:panelHorizontalLayout inlineStyle="width: 200px;">
							<hr style="height:1px;" />
						</tr:panelHorizontalLayout>
						<tr:panelHorizontalLayout>
							<tr:outputText value="Código Pautal" styleClass="titleCell" />
							<tr:outputText value="Ano" styleClass="titleCell"
rendered="#{fichaBean.pnifaVisible}" />
							<tr:inputText styleClass="fCodPautal" maximumLength="22"
id="codPautal" binding="#{fichaBean.codPautal}"
value="#{fichaBean.codigoPautal}" />
							<tr:selectOneChoice id="selectAnoPnifa"
binding="#{fichaBean.anoPnifa}"
value="#{fichaBean.anoPnifaSeleccionado}" styleClass="stpselect"
rendered="#{fichaBean.pnifaVisible}" valuePassThru="true">
								<f:selectItems id="pnifaItems" value="#{fichaBean.anoPnifaItems}" />
							</tr:selectOneChoice>
						</tr:panelHorizontalLayout>
						<tr:spacer height="15px"/>
					</tr:panelGroupLayout>
					<tr:commandButton text="Consultar" styleClass="fButton"
action="consultarFichaImport" />
					<tr:commandButton text="Ficar" styleClass="fButton"
action="#{fichaBean.valorAlterado}"/>

				</div>
			</ui:define>
		</ui:composition>
	</f:view>
</trh:body>
</trh:html>



------ TEMPLATE CODE: mainTemplate.xhtml ------

<?xml version='1.0' encoding='windows-1252'?>
<trh:html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:trh="http://myfaces.apache.org/trinidad/html"
	xmlns:tr="http://myfaces.apache.org/trinidad"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" id="mainTemplatehtml1">

<trh:head id="mainTemplatehead1">
	<link href="/stp/resources/css/stp.css" rel="stylesheet" media="screen"/>
	<link href="/stp/resources/css/calendar.css" rel="stylesheet"
media="screen"/>
</trh:head>

<trh:body id="mainTemplatebody1" styleClass="stpbody">
	<f:view>
		<f:loadBundle
			basename="pt.opensoft.messageResource.MessageResources" var="msg" />
		<tr:form id="mainTemplateform1">
			<tr:panelPage id="mainTemplatepanelPage1">
				<f:facet name="messages">
					<tr:messages id="mainMessagesID" text="Mensagens" rendered="true">

					</tr:messages>
				</f:facet>
				<f:facet name="menuGlobal">
					<tr:navigationPane id="mainTemplatemenuButtons1">
						<tr:panelHorizontalLayout>
							<tr:commandLink text="#{msg.label_logout}"
								id="mainTemplatecommandLink1" action="#{logoutBean.actionSair}"
								immediate="true" />
						</tr:panelHorizontalLayout>
					</tr:navigationPane>
				</f:facet>

				<f:facet name="branding">
					<tr:image source="#{msg.logo_source}"
						id="mainTemplateobjectImage1" />
				</f:facet>


				<f:facet name="appCopyright">
					<tr:outputFormatted value="#{msg.label_copyright}"
						id="mainTemplateoutputFormatted1" />
				</f:facet>


				<ui:insert name="menuOpcoes">
					<ui:include src="../pages/menu.xhtml" />
				</ui:insert>


				<ui:insert name="PageContent" />

			</tr:panelPage>
		</tr:form>
	</f:view>
</trh:body>

</trh:html>



------ RENDERED HTML (first access )-------

<?xml version='1.0' encoding='windows-1252'?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/loose.dtd"><!--Start:
org.apache.myfaces.trinidad.Html["mainTemplatehtml1"]--><html dir="ltr"
lang="en"><!--Start:
org.apache.myfaces.trinidad.Head["mainTemplatehead1"]-->
  <head id="mainTemplatehead1">
    <meta name="generator" content="Apache Trinidad">

    <link rel="stylesheet" charset="UTF-8" type="text/css"
href="/stp/adf/styles/cache/simple-desktop-1_0_0-incubating-en-gecko.css"><script>var
_AdfWindowOpenError='A popup window blocker has been detected in your
browser. Popup blockers interfere with the operation of this
application. Please disable your popup blocker or allow popups from
this site.';</script><script
src="/stp/adf/jsLibs/Common11-m7.js"></script><script>_defaultTZ()</script>

    <link href="/stp/resources/css/stp.css" rel="stylesheet" media="screen">


    <link href="/stp/resources/css/calendar.css" rel="stylesheet"
media="screen">
  </head>

  <!--Start: org.apache.myfaces.trinidad.Body["mainTemplatebody1"]-->
  <body id="mainTemplatebody1" onload="_checkLoad()"
onunload="_checkUnload(event)" class="stpbody">
    <iframe id="_pprIFrame" name="_pprIFrame" frameborder="0" longdesc="#"
title="" src="about:blank"
style="position:absolute;top:-100px;visibility:hidden" width="0"
height="0"></iframe>
    <!--Start:
org.apache.myfaces.trinidad.Body["mainTemplatebody1"]--><div
id="_pprBlockingDiv" onclick="return _pprConsumeClick(event);"
style="position:absolute;left:0;top:0;width:0;height:0;cursor:wait;"
onkeydown="return false;" onkeyup="return false;" onmousedown="return
false;" onmouseup="return false;" onkeypress="return
false;"></div><script>var _cachedLibs;</script><a
name="top"></a><!--Start:
org.apache.myfaces.trinidad.Form["mainTemplateform1"]-->
    <form id="mainTemplateform1" name="mainTemplateform1"
style="margin:0px" method="POST" onkeypress="return
_submitOnEnter(event,'mainTemplateform1');"
action="/stp/pages/ficha/fichaProdConsulta.jsf?_afPfm=-20ad0192"><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><span
id="mainTemplatepanelPage1"><table cellpadding="0" cellspacing="0"
border="0" width="100%"><tr>
              <td nowrap valign="top"><table cellpadding="0"
cellspacing="2" border="0" width="1%"><tr>
                    <td nowrap><!--Start:
org.apache.myfaces.trinidad.Object["mainTemplateobjectImage1"]--><img
id="mainTemplateobjectImage1"
name="mainTemplateobjectImage1"
src="/stp/resources/img/opensoft_logo.jpg"></td>
                  </tr><tr>

                    <td valign="top" nowrap></td>
                  </tr></table></td>
            </tr><tr>
              <td width="100%"><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><table
class="xc5" cellpadding="0" cellspacing="0" border="0"
width="100%"><tr>
                      <td height="1"></td>
                    </tr></table></td>
            </tr></table><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><div><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><!--Start:
org.apache.myfaces.trinidad.Messages["mainMessagesID"]--><span
id="mainMessagesID"></span><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><table
width="100%" border="0" cellspacing="0" cellpadding="0"><tr
valign="top">
                <td width="100%"></td>
              </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><?xml
version='1.0' encoding='windows-1252'?>

<div></div><!--Start: org.apache.myfaces.trinidad.Panel["j_id4"]--><table
cellpadding="0" cellspacing="0" border="0" id="j_id4"><tr>
                  <td><!--Start:
org.apache.myfaces.trinidad.Command["j_id5"]--><a
id="j_id5" name="j_id5"
onclick="submitForm('mainTemplateform1',1,{source:'j_id5'});return
false;" class="xi" href="#">Ficha Produto
Importa&ccedil;&atilde;o</a></td>
                </tr></table><div></div>



              <h3 style="stph3"><div></div><!--Start:
org.apache.myfaces.trinidad.Output["j_id7"]--><span
id="j_id7">Ficha de Produto</span><div></div></h3>


              <h4 style="stph4"><div></div><!--Start:
org.apache.myfaces.trinidad.Output["j_id9"]--><span
id="j_id9" class="stph4">[ Importa&ccedil;&atilde;o
]</span><div></div></h4>


				<div align="center"><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["j_id11"]--><div id="j_id11"
class="stptable" style="width:300px"><!--Start:
org.apache.myfaces.trinidad.Panel["j_id12"]--><table cellpadding="0"
cellspacing="0" border="0" id="j_id12" class="invisibleTable"
style="text-align: center;"><tr>
                      <td><!--Start:
org.apache.myfaces.trinidad.SelectOne["correntePnifa"]--><table
id="correntePnifa__xc_" class="stpinputText x1l"
cellpadding="0" cellspacing="0" border="0"><tr>

                            <td class="x14" nowrap></td>

                            <td valign="top" nowrap
class="AFContentCell"><script>var
_pprUpdateMode=false;function
_adfspu(f,v,e,s,o){_pprUpdateMode=true;if(!o)o=new
Object();o.event=(e)?e:'update';if(s)o.source=s;_submitPartialChange(f,v,o);}</script><!--Start:
org.apache.myfaces.trinidad.SelectOne["correntePnifa"]--><span
id="correntePnifa" class="x21">
                                <input type="radio" name="correntePnifa"
id="correntePnifa:_0" value="0"
onclick="_adfspu('mainTemplateform1',1,'correntePnifa','correntePnifa');return
true;"><label
for="correntePnifa:_0">Corrente</label>
                                <input type="radio" name="correntePnifa"
id="correntePnifa:_1" value="1"
onclick="_adfspu('mainTemplateform1',1,'correntePnifa','correntePnifa');return
true;"><label
for="correntePnifa:_1">PNIFA</label></span></td>
                          </tr></table></td>
                    </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["j_id15"]--><table
cellpadding="0" cellspacing="0" border="0" id="j_id15"
style="width: 200px;"><tr>
                      <td>


                        <hr style="height:1px;">
                      </td>
                    </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["j_id17"]--><table
cellpadding="0" cellspacing="0" border="0"
id="j_id17"><tr>
                      <td><!--Start:
org.apache.myfaces.trinidad.Output["j_id18"]--><span
id="j_id18" class="titleCell">C&oacute;digo
Pautal</span></td>

                      <td><!--Start:
org.apache.myfaces.trinidad.Output["j_id19"]--><span
id="j_id19" class="titleCell">Ano</span></td>

                      <td><!--Start:
org.apache.myfaces.trinidad.Input["codPautal"]--><table
id="codPautal__xc_" class="fCodPautal x1e"
cellpadding="0" cellspacing="0" border="0"><tr>
                            <td class="xu" nowrap></td>


                            <td valign="top" nowrap
class="AFContentCell"><!--Start:
org.apache.myfaces.trinidad.Input["codPautal"]-->
                              <input id="codPautal" name="codPautal"
class="x1p" size="30" maxlength="22"
type="text">
                            </td>
                          </tr></table></td>

                      <td><!--Start:
org.apache.myfaces.trinidad.SelectOne["selectAnoPnifa"]--><table
id="selectAnoPnifa__xc_" class="stpselect x1j"
cellpadding="0" cellspacing="0" border="0"><tr>
                            <td class="x12" nowrap></td>

                            <td valign="top" nowrap
class="AFContentCell"><script>var
_locale='en';var
_tLocale='en';</script><script
src="/stp/adf/jsLibs/resources/LocaleElements_en11-m7.js"></script><!--Start:
org.apache.myfaces.trinidad.SelectOne["selectAnoPnifa"]-->
                              <select id="selectAnoPnifa"
name="selectAnoPnifa" class="x1z">

                                <option value=""></option>

                                <option value="2006">2006</option>

                                <option value="2005">2005</option>

                                <option value="2004">2004</option>
                              </select>
                            </td>
                          </tr></table></td>

                    </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Object["j_id20"]--><div
id="j_id20"
style="margin-top:15px"></div></div><div></div><!--Start:
org.apache.myfaces.trinidad.Command["j_id21"]-->
                <button id="j_id21" name="j_id21" type="button"
onclick="submitForm('mainTemplateform1',1,{source:'j_id21'});return
false;" class="fButton
x6l">Consultar</button><div></div><!--Start:
org.apache.myfaces.trinidad.Command["j_id22"]-->
                <button id="j_id22" name="j_id22" type="button"
onclick="submitForm('mainTemplateform1',1,{source:'j_id22'});return
false;" class="fButton x6l">Ficar</button><div></div>

				</div><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><div>
              <hr class="x98"><div class="x9a"></div><div
class="x99"></div><div
class="x9b"></div></div><div></div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><div
class="x9c"><div class="x9d"><span class="x5a"><!--Start:
org.apache.myfaces.trinidad.Output["mainTemplateoutputFormatted1"]--><span
id="mainTemplateoutputFormatted1">(@VERSION@)
@VERSION-DATE@</span></span><span class="x5b"></span><span
class="x5c"></span></div></div></span>
      <input type="hidden" name="org.apache.myfaces.trinidad.faces.FORM"
value="mainTemplateform1"><span
id="_mainTemplateform1_Postscript"><input type="hidden"
name="org.apache.myfaces.trinidad.faces.STATE" value="!-20ad0192">
        <input type="hidden" name="source"><script>var
_resetmainTemplateform1Names=["source"];</script><script>var
_mainTemplateform1_Validations=['new
TrIntegerConverter(null,null,0,2147483647,-2147483648)'];function
_mainTemplateform1Validator(f,s){var fl =
_multiValidate(f,s,["selectAnoPnifa",0,,0,[]],0);if(fl.length>0){_validationAlert('Form
validation failures:'+fl);return false;}else{return true;}}var
_mainTemplateform1_Formats=['{0} - {1}'];var
mainTemplateform1_SF={};</script></span><script>_submitFormCheck();</script></form>

  <!-- MYFACES JAVASCRIPT -->

</body>
  <!--Created by Apache Trinidad (Apache Trinidad API -
1.0.0-incubating/Apache Trinidad Impl - 1.0.0-incubating),
Accessibility:disabled, skin:simple.desktop (simple)--></html>




------- RENDERED HTML (postback in said conditions) -------

<?xml version='1.0' encoding='windows-1252'?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/loose.dtd"><!--Start:
org.apache.myfaces.trinidad.Html["mainTemplatehtml1"]--><html dir="ltr"
lang="en"><!--Start:
org.apache.myfaces.trinidad.Head["mainTemplatehead1"]-->
  <head id="mainTemplatehead1">
    <meta name="generator" content="Apache Trinidad">

    <link rel="stylesheet" charset="UTF-8" type="text/css"
href="/stp/adf/styles/cache/simple-desktop-1_0_0-incubating-en-gecko.css"><script>var
_AdfWindowOpenError='A popup window blocker has been detected in your
browser. Popup blockers interfere with the operation of this
application. Please disable your popup blocker or allow popups from
this site.';</script><script
src="/stp/adf/jsLibs/Common11-m7.js"></script><script>_defaultTZ()</script>

    <link href="/stp/resources/css/stp.css" rel="stylesheet" media="screen">


    <link href="/stp/resources/css/calendar.css" rel="stylesheet"
media="screen">


    <link href="/stp/resources/css/stp.css" rel="stylesheet" media="screen">



    <link href="/stp/resources/css/calendar.css" rel="stylesheet"
media="screen">


    <link href="/stp/resources/css/stp.css" rel="stylesheet" media="screen">


    <link href="/stp/resources/css/calendar.css" rel="stylesheet"
media="screen">
  </head>
  <!--Start: org.apache.myfaces.trinidad.Body["mainTemplatebody1"]-->
  <body id="mainTemplatebody1" onload="_checkLoad()"
onunload="_checkUnload(event)" class="stpbody">
    <iframe id="_pprIFrame" name="_pprIFrame" frameborder="0" longdesc="#"
title="" src="about:blank"
style="position:absolute;top:-100px;visibility:hidden" width="0"
height="0"></iframe>
    <!--Start:
org.apache.myfaces.trinidad.Body["mainTemplatebody1"]--><div
id="_pprBlockingDiv" onclick="return _pprConsumeClick(event);"
style="position:absolute;left:0;top:0;width:0;height:0;cursor:wait;"
onkeydown="return false;" onkeyup="return false;" onmousedown="return
false;" onmouseup="return false;" onkeypress="return
false;"></div><script>var _cachedLibs;</script><a
name="top"></a><!--Start:
org.apache.myfaces.trinidad.Form["mainTemplateform1"]-->

    <form id="mainTemplateform1" name="mainTemplateform1"
style="margin:0px" method="POST" onkeypress="return
_submitOnEnter(event,'mainTemplateform1');"
action="/stp/pages/ficha/fichaProdConsulta.jsf?_afPfm=-20ad0190"><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><span
id="mainTemplatepanelPage1"><table cellpadding="0" cellspacing="0"
border="0" width="100%"><tr>
              <td nowrap valign="top"><table cellpadding="0"
cellspacing="2" border="0" width="1%"><tr>
                    <td nowrap><!--Start:
org.apache.myfaces.trinidad.Object["mainTemplateobjectImage1"]--><img
id="mainTemplateobjectImage1"
name="mainTemplateobjectImage1"
src="/stp/resources/img/opensoft_logo.jpg"></td>
                  </tr><tr>
                    <td valign="top" nowrap></td>
                  </tr></table></td>
            </tr><tr>
              <td width="100%"><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><table
class="xc5" cellpadding="0" cellspacing="0" border="0"
width="100%"><tr>
                      <td height="1"></td>

                    </tr></table></td>
            </tr></table><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><div><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><!--Start:
org.apache.myfaces.trinidad.Messages["mainMessagesID"]--><span
id="mainMessagesID"></span><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><table
width="100%" border="0" cellspacing="0" cellpadding="0"><tr
valign="top">
                <td width="100%"></td>
              </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><?xml
version='1.0' encoding='windows-1252'?>
<div></div>



              <h3 style="stph3"><div></div></h3>


              <h4 style="stph4"><div></div></h4>


				<div align="center"><div></div>

				</div><div></div><?xml version='1.0' encoding='windows-1252'?>

<div></div>



              <h3 style="stph3"><div></div></h3>


              <h4 style="stph4"><div></div></h4>


				<div align="center"><div></div>

				</div><div></div><?xml version='1.0' encoding='windows-1252'?>
<div></div><!--Start: org.apache.myfaces.trinidad.Panel["j_id4"]--><table
cellpadding="0" cellspacing="0" border="0" id="j_id4"><tr>
                  <td><!--Start:
org.apache.myfaces.trinidad.Command["j_id5"]--><a
id="j_id5" name="j_id5"
onclick="submitForm('mainTemplateform1',1,{source:'j_id5'});return
false;" class="xi" href="#">Ficha Produto
Importa&ccedil;&atilde;o</a></td>
                </tr></table><div></div>



              <h3 style="stph3"><div></div><!--Start:
org.apache.myfaces.trinidad.Output["j_id7"]--><span
id="j_id7">Ficha de Produto</span><div></div></h3>



              <h4 style="stph4"><div></div><!--Start:
org.apache.myfaces.trinidad.Output["j_id9"]--><span
id="j_id9" class="stph4">[ Importa&ccedil;&atilde;o
]</span><div></div></h4>


				<div align="center"><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["j_id11"]--><div id="j_id11"
class="stptable" style="width:300px"><!--Start:
org.apache.myfaces.trinidad.Panel["j_id12"]--><table cellpadding="0"
cellspacing="0" border="0" id="j_id12" class="invisibleTable"
style="text-align: center;"><tr>
                      <td><!--Start:
org.apache.myfaces.trinidad.SelectOne["correntePnifa"]--><table
id="correntePnifa__xc_" class="stpinputText x1l"
cellpadding="0" cellspacing="0" border="0"><tr>
                            <td class="x14" nowrap></td>

                            <td valign="top" nowrap
class="AFContentCell"><script>var
_pprUpdateMode=false;function
_adfspu(f,v,e,s,o){_pprUpdateMode=true;if(!o)o=new
Object();o.event=(e)?e:'update';if(s)o.source=s;_submitPartialChange(f,v,o);}</script><!--Start:
org.apache.myfaces.trinidad.SelectOne["correntePnifa"]--><span
id="correntePnifa" class="x21">
                                <input type="radio" name="correntePnifa"
id="correntePnifa:_0" value="0"
onclick="_adfspu('mainTemplateform1',1,'correntePnifa','correntePnifa');return
true;"><label
for="correntePnifa:_0">Corrente</label>
                                <input type="radio" name="correntePnifa"
id="correntePnifa:_1" value="1" checked
onclick="_adfspu('mainTemplateform1',1,'correntePnifa','correntePnifa');return
true;"><label
for="correntePnifa:_1">PNIFA</label></span></td>

                          </tr></table></td>
                    </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["j_id15"]--><table
cellpadding="0" cellspacing="0" border="0" id="j_id15"
style="width: 200px;"><tr>
                      <td>

                        <hr style="height:1px;">
                      </td>

                      <td>

                        <hr style="height:1px;">
                      </td>

                      <td>


                        <hr style="height:1px;">
                      </td>
                    </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["j_id17"]--><table
cellpadding="0" cellspacing="0" border="0"
id="j_id17"><tr>
                      <td><!--Start:
org.apache.myfaces.trinidad.Output["j_id18"]--><span
id="j_id18" class="titleCell">C&oacute;digo
Pautal</span></td>

                      <td><!--Start:
org.apache.myfaces.trinidad.Output["j_id19"]--><span
id="j_id19" class="titleCell">Ano</span></td>

                      <td><!--Start:
org.apache.myfaces.trinidad.Input["codPautal"]--><table
id="codPautal__xc_" class="fCodPautal x1e"
cellpadding="0" cellspacing="0" border="0"><tr>
                            <td class="xu" nowrap></td>


                            <td valign="top" nowrap
class="AFContentCell"><!--Start:
org.apache.myfaces.trinidad.Input["codPautal"]-->
                              <input id="codPautal" name="codPautal"
class="x1p" size="30" maxlength="22"
type="text">
                            </td>
                          </tr></table></td>

                      <td><!--Start:
org.apache.myfaces.trinidad.SelectOne["selectAnoPnifa"]--><table
id="selectAnoPnifa__xc_" class="stpselect x1j"
cellpadding="0" cellspacing="0" border="0"><tr>
                            <td class="x12" nowrap></td>

                            <td valign="top" nowrap
class="AFContentCell"><script>var
_locale='en';var
_tLocale='en';</script><script
src="/stp/adf/jsLibs/resources/LocaleElements_en11-m7.js"></script><!--Start:
org.apache.myfaces.trinidad.SelectOne["selectAnoPnifa"]-->
                              <select id="selectAnoPnifa"
name="selectAnoPnifa" class="x1z">

                                <option value=""></option>

                                <option value="2006">2006</option>

                                <option value="2005">2005</option>

                                <option value="2004">2004</option>
                              </select>
                            </td>
                          </tr></table></td>

                    </tr></table><div></div><!--Start:
org.apache.myfaces.trinidad.Object["j_id20"]--><div
id="j_id20"
style="margin-top:15px"></div></div><div></div><!--Start:
org.apache.myfaces.trinidad.Command["j_id21"]-->
                <button id="j_id21" name="j_id21" type="button"
onclick="submitForm('mainTemplateform1',1,{source:'j_id21'});return
false;" class="fButton
x6l">Consultar</button><div></div><!--Start:
org.apache.myfaces.trinidad.Command["j_id22"]-->
                <button id="j_id22" name="j_id22" type="button"
onclick="submitForm('mainTemplateform1',1,{source:'j_id22'});return
false;" class="fButton x6l">Ficar</button><div></div>

				</div><div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><div>
              <hr class="x98"><div class="x9a"></div><div
class="x99"></div><div
class="x9b"></div></div><div></div></div><!--Start:
org.apache.myfaces.trinidad.Panel["mainTemplatepanelPage1"]--><div
class="x9c"><div class="x9d"><span class="x5a"><!--Start:
org.apache.myfaces.trinidad.Output["mainTemplateoutputFormatted1"]--><span
id="mainTemplateoutputFormatted1">(@VERSION@)
@VERSION-DATE@</span></span><span class="x5b"></span><span
class="x5c"></span></div></div></span>
      <input type="hidden" name="org.apache.myfaces.trinidad.faces.FORM"
value="mainTemplateform1"><span
id="_mainTemplateform1_Postscript"><input type="hidden"
name="org.apache.myfaces.trinidad.faces.STATE" value="!-20ad0190">
        <input type="hidden" name="source"><script>var
_resetmainTemplateform1Names=["source"];</script><script>var
_mainTemplateform1_Validations=['new
TrIntegerConverter(null,null,0,2147483647,-2147483648)'];function
_mainTemplateform1Validator(f,s){var fl =
_multiValidate(f,s,["selectAnoPnifa",0,,0,[]],0);if(fl.length>0){_validationAlert('Form
validation failures:'+fl);return false;}else{return true;}}var
_mainTemplateform1_Formats=['{0} - {1}'];var
mainTemplateform1_SF={};</script></span><script>_submitFormCheck();</script></form>

  <!-- MYFACES JAVASCRIPT -->

</body>
  <!--Created by Apache Trinidad (Apache Trinidad API -
1.0.0-incubating/Apache Trinidad Impl - 1.0.0-incubating),
Accessibility:disabled, skin:simple.desktop (simple)--></html>


> Francisco,
>
> Sure... Can you send the jsf code and the html rendered on the client
> page?
>
> -----Original Message-----
> From: Francisco Passos [mailto:francisco.passos@opensoft.pt]
> Sent: Monday, April 09, 2007 1:00 PM
> To: adffaces-user@incubator.apache.org
> Subject: RE: Keeping selectOneChoice selection
>
>
> Thank you for your hints.
>
> I will bear this in mind when I come to this situation - which will be
> soon enough.
>
> However, back to this this particular scenario where no table is involved,
> do you know of any way I manage to solve this problem?
>
>
>> Francisco,
>>
>> I have found that there is a fundamental problem with how
>> UINamingContainers are processed when row indexes are inserted into the
>> ids of EditableValueHolders within the container rows.
>>
>> Understanding The Problem:
>> As you may already know, tables have only columns referenced in the page
>> so it can handle an almost infinite number of rows. Well, because you
>> have
>> only specified an id for a component within the table column the
>> component
>> inserts a row index reference in the holders id (via getClientRowKey()
>> in
>> a table) for each row. This ensures that each iteration of that row has
>> a
>> unique id. The problem with this is that in some cases this breaks
>> automatic setting of bean values (if they are value bound to an
>> EditableValueHolder within a row). Another issue is that
>> "selectOneChoice"
>> components in particular do not have a mechanism in place to ensure that
>> a
>> submitted value that gets set on the component is one of the values
>> within
>> the internal "SelectItemList" so virtually any value can get set on it.
>> If
>> the submitted value is not in the list it adds a blank entry in the drop
>> down menu- what? I have also noticed that selectOneChoice component does
>> not handle value conversion like regular input text components do.
>> Semi-primitive values such as Integers, Booleans, etc. are not converted
>> automatically like they are for regular input text components. I had
>> some
>> of the same issues with the "detailStamp" so I created an extended table
>> component that allows only one toggled "detailStamp" at a time and
>> overrides the "getClientRowKey()" excluding row indexes for components
>> within the "detailStamp". This solution works very well, but still does
>> not address EditableValueHolders within the rows themselves. It seems to
>> me that we need to reevaluate the usage of inserting row indexes into
>> ids!
>>
>> Possible Solutions:
>> The first thing I would check is that you have the valuePassThru="true"
>> to
>> ensure that its not trying to use the index as the passed value (not
>> sure
>> why anyone would want to be restricted to just an index). If want to
>> ensure that your value is never set to a value that does not exist in
>> the
>> options you can use a value change listener:
>>
>>
>> 	/**
>> 	 * Verifies that an editable value holder event components value is a
>> valid
>> 	 * option. If it is not it sets it back to the old value.
>> 	 *
>> 	 * @see #getEditableValueHolderValue(EditableValueHolder)
>> 	 * @param event
>> 	 */
>> 	public final void verifyValueOption(ValueChangeEvent event) {
>> 		try {
>> 			if (event.getComponent() instanceof EditableValueHolder) {
>> 				EditableValueHolder valueHolder = (EditableValueHolder) event
>> 						.getComponent();
>> 				if (!isValidSelectOption(event.getComponent(), event.getNewValue()))
>> {
>> 					// invalid option- regress to old value
>> 					valueHolder.setValue(event.getOldValue());
>> 					valueHolder.setSubmittedValue(event.getOldValue());
>> 				}
>> 			}
>> 		} catch (Throwable e) {
>> 			log.warn("Unable to verify select value. " + e.getMessage()
>> 					+ " cause: " + e.getCause());
>> 		}
>> 	}
>>
>> 	/**
>> 	 * Determines if the specified value is a valid selection option in the
>> 	 * specified select component.
>> 	 *
>> 	 * @param component
>> 	 * @param value
>> 	 * @return is the specified value a valid select option
>> 	 */
>> 	public static final boolean isValidSelectOption(UIComponent component,
>> 			Object value) {
>> 		try {
>> 			List<SelectItem> items = SelectItemSupport.getSelectItems(
>> 					component, SelectItemSupport.getConverter(component));
>> 			for (SelectItem item : items) {
>> 				if (item.getValue() != null && item.getValue().equals(value)) {
>> 					return true;
>> 				}
>> 			}
>> 		} catch (Exception e) {
>> 			_LOG.warning("Unable to determine if the specified value: " + value
>> 					+ " is valid for the select component: " + component);
>> 		}
>> 		return false;
>> 	}
>>
>>
>>
>> Probably not the most elegant solution, but nonetheless an effective one
>> is to manage the submitted row index problems yourself. If nothing else
>> this will provide you with a debugging tool to determine if the row
>> index
>> references are preventing your values from getting set:
>> 	/**
>> 	 * <p>
>> 	 * Gets a parameter value from the request scope by an editale value
>> holder
>> 	 * components id. This method will set/return the holders submitted
>> value
>> 	 * from the request.
>> 	 * </p>
>> 	 * <p>
>> 	 * The holders client id is checked against a possible matching id
>> request
>> 	 * parameter. The client id of the holder and the request parameter
>> matching
>> 	 * the hodler id may have their own row indexing (such is the case with
>> a
>> 	 * select menu).
>> 	 * <ol>
>> 	 * <li>The client id against the request parameter</li>
>> 	 * <li>The client id w/o row index against the request parameter</li>
>> 	 * <li>The client id against the request parameter w/o row index</li>
>> 	 * </ol>
>> 	 * </p>
>> 	 *
>> 	 * @param context
>> 	 * @param holder
>> 	 * @return the parameter value
>> 	 */
>> 	@SuppressWarnings("unchecked")
>> 	public static final Object getRequestParameterByHolderId(
>> 			FacesContext context, EditableValueHolder holder) {
>> 		if (log.isDebugEnabled())
>> 			log.debug("getRequestParameterForNamingContainer(" + context + ','
>> 					+ holder + ")");
>> 		if (holder != null && holder instanceof UIComponent) {
>> 			String clientId = ((UIComponent) holder).getClientId(context);
>> 			String clientIdWithOutRowIds = removeRowIdReferences(clientId);
>> 			String id = ((UIComponent) holder).getId();
>> 			Map<String, Object> map = context.getExternalContext()
>> 					.getRequestParameterMap();
>> 			if (map != null && map.entrySet() != null) {
>> 				for (Map.Entry<String, Object> entry : map.entrySet()) {
>> 					if (entry.getKey().indexOf(id) >= 0) {
>> 						if (entry.getKey().equalsIgnoreCase(clientId)
>> 								|| entry.getKey().equalsIgnoreCase(
>> 										clientIdWithOutRowIds)
>> 								|| removeRowIdReferences(
>> 										entry.getKey()).equalsIgnoreCase(
>> 										clientId)) {
>> 							try {
>> 								setConvertedAndValidatedValue(context,
>> 												holder, entry.getValue());
>> 							} catch (Exception e) {
>> 								log.error("Unable to capture the converted "
>> 										+ "value for component(" + holder
>> 										+ ") value: " + entry.getValue(), e);
>> 							}
>> 							return holder.getSubmittedValue();
>> 						}
>> 					}
>> 				}
>> 			}
>> 		}
>> 		return null;
>> 	}
>>
>> 	/**
>> 	 * Removes any row id references that may exist within the specified
>> client
>> 	 * id
>> 	 *
>> 	 * @param clientId
>> 	 * @return the client id
>> 	 */
>> 	public static final String removeRowIdReferences(String clientId) {
>> 		if (log.isDebugEnabled())
>> 			log.debug("removeRowIdReferences(" + clientId + ')');
>> 		if (clientId != null) {
>> 			String[] ids = clientId.split(String
>> 					.valueOf(NamingContainer.SEPARATOR_CHAR));
>> 			for (String id : ids) {
>> 				try {
>> 					Integer.parseInt(id);
>> 				} catch (Exception e) {
>> 					continue;
>> 				}
>> 				clientId = clientId.replace(NamingContainer.SEPARATOR_CHAR + id
>> 						+ NamingContainer.SEPARATOR_CHAR, String
>> 						.valueOf(NamingContainer.SEPARATOR_CHAR));
>> 			}
>> 		}
>> 		return clientId;
>> 	}
>>
>> 	/**
>> 	 * Invokes the internal converter/validators(s) for an editable value
>> holder
>> 	 * and returns the converted value
>> 	 *
>> 	 * @param context
>> 	 * @param holder
>> 	 * @param value
>> 	 * @return the converted value
>> 	 * @throws ValidatorException
>> 	 * @throws EvaluationException
>> 	 * @throws MethodNotFoundException
>> 	 */
>> 	public static final Object setConvertedAndValidatedValue(FacesContext
>> context,
>> 			EditableValueHolder holder, Object value)
>> 			throws ValidatorException, EvaluationException,
>> 			MethodNotFoundException {
>> 		if (holder != null) {
>> 			if (holder.getConverter() != null) {
>> 				value = holder.getConverter().getAsObject(context,
>> 						(UIComponent) holder,
>> 						value != null ? value.toString() : null);
>> 			}
>> 			if (holder instanceof UIComponent) {
>> 				if (holder.getValidators() != null) {
>> 					for (Validator v : holder.getValidators()) {
>> 						v.validate(context, (UIComponent) holder, value);
>> 					}
>> 				}
>> 			}
>> 			if (holder.getValidator() != null) {
>> 				holder.getValidator().invoke(context, new Object[] { value });
>> 			}
>> 			holder.setSubmittedValue(value);
>> 			return value;
>> 		}
>> 		return null;
>> 	}
>>
>> -----Original Message-----
>> From: Francisco Passos [mailto:francisco.passos@opensoft.pt]
>> Sent: Monday, April 09, 2007 11:17 AM
>> To: William Hoover
>> Subject: RE: Keeping selectOneChoice selection
>>
>>
>> No, it is in a facet for a panelPage.
>>
>> In it, I have a panelGroupLayout, then a panelHorizontalLayout and
>> finally
>> in it the panelPage.
>>
>> If you feel it's best, I can attach the code or paste it in the mail
>> body.
>>
>> Either way, if the selectOneChoice were in a table (something I will
>> surely need), what would the solution be?
>>
>> Thank you,
>>
>> Francisco
>>
>>
>>
>>> Francisco,
>>>
>>> Is your selectOneChoice in a table?
>>>
>>> -----Original Message-----
>>> From: Francisco Passos [mailto:francisco.passos@opensoft.pt]
>>> Sent: Monday, April 09, 2007 10:55 AM
>>> To: adffaces-user@incubator.apache.org
>>> Subject: Keeping selectOneChoice selection
>>>
>>>
>>> Hello there.
>>>
>>> I'm new to JSF and Trinidad, so please bear with my simplistic doubts.
>>>
>>> I'm struggling to keep a selectOneChoice selection upon a postback
>>> using
>>> a
>>> request-scoped bean.
>>>
>>> At first I couldn't even maintain the values in the list, but I found
>>> that
>>> placing a h:inputHidden on the page and declaring its value to be
>>> #{myBean.valueList}, they could be kept. Furthermore I've tested the
>>> seme
>>> using pageFlow and it worked.
>>>
>>> However, I cannot keep the selected value in the dropdown list, it just
>>> resets.
>>>
>>> What is the correct way to do this simple task without using session
>>> beans?
>>>
>>> Thank you for your time and attention,
>>>
>>> Francisco Passos
>>>
>>>
>>>
>>
>>
>> Francisco Passos
>> Opensoft - Soluções Informáticas, Lda
>> Telemóvel:  +351 91 238 52 76
>> Escritório: +351 21 380 44 10
>> Email:      francisco.passos@opensoft.pt
>>
>>
>>
>
>
> Francisco Passos
> Opensoft - Soluções Informáticas, Lda
> Telemóvel:  +351 91 238 52 76
> Escritório: +351 21 380 44 10
> Email:      francisco.passos@opensoft.pt
>
>
>


Francisco Passos
Opensoft - Soluções Informáticas, Lda
Telemóvel:  +351 91 238 52 76
Escritório: +351 21 380 44 10
Email:      francisco.passos@opensoft.pt


Mime
View raw message