<select id="selectcity" parameterType="city" resultType="city"> select * from t_city <where> <if test="cityNo!=null and cityNo!=''"> cityNo like '%${cityNo}%' </if> <if test="cityName!=null and cityName!=''"> and cityName like '%${cityName}%' </if> </where> </select>
<form action="/city/selectcity.action" method="post"> 城市编号<input type="text" name="cityNo"> 城市名称<input type="text" name="cityName"> <input type="submit" value="查询"> </form>