首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

在jsp中用表格显示Oracle中数据,该如何解决

2012-04-12 
在jsp中用表格显示Oracle中数据我这样写为什么不能在jsp页面中显示数据,上代码:jsp:%@ page languageja

在jsp中用表格显示Oracle中数据
我这样写为什么不能在jsp页面中显示数据,上代码:
jsp:

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.bean.list.ListBean"%>
<%@ page import="com.common.SessionBean" %>
<%
@SuppressWarnings("unchecked")
ArrayList<ListBean> list = (ArrayList<ListBean>)session.getAttribute("StartList");
String path = request.getContextPath();
SessionBean sessionBean = (SessionBean)session.getAttribute("SessionBean");

ListBean bean = null;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />

<link rel="stylesheet" type="text/css" href="<%=path %>/css/base.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/json2.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/common/js/common.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/common/js/messageControl.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/common/js/prototype-1.6.0.3.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/common/js/control.js"></script>

  <script language="javascript">
  window.onload=function(){
  var url = 'ajax_adminListAction.action';
  var params = {
  command : "LoadMenu"
  };
  var myAjax = new Ajax.Request(  
  url,  
  {method:'post',parameters:params,onComplete:adminList_onComplete,onException:fun_exception,asynchronous:false}); 
   
  }
  function adminList_onComplete(request){
  window.close();
  }
   
  function adminDel(USERID)
  {
  if(confirm('您确定删除吗?'))
  {
  window.location.href="<%=path %>/adminDel.action?USERID="+USERID;
  }
  }
   
  function adminAdd()
  {
  var url="<%=path %>/admin/index/adminAdd.jsp";
  //var n="";
  //var w="480px";
  //var h="500px";
  //var s="resizable:no;help:no;status:no;scroll:yes";
//openWin(url,n,w,h,s);
window.location.href=url;
  }
  </script>
</head>

<body leftmargin="2" topmargin="2" background='<%=path %>/images/allbg.gif'>
<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">


<tr bgcolor="#E7E7E7">
<td height="14" colspan="4" background="<%=path %>/images/tbg.gif">&nbsp;管理员维护&nbsp;</td>
</tr>
<tr align="center" bgcolor="#FAFAF1" height="22">
<td width="25%">ID</td>
<td width="25%">用户名</td>
<td width="25%">密码</td>
<td width="25%">操作</td>
</tr>
<!--<s:iterator value="#bean" id="list">-->
<%
int i=0;
int iMax=list.size();
  for (i=0;i<iMax;i++){
  bean=list.get(i);
  %>
<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
<td bgcolor="#FFFFFF" align="center">
<%=bean.getUSERID()%>
</td>
<td bgcolor="#FFFFFF" align="center">
<%=bean.getUSERNAME()%>
</td>
<td bgcolor="#FFFFFF" align="center">
<%=bean.getUSERPW()%>
</td>
<td bgcolor="#FFFFFF" align="center">
<a href="#" onclick="adminDel(<s:property value="#bean.USERID"/>)" class="pn-loperator">删除</a>
</td>
</tr>
<%} %>
<!--</s:iterator>-->
</table>

<table width='98%' border='0'style="margin-top:8px;margin-left: 5px;">
<tr>
<td>
<input type="button" value="添加" style="width: 80px;" onclick="adminAdd()" />
</td>
</tr>
</table>
</body>
</html>
action代码:

package com.action;

import java.util.ArrayList;
import java.util.Map;

import com.bean.list.ListBean;
import com.common.SessionBean;
import com.framework.exception.BaseException;
import com.manager.list.AdminListManager;

public class AdminListAction extends BaseAction
{
private static final longserialVersionUID= 1L;

private String command;

private AdminListManageradminListManager;
private Map<String, Object>session;


public String doExecute() throws Exception {
try {
if (this.command.equals("LoadMenu")) {
loadMenu();
}
} catch (Exception e) {
throw new BaseException("LoadMenu", "doExecute", e);
}
return SUCCESS;
}


private void loadMenu() throws Exception{
ArrayList<ListBean> arrList=null;

SessionBean sessionBean = (SessionBean) session.get("SessionBean");
ListBean listBean = new ListBean();

listBean.setUSERNAME(sessionBean.getUSERNAME());
listBean.setUSERPW(sessionBean.getUSERPW());
listBean.setUSERID(sessionBean.getUSERID());
arrList = adminListManager.select_list(listBean);

  session.put("StartList", arrList);

}
  public String getCommand() {
return command;
}


public void setCommand(String command) {
this.command = command;
}
public Map<String, Object> getSession() {
return session;
}


public void setSession(Map<String, Object> session) {
this.session = session;
}

public AdminListManager getAdminListManager() {
return adminListManager;


}


public void setAdminListManager(AdminListManager adminListManager) {
this.adminListManager = adminListManager;
}
}
向各位大神请教,这么写为什么不显示,先谢谢啦!

[解决办法]
这样一坨子大家没的办法看啊,你可以自己先简化这个页面先看能不能得到对象,可以先得其中的一个属性看看能不能得到,其他的先不要赋值

热点排行