struts中 为什么jsp显示不了数据库的值(在线等)
来源:百度知道 编辑:UC知道 时间:2024/06/23 04:04:50
郁闷 研究了很长时间没有结果 jsp显示的结果只能显示标题
这是我java中代码
public class MaterialAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest arg2, HttpServletResponse arg3)
throws Exception {
MaterialForm from = (MaterialForm)form;
ContentPool Pool = new ContentPool();
int result = 0;
String result1 = null;
List list = new ArrayList();
try{
if(from.getMaterial().length()>0&&from.getRadio1()!=null){
String sql = "select material_id,material_name,material_unit from material where material_id ='"+from.getMaterial()+ "'";
ResultSet rs = Pool.executeQuery(sql);
这是我java中代码
public class MaterialAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest arg2, HttpServletResponse arg3)
throws Exception {
MaterialForm from = (MaterialForm)form;
ContentPool Pool = new ContentPool();
int result = 0;
String result1 = null;
List list = new ArrayList();
try{
if(from.getMaterial().length()>0&&from.getRadio1()!=null){
String sql = "select material_id,material_name,material_unit from material where material_id ='"+from.getMaterial()+ "'";
ResultSet rs = Pool.executeQuery(sql);
你怎么写得乱七八糟的? 都放到list里去了。在JSP里遍历出来不就行了?你是用struts做的?
struts它是基于mvc模式,你怎么把对数据库操作的都写到action里面去了呢?应该写到JavaBean里,写那个方法返回一个list对象,在jsp里面调用那个方法,然后request.setAttribute("list", list); 接着再里面先用<bean:logic>判断接着再用<bean:write>标签输出。
谁知道在liferay中运用struts为什么我写的jsp不好用,高分求助
struts中action,jsp,form是如何传值的?
jsp 变 struts !!!! 急!!!!!!
jsp项目改用struts实现
STRUTS ,JSP传值问题?
Struts+jstl做项目,为什么我的jsp页面struts的forward方法转向以后,css就不起作用拉?
用jsp,struts开发的电子商务网站中如何使用管理模板?
struts相关:jsp页面中如何获取formbean中的数组的值
在jsp中怎样用struts实现二级联动菜单呀?请给出示例源码,谢谢!!
struts框架怎么从.jsp页面直接跳到action中