在struts中获取form中的select的值时action类该怎么写,求详细点。

jsp中:<formaction="../eszzAction_findEszzAllByType.action"method="post"><selectname="t... jsp中:<form action="../eszzAction_findEszzAllByType.action" method="post" >
<select name="type" id="search">

<option value="生活用品">
生活用品
</option>
<option value="图书资料">
图书资料
</option>
<option value="学习用品">
学习用品
</option>
<option value="体育用品">
体育用品
</option>
</select>

<input name="submit" type="submit" value="查询" >
</form>
action类:public String findEszzAllByType(){

String type = (String) request.getParameter ("type");

if (type =="图书资料"){
List<Eszz> eszzList = objectManager.getUtil("from Eszz where type = '图书资料'" );
ActionContext.getContext().put("eszzList", eszzList);
}else if (type =="生活用品"){
List<Eszz> eszzList = objectManager.getUtil("from Eszz where type = '生活用品'" );
ActionContext.getContext().put("eszzList", eszzList);
}else if (type =="体育用品"){
List<Eszz> eszzList = objectManager.getUtil("from Eszz where type = '体育用品'" );
ActionContext.getContext().put("eszzList", eszzList);
}else {
List<Eszz> eszzList = objectManager.getUtil("from Eszz where type ='学习用品'" );
ActionContext.getContext().put("eszzList", eszzList);
}
</td>
展开
 我来答
又在厕所弹钢琴
2016-12-16 · TA获得超过169个赞
知道小有建树答主
回答量:124
采纳率:0%
帮助的人:81.5万
展开全部
字符串判断用equals
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式