How to set a select field with a predefined value

0

I need to make the select field bring me the information that is in

asked by anonymous 25.11.2016 / 15:47

2 answers

1

I do not remember jsp very well But the idea is this

if(endereco.getEstado().equals("sp")){ 
  //manda printar o html aqui
  //exemplo
  <option value="<%=endereco.getEstado()%>" selected>SP</option> 
}
    
25.11.2016 / 16:25
-1

Use the html to make an option checked

<select name="estado">
  <option value="sp" selected>São Paulo</option>
</select>
 
    
25.11.2016 / 15:53