81,122
社区成员




package com.ars.struts.car_book.action;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.ars.mybatis.car_book.entity.CarBrand;
import com.ars.mybatis.car_book.services.ICbService;
@Controller@Scope("prototype")
public class CbAction {
@Resource ICbService cbService;
private static final long serialVersionUID = 1L;
private List<CarBrand> carbrands;
public List<CarBrand> getCarbrands() {
return carbrands;
}
public void setCarbrands(List<CarBrand> carbrands) {
this.carbrands = carbrands;
}
/**
* 绑定厂牌
* @return String
* @exception Exception
*/
public String cbManage() throws Exception {
carbrands = cbService.getCarBrand();
setCarbrands(carbrands);
if (carbrands != null) {
return "success";
} else {
return "error";
}
}
}
<%@ page contentType="text/html;charset=GBK"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>用车宝典-后台管理</title>
</head>
<body>
<s:action name="cbManage" namespace="/cb"></s:action>
test
<form id="form1">
<div>
<s:select name="carbrand" id="carbrand" list="carbrands"
listValue="brand_name" listKey="brand_id" headerKey="-1"
headerValue="厂牌">
</s:select>
<input type="submit" value="test" />
</div>
</form>
</body>
</html>