Request paramter value is truncated to first part when it contains spaces

前端 未结 2 906
一个人的身影
一个人的身影 2020-12-04 04:10

I have a strange issue with dropdown boxes in jsp/servlet. Here it is...

  
                        
    
提交评论

  • 2020-12-04 04:38

    You need to quote the value.

    <option value="<%=locationDO.getLocationName().trim()%>">
    

    The space is namely a HTML attribute separator. A browser with a bit decent syntax highlighter would already have hinted it when you have checked the generated HTML by rightclick page > View Source.

    <option value=Aztec Auto Ltd>
    

    versus

    <option value="Aztec Auto Ltd">
    
    0 讨论(0)
  • 提交回复
    热议问题