Hi,
as far as I remember it is just about the name of <s:select /> > <s:select id="empresas" list="empresas" listKey="id" listValue="nome" > name="pessoaForm.empresa" label="Empresa" select="idDefaultSelection" />* This means your action needs a member "pessoaForm.empresa" and that one must be initialized with the preselected value. I don't think that you need the select attribute. Regards, Christoph > From: Guilherme Bisconcini <guilherme.bisconc...@sefisa.com.br> > To: user@struts.apache.org, > Date: 20.06.2016 23:49 > Subject: How to pre-select a select combo box > > Hi, > > I'm trying to pre-select a select combo box, for 2 hours. No success. Can > anyone give some help? > > Here are the JSP file > INIT >>>>> novaPessoa.jsp > > *<s:form id="formPessoa" action="registraNovaPessoa" theme="bootstrap"* > > * cssClass="well form-horizontal">* > > > * <!-- Para montar objeto PessoaForm -->* > > * <s:bean name="br.com.xyz.portaria.controller.forms.PessoaForm" > var="pessoaForm">* > > > * ################## HERE ARE THE SELECTION COMBO BOX!* > > * <s:select id="empresas" list="empresas" listKey="id" listValue="nome" > name="pessoaForm.empresa" label="Empresa" select="idDefaultSelection" />* > > * <!-- Botao nova EMPRESA AJAX -->* > > * <sj:a id="buttonNovaEmpresa" href="novaEmpresa" targets="funcional">* > > * <button type="button" class="btn btn-warning">Nova Empresa</button>* > > * </sj:a>* > > * <br>* > > * <br>* > > * <s:textfield id="nome" label="Nome Pessoa" tooltip="O nome COMPLETO da > pessoa!" name="pessoaForm.nome" placeholder="Nome" > value="%{pessoaForm.nome}" />* > > * <s:textfield id="rg" label="RG" tooltip="RG pessoa, tudo junto sem > espaços!" name="pessoaForm.rg" placeholder="RG" value="%{pessoaForm.rg}" />* > > * </s:bean>* > > * <!-- Textfield de motivo -->* > > * <s:textarea label="Motivo" tooltip="Digite o MOTIVO QUE A PESSOA VEI > FAZER AQUI!" placeholder="MOTIVO; VAI FALAR COM QUEM? FAZER O QUE?" > name="motivoEntrada" cols="20" rows="3"/>* > > > * <sj:submit value="Registrar Entrada" cssClass="btn btn-primary"* > > * targets="funcional" />* > > > > > *</s:form>* > > > END <<<<<<< novaPessoa.jsp > > > The controller is nothing special, I have only a int declared > "idDefaultSelection" with getter and setter who are supposed to send the > parameter to the "select" option of the form above. What I'm doing wrong? > > Thanks in advance > > > Bisconcini This Email was scanned by Sophos Anti Virus