<c:forEach>取不到值,求大神帮忙!

取不到值,通过测试list里面有值,但 取不到值

        <c:forEach items="${list}" var="emp">
       <tr> 
         <td>${emp.id}</td>
         <td>${emp.name}</td>
         <td>${emp.age}</td>
         <td>${emp.gender}</td>
         <td>${emp.birth}</td>
         <td>${emp.salary}</td>
         <td>${emp.deptno}</td>
         <td>
           <input type="button" value="添加" onclick="location.href='add.html';" />
           <input type="button" value="修改" onclick="location.href='modify.html';"/>
           <input type="button" value="删除" onclick="delete();"/>
         </td>
       </tr>
     </c:forEach>    


    List<Emp> list = simp.findAll();    
    req.setAttribute("list", list);
    req.getRequestDispatcher("/find.jsp").forward(req,res);

6个回答

控制台跟者前台有报错没

weixin_41839635
我见众生皆草木 回复weixin_39173884:我也遇到这个问题了,web.xml中怎么配置这个标签的的路径啊
一年多之前 回复
Z_veal
Z_veal 回复影子邪: 路径问题你页面list就是没有值,网页是报错的,有没有值按F12可以看
接近 2 年之前 回复
weixin_39173884
影子邪 问题解决了,不是foreach的问题,是我的web.xml里面路径有点问题,谢谢打击了
接近 2 年之前 回复
sinat_34344123
lvgo 页面应该是报错了
接近 2 年之前 回复
Z_veal
Z_veal 回复影子邪: 按F12查看下 显示什么
接近 2 年之前 回复
Z_veal
Z_veal 回复影子邪: 里面的值截图看下
接近 2 年之前 回复
Z_veal
Z_veal 回复影子邪: 页面list有值没?
接近 2 年之前 回复
weixin_39173884
影子邪 没有报错
接近 2 年之前 回复

试试加上作用域

<c:forEach items="${requestScope.list}" var="emp">
weixin_39173884
影子邪 试过了,没用
接近 2 年之前 回复

看看标签是否引对,<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

weixin_39173884
影子邪 都看过了,没错
接近 2 年之前 回复

你看看是不是顺序问题。

weixin_39173884
影子邪 顺序没有错
接近 2 年之前 回复

但看你的代码片段,没办法有效的分析问题。我简单说明下变量的作用域关系,你对比的分析下:
request.setAttribute()->该方式设置的变量仅在访问的当前页面有效,发生任何页面级的跳转、重定向都会失效。
request.getSession().setAttribute()->该方式设置的变量在用户发生页面访问到关闭浏览器之前始终有效。
关于jstl用法,详细可能有误,太久没用不太记得了。
${list}这个访问的默认是page页面变量,也就是你写在当前页中的变量。
读取request或者session用的应该是类似: ${request.list} 或者 ${session.list} 这种。具体叫什么我不记得了。你可以找下。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
c: foreach 取不到值
[img=https://img-bbs.csdn.net/upload/201612/22/1482415727_574410.png][/img]
取不到值,求大神帮忙!
取不到值,通过测试list里面有值,但 取不到值n n n n $emp.idn $emp.namen $emp.agen $emp.gendern $emp.birthn $emp.salaryn $emp.deptnon n n n n n n n n n List list = simp.findAll(); n req.setAttribute("list", list);n req.getRequestDispatcher("/find.jsp").forward(req,res);n
foreach循环取不到值,求指导
显示页面:rn<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"rn pageEncoding="utf-8"%>rn<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>rnrnrnrn rn showrnrnrn rnrn rn rn 编号 名字 年龄 电话 地址 操作rnrn rn $a.id rn $a.namern $a.agern $a.telrn $a.addressrn 修改rn删除rnrnrnrnrnrnrn[color=#FF0000]servlet[/color]rnpackage comcn.query;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnimport java.util.ArrayList;rnimport java.util.List;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnpublic class ShowServlet extends HttpServletrn public void destory()rn super.destroy();rn rn public void doGet(HttpServletRequest request,HttpServletResponse response)rn rn response.setContentType("text/html");rn try rn PrintWriter out=response.getWriter();rn this.doPost(request, response);rn out.flush();rn out.close();rn catch (IOException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn catch (ServletException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletExceptionrn response.setContentType("text/html");rn PrintWriter out=response.getWriter();rn Listlist=new ArrayList();rn Query query=new Query();rn list=query.showUser();rn request.setAttribute("list", list);rn request.getRequestDispatcher("/NewFile.jsp").forward(request,response);rn rn out.flush();rn out.close();rn rnpublic void init()throws ServletExceptionrn rnrn链接数据库rnpackage comcn.query;rnrnimport java.sql.Connection;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnimport java.util.ArrayList;rnimport java.util.List;rnrnpublic class Query rnpublic ListshowUser()rn Connection conn=null;rn Statement stmt=null;rn ResultSet rs=null;rn List list=new ArrayList();rn rn conn=jdbc.getConnection();rn try rn stmt=conn.createStatement();rn rs=stmt.executeQuery("select * from users");rn rn while(rs.next())rn System.out.println("00000");rn Uservo uservo=new Uservo();rn uservo.setId(rs.getInt("id"));rn System.out.println(rs.getInt("id"));rn uservo.setName(rs.getString("name"));rn uservo.setAge(rs.getInt("age"));rn uservo.setTel(rs.getString("tel"));rn uservo.setAdress(rs.getString("address")); rn System.out.println(rs.getString("address"));rn list.add(uservo);rn rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rn return list;rn rnrnrnrn[color=#FF0000]XML[/color]rnrnrn aarn rn index.htmlrn index.htmrn index.jsprn default.htmlrn default.htmrn default.jsprn rn rn rn ShowServletrn comcn.query.ShowServletrn rn rn ShowServletrn /ShowServletrn rn rnrnrn检测过后台能读到值,但JSP页面无法显示。求指导。rn
页面取不到值,求大神帮忙啊
[img=https://img-bbs.csdn.net/upload/201309/04/1378274514_904821.png][/img][img=https://img-bbs.csdn.net/upload/201309/04/1378274523_871796.jpg][/img]
java web c:foreach为什么取不到值
这是控制层代码:n![图片说明](https://img-ask.csdn.net/upload/201802/28/1519808522_741489.png)n这是showcourse.jsp代码:n![图片说明](https://img-ask.csdn.net/upload/201802/28/1519808643_658200.png)n运行结果:n![图片说明](https://img-ask.csdn.net/upload/201802/28/1519808684_69711.png)n
大神帮忙 下拉菜单取不到值 SSH EL表达式
[img=https://img-bbs.csdn.net/upload/201305/28/1369756690_143461.jpg][/img]rn资产类型的下拉框有值,而部门的却没有。rn以下是EL表达式:rn[code=html] rn rn 资产类型:rn rn rn rn rn $u.type_name rn rn rn rn [/code]rnrn[code=html] rn rn 所属部门:rn rn rn rn rn $u.dept_namern rn rn rn [/code]rnrn当执行增加部门后,下拉菜单又有值了。
c:forEach如何取集合值?
有2个实体,A和B,是一对多的关系,A中有属性Set items=new HashSet(),B中有属性A a=new A();数据持久化我用的是hibernate;rn我想在JSP中把所有A的属性都列出来,包括Set items中的第一个元素的id,这个值怎么取?rn(A我已经保存在request中了) request.setAttribute("as", as);rnrn$a.idrn$a.items.id (这样写肯定是不对的)rnrn如果Set该成List也可以
帮忙啊,取不到cookie值
做自动下载网页数据rn用vb.net自带的webbrowser控件取得cookie比ie(ver8)取得cookie少两个值。rn
cookie取不到值,帮忙看看
rn在login.aspx页面点按钮rnprotected void btnLogin_Click(object sender, ImageClickEventArgs e)rn rnHttpCookie cookie = new HttpCookie("COOKIES_USERINFO");rn cookie.Value = "aaa";rn cookie.Expires = System.DateTime.Now.AddYears(1); //1年rn cookie.Path = string.Empty;rn Response.Cookies.Add(cookie); rnrn Response.Redirect("~/index.aspx");rnrnrn在index.aspx页面Page_Load取值rnResponse.Cookies["COOKIES_USERINFO"].Valuern为空rnrn哪里有问题吗?IE设置cookie是可用的。
cookie取不到值
在项目中遇到html页面需要做一些记忆操作,选择把记忆操作的值存储在cookie中,遇到了某些页面可以获取有些页面获取不到,查阅了一番资料发现cookie也是有路径权限的。 cookie默认路径:当前访问的servlet父路径。 例如:我在http://localhost:8080/myProject/a/b/c/test.html页面设置了一个cookie,我在myProject/a/b/c...
为什么取不到值?
其实我的本意是就让html控件间相互赋值rn以下代码取不到值。显示的是 [undefined]rnfunction Button1_onclick() rnrn document.getElementById("Text1").innerText = rn document.getElementById("Button1").Value ; rn rnrndocument.getElementById("Button1") 后面根本没有Value的选项。但是我确实定义了呀。
request.QueryString()取不到值
我做一个产品展示,在Produclist.aspx页面中列出产品图片和名称,想在Productdetail.aspx页面中显示详细信息,rn代码如下rn.....rn想利用 request.QueryString["productId"进行进一步查询,可是却接收不到值我做了一天了,希望高人指教
取不到隐藏域的值
正在学习ASP+javascriptrnrnrnrn rn rnrn 隐藏域的值是[color=#FF0000]<%=Request.Form("factt")%>[/color]rn rnrn红颜色的,取不到值rn而绿颜色的,能取到值rnrn这是什么原因呢?rn
xmlhttp.responseXML.getElementsByTagName取不到值。
var xmlhttp = new XMLHttpRequest();rnxmlhttp.open('POST', '../servlet/ajaxServlet', true);rn rnxmlhttp.onreadystatechange = function() rn if (xmlhttp.readyState == 4) rn if (xmlhttp.status == 200)rn alert(xmlhttp.responseXML.xml);rn alert(new XMLSerializer().serializeToString(xmlhttp.responseXML.getElementsByTagName("div")[0])); rn rn rnrn我修改服务器端送回来的xml字段(xmlhttp.responseXML.xml),rn如果是 " test";rn就取不到值。rnrn如果是 " test",就能alert出来。rnrn和解? rn怎么样才能把第一种情况的div值取出来?rn
Request.QueryString取不到值
一个页面A放一个GridView,一个页面B放FormViewrnFormView里有一个ImageButton(一个“赞”)rn现在就是想实现,点一下就+1(初始值是0),于是用Request.QueryString去取页面A的GV里的被选中的id。rn可是取不到,这是为什么?rnrn[code=csharp]protected void btngood_Click(object sender, EventArgs e)rn rn string god=Request.QueryString["id"];rn string connectionString = ConfigurationManager.ConnectionStrings["lijunConnectionString"].ConnectionString;rn SqlConnection cnn = new SqlConnection(connectionString);rn string st = "update Article set good=good+1 where artid='"+@god+"'";rn cnn.Open();rn SqlCommand cmd = new SqlCommand(st, cnn);rn SqlDataReader rdr = cmd.ExecuteReader(); rn [/code]rn
存储过程取不到值
用mysql写了个存储过程,写了张临时表,然后想用游标循环这个表中的某个字段,定义游标和写入临时表的数据都没有问题,但用游标循环的时候就报错了,错误是rn1329 - No data - zero rows fetched , selected, or processedrnrn以下是代码,请帮忙解决一下,谢谢rnrn[code=SQL]rnbeginrnrn DECLARE mysql VARCHAR(1000) CHARSET utf8;rn DECLARE s_column VARCHAR(1000);rn DECLARE e_column VARCHAR(1000);rn DECLARE cash_total decimal(12,2);rn DECLARE estateId int;rn DECLARE cash_max decimal(12,2);rnrn DECLARE cur CURSOR FOR SELECT DISTINCT(ESTATE_ID)rn FROM tmp_cash_record;rnrn /* Create temporary table */rn DROP TABLE IF EXISTS tmp_cash_record;rn CREATE TEMPORARY TABLE tmp_cash_record(rn `ESTATE_ID` int NOT NULL,rn `ESTATE_NAME` varchar(50) collate utf8_unicode_ci NOT NULL,rn `CUSTOMER_NAME` varchar(50) collate utf8_unicode_ci NOT NULL,rn `CUSTOMER_ADDRESS` varchar(50) collate utf8_unicode_ci NOT NULL,rn `CUSTOMER_TEL` varchar(50) collate utf8_unicode_ci NOT NULLrnrn ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;rnrn /* Create temporary table */rn DROP TABLE IF EXISTS tmp_cash_record_estate;rn CREATE TEMPORARY TABLE tmp_cash_record_estate(rn `ESTATE_ID` int NOT NULL,rn `ESTATE_NAME` varchar(50) collate utf8_unicode_ci NOT NULL,rn `CASH_TOTAL` decimal(12,2) NOT NULL default '0.00',rn `TOTAL` decimal(12,2) NOT NULL default '0.00',rn `CASH_TOTAL_RATE` decimal(12,2) NOT NULL default '0.00',rn `CUSTOMER_TOTAL` int NOT NULL,rn `CASH_MAX` decimal(12,2) NOT NULL default '0.00'rn ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;rnrnrnrnrn SET s_column = "ESTATE_ID, ESTATE_NAME, YF_MONEY,CUSTOMER_NAME, CUSTOMER_ADDRESS, CUSTOMER_TEL";rn SET mysql = CONCAT('insert into tmp_cash_record(',s_column,')' );rn SET mysql = CONCAT(mysql ,"select s.ESTATE_ID, s.ESTATE_NAME, r.YF_MONEY, c.CUSTOMER_NAME, c.CUSTOMER_ADDRESS, c.CUSTOMER_TEL" );rn SET mysql = CONCAT(mysql, " FROM cash_record_", regionCode, " AS r, sys_estate_2_0_", regionCode, " AS s, cash_record_customer_", regionCode, " AS c");rn SET mysql = CONCAT(mysql, " WHERE r.id = c.CASH_ID AND s.ESTATE_ID = c.ESTATE_ID AND r.CASH_DATETIME BETWEEN '",beginDate," 00:00:00' and '",endDate," 23:59:59' " );rnrn SET @sql = mysql;rn PREPARE stmt FROM @sql;rn EXECUTE stmt;rn DEALLOCATE PREPARE stmt;rnrnrn SET mysql = CONCAT('insert into tmp_cash_record(',s_column,')' );rn SET mysql = CONCAT(mysql ,"select s.ESTATE_ID, s.ESTATE_NAME, r.YF_MONEY, c.CUSTOMER_NAME, c.CUSTOMER_ADDRESS, c.CUSTOMER_TEL" );rn SET mysql = CONCAT(mysql, " FROM cash_record_history_", regionCode, " AS r, sys_estate_2_0_", regionCode, " AS s, cash_record_customer_", regionCode, " AS c");rn SET mysql = CONCAT(mysql, " WHERE r.id = c.CASH_ID AND s.ESTATE_ID = c.ESTATE_ID AND r.CASH_DATETIME BETWEEN '",beginDate," 00:00:00' and '",endDate," 23:59:59' " );rnrn SET @sql = mysql;rn PREPARE stmt FROM @sql;rn EXECUTE stmt;rn DEALLOCATE PREPARE stmt;rnrn SELECT ifnull(sum(YF_MONEY) , 0)INTO cash_total FROM tmp_cash_record;rn SET e_column = "ESTATE_ID, ESTATE_NAME, CASH_TOTAL,TOTAL, CASH_TOTAL_RATE, CUSTOMER_TOTAL,CASH_MAX";rnrn SET mysql = CONCAT('insert into tmp_cash_record_estate(',e_column,')' );rn SET mysql = concat( "SELECT ESTATE_ID, ESTATE_NAME,SUM(YF_MONEY) , ", cash_total, " AS 'CASH_TOTAL', ROUND(SUM(YF_MONEY) *100/",cash_total,", 2) , COUNT(DISTINCT CUSTOMER_TEL),0.00");rn SET mysql = concat(mysql, " from tmp_cash_record group by ESTATE_NAME ORDER BY CASH_TOTAL DESC LIMIT ", pageCount, " , ", pageSize, ";");rnrn SET @sql = mysql;rn PREPARE stmt FROM @sql;rn EXECUTE stmt;rn DEALLOCATE PREPARE stmt;rnrn OPEN cur;rn FETCH cur INTO estateId;rnrn WHILE ( estateId is not null) DOrnrn SELECT MAX(CASH) FROM(SELECT sum(t.YF_MONEY) as 'CASH' FROM tmp_cash_record AS t GROUP BY t.CUSTOMER_TEL) AS NUM INTO cash_max;rn SET mysql = CONCAT("UPDATE tmp_cash_record_estate SET CASH_MAX = ",cash_max," WHERE ESTATE_ID =", estateId);rn SET @sql = mysql;rn PREPARE stmt FROM @sql;rn EXECUTE stmt;rn DEALLOCATE PREPARE stmt;rnrnrn FETCH cur INTO estateId;rn END WHILE;rn CLOSE cur;rnrnrnrn /*SELECT COALESCE(COUNT(distinct ESTATE_NAME),0) INTO totalCount FROM tmp_cash_record;*/rnrnendrn[/code]
Request.Form 取不到值
我在服务端的gridview中手写了一个gridview.Rows[0].cells[0].Text = "",然后客户端的gridview里生成了一个输入框。我输入任意值然后点按钮提交,想用Request.Form["bud_Summary_Nm"]来取得我输入的值,结果取不到,有哪位高手遇见过次问题帮忙解决一下,谢谢。
jquery 取不到值
[code=JScript]rn var $element = $('body:not(.drupalorg-site-main.front) #edit-search-theme-form-1'),rn value = $element.siblings('label').text();rn[/code]rnrnrn[code=HTML]rn rn Search Inkebook.com rn rn rnrn[/code]rnrnvalue为什么没取到值, rn我是用firebug , 在这个页面(http://www.inkebook.com/)执行一下代码rnrn提示:TypeError: element is nullrn[在此错误处中断] rnrnvalue = element.siblings('label').text();
WebBrowser.StatusText 取不到值
WebBrowser 文档内容加载完成后,鼠标没有进行在页面上滚动或移动到其他链接上的一次操作, 在点击超链接弹出新窗口的时候 StatusText 为空,这个怎么解决?rnprivate void browser_NewWindow(object sender, System.ComponentModel.CancelEventArgs e)rn rn var _url = ((System.Windows.Forms.WebBrowser)sender).StatusText; rn browser.Navigate(_url);rn e.Cancel = true;rn
ViewBag取不到值
HomeController 下的Index Action,ViewBag.test="123"rn然后在前台有个按钮,点击按钮发送Ajax请求到后台的GetData()方法rnGetData()方法下 ViewBag.test = "456";rn但是前台ajax的回调函数里取@ViewBag.test值还是"123"rn如果在GetData()方法中设置ViewBag.test2 = "456"; 前台取@ViewBag.test2值为空。rn请教这是怎么回事?对MVC还不是特别熟悉,请指点。rn
session值取不到
我有一个seesion是在异步方法中赋值的,当session的保存方式是InProc时没问题,但是现在为了session不丢失,把session的保存方式改为StateServer,但是改后session值就取不到了。我跟踪已经确定是在异步方法中赋值取不到,其他地方给session赋值都可以取到。求助!
取不到值,怎么回事???
rn有一个用户控件 .ASCX 文件rnrn他里面包含了,一个Repeater控件,而Repeater控件中 又 包含了一个标签控件 LabelrnrnRepeater数据已经绑定,现在要在 这个用户控件中的后台编码文件中 取 Label的值,rnrn 试了好多边取不到 ????rnrnResponse.Write(((Label)rpt.Items[1].FindControl("lbl")).Text);rn
为何取不到值,
QUESTION:1rn dim conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=i:\web\d.mdb")rn dim objcmd as OleDbCommand=new OleDbCommand("showbulletin",conn)rn objcmd.CommandType=CommandType.StoredProcedurern dim objPara as OleDbParameterrn objpara=objcmd.Parameters.add("@id",Oledbtype.integer)rn objpara.direction=parameterDirection.Inputrn objpara.value=3rnrn dim objreader as OleDbDataReaderrn tryrn objcmd.connection.open()rn objreader=objcmd.executeReaderrn lbltitle.text=objreader.getstring(0)rn lbldate.text=objreader.getstring(2)rn txttext.text=objreader.getstring(1)rn txtnickname.text=objreader.getstring(3)rn catch ex as OleDbExceptionrn throw exrn finallyrn conn.closern end tryrnrnSQL SENTENCE:rntable:bulletin ,manrnSELECT [bulletin].[title], [bulletin].[text], [bulletin].[noticedate], [bulletin].[reply], [man].[nickname]rnFROM bulletin LEFT JOIN man ON [bulletin].[relatedman]=[man].[id]rnWHERE [bulletin].[id]=[@id]rnORDER BY [bulletin].[noticedate] DESC;rn在数据库中查询是正常的,ID为自增型。rnrn运行错误提示:No data exists for the row/column.rn但是如果objcmd.executescalar却能返回第一个字段的值!rn求解!rnQUESTION 2:rnrnDATAGRID中,SELECT后触发db_onselect事件;有个查询rnSELECT TOP 40 bulletin.id,bulletin.title FROM bulletinrn当在DATAGRID中选取某行时,如何得到该行bulletin.id的值。rn我用<%# DataBinder.Eval(Container.DataItem, "string" %> 提示:rn'DataBinding' is not an event of 'System.Web.UI.WebControls.ButtonColumn'rn该如何解决?rn谢谢!rn
为什么取不到值
<%@ page contentType="text/html;charset=gb2312" %>rn<%@ page language="java" import="java.sql.*" %>rnrn<%!rn public String getStr(String str)rn rn tryrn rn String temp_p=str;rn byte[] temp_t=temp_p.getBytes("ISO8859-1");rn String temp=new String(temp_t);rn return temp;rn rn catch(Exception e)rn rn e.printStackTrace();rn rn return null;rn rn rn%>rn<%! //处理输入的信息内容rn //该函数能够将字符串sstr中的'\n'、'\r'转换为 ;rn //也能够将字符串sstr中的转换为%nbsp;;rn public static String returnTobr(String sstr)rn rn if(sstr==null||sstr.equals(""))rn rn return sstr; rn rn StringBuffer sTmp=new StringBuffer();rn int i=0;rn while(i<=sstr.length()-1)rn rn if(sstr.charAt(i)=='\n'||sstr.charAt(i)=='\r')rn rn sTmp=sTmp.append(" ");rn rn else if(sstr.charAt(i)==' ')rn rn sTmp=sTmp.append(" ");rn rn elsern rn sTmp=sTmp.append(sstr.substring(i,i+1));rn rn i++;rn rn String s1=sTmp.toString();rn return s1;rn rn%>rn<%! //处理输入的信息内容rn //该函数能够将字符串sstr中的'<'转换为"<";rn //能够将字符串sstr中的'>'转换为">";rn public static String returnTohtml(String sstr)rn rn if(sstr==null||sstr.equals(""))rn rn return sstr;rn rn StringBuffer sTmp1=new StringBuffer();rn int i=0;rn while(i<=sstr.length()-1)rn rn if(sstr.charAt(i)=='<')rn rn sTmp1=sTmp1.append("<");rn rn else if(sstr.charAt(i)=='>')rn rn sTmp1=sTmp1.append(">");rn elsern rn sTmp1=sTmp1.append(sstr.substring(i,i+1));rn rn i++;rn rn String s2=sTmp1.toString(); rn return s2;rn rn%>rn<%! //定义变量rn String author,title,content;rn%>rn<% rn if(session.getAttribute("username")!=null)rn rn author=(String)session.getAttribute("username");rn rn title=returnTobr(returnTohtml(request.getParameter("title")));rn content=returnTobr(returnTohtml(request.getParameter("content")));rn rn author=getStr("author");rn title=getStr("title");rn content=getStr("content");rn rn%>rn<% //执行数据库操作,发布新的帖子rn String sqlinsert="insert into sendnew(author,title,content)";rn sqlinsert=sqlinsert+"Values('"+author+"','"+title+"','"+content+"')";rn workM.executeQuery(sqlinsert);rn%>rn rn rn rn rn<% //显示用户名rnif(session.getAttribute("username")!=null)rnout.println(session.getAttribute("username"));rnrn%> 当前位置:首页 -> 论坛 -> 发表新言论成功rn rn rn rn rn 返回个性论坛rn 返回java论坛rn rn rn
取不到datagird的值,
private void getInput()rn rn DataTable dt =( DataTable) (ViewState["myDataTable"]) ;rn// foreach (DataGridItem di in this.dgDetails.Items)rn// rn//rn// if (di.ItemType == ListItemType.Item || di.ItemType == ListItemType.AlternatingItem)rn// rnrnrnrn for(int i=0;i
sqldatasource取不到值
请各位帮我看看下面代码的问题,如果直接在label1的text中赋值,则下拉列表有结果,但是如果把值先赋给字符串,再把字符串赋给label,下拉就得不到结果,我觉得应该是sqldatasource取不到值得原因。rn <%rn string s = "2012-3";rn Label1.Text = s;rn %>rn rn rn rn rn rn rn rn
session取不到值
问题是这样的rn我们现在用session存放用户名,rn打一个比方rnwww.csdn.net里面可以取到sessionrn域名解析后的网址 111.csdn.com 取不到sessionrnrn请问怎么解决。
取不到dropdownlist的值
updatepanel中放了一个gridview,gridview的某一列包含一个dropdownlist控件,但是编辑保存的时候取到的始终是dropdownlist的第一项,这是为什么?
document.getElementById取不到值???
[b]html文件[/b]rn哈哈哈哈哈哈rnrn....(省略)rnrn[b]js文件[/b]rnfunction selectpin(str,str2,str3)rn....(省略)rnxmlhttp.open('get',encodeURI('abc.asp?d_class='+ str +'&d_ii='+ str2 +'&d_cc='+ str3 +'&'+new Date().getTime()),false);rn....(省略)rnrnrnstr跟str2取值都正常,就是str3取值总是undefined,怎么办?rnrn
cookies取不到值?
写cookiesrn Cookie cookie1=new Cookie("login_name","guest");rn Cookie cookie2=new Cookie("login_pass",strPwd);rn System.out.println("======================");rn cookie1.setMaxAge(60*60*24);rn cookie2.setMaxAge(60*60*24);rn response.addCookie(cookie1);rn response.addCookie(cookie2);rnrnrn读cookiesrnrnrnCookie[] cookie=request.getCookies();rnString name="",pass="";rnif(cookie!=null)rnrnfor(int i=0;i
怎么取不到值?: ">
" name="kh">rn rn请选择客户.. rn<%rnset rskh=server.createobject("adodb.recordset")rnsqlkh="select * from shenqi_table"rnrskh.open sqlkh,conn,1,1rndo while not rskh.eof rn%>rn "><%=rskh("danwei")%>rn<%rnrskh.movenextrnlooprnrskh.closernset rskh=nothingrn%>rn rnrn===================rn代码如上,列表显示的是名称,交时我想取ID,并查找,在当前页面上显示此用户相关的数据rnrn可是action="ji.asp?idd=<%=request.form("D1")%>" 取出来老是这样的:rnaction="ji.asp?idd=",就是空的,怎么办呀
app.config 取不到值
方法如下:rn[code=csharp]rnnamespace Commonrnrn public class ConfigManagerrn rn public static string GetConfigString(string columnName)rn rn tryrn rn string result = ConfigurationManager.AppSettings[columnName];rn return result;rn rn catchrn rn return string.Empty;rn rn rn rnrn[/code]rnapp.config 内容:rn[code=html]rnrnrn rn rn rnrn[/code]rn[img=https://img-bbs.csdn.net/upload/201601/19/1453173711_982820.png][/img]rnrn然后我在另一个项目中调用rn[code=csharp]rn string path = ConfigManager.GetConfigString("DBPath");rn xDocument = XDocument.Load(path);rn[/code]rnrn取不到值啊[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/11.gif][/img]为撒子捏rn断点过去没有报错,得到的 result 值是nullrn[img=https://img-bbs.csdn.net/upload/201601/19/1453173992_48152.png][/img]rnrn求解。
cookie取不到值??
admin.php页面部份程序:rn rn rn rn rn rn rn 登录管理rn 用户名:rn rn 用户密码:rn rn rn rn rn rn rn rn rn rnrnadmin1.php源程序??rnrnrnrnrn怎么我第一次运行admin.php进行登录时,admin1.php输不出来 "对的" rn关掉浏览器后,再次登录,发现已存入cookie了,输出"对的"rn这是什么原因呀???
触发器取不到值
语句中的Comments列插入没有值,但实际用手动查询有,要如何debug 请教高手!感恩!rnrn[code=sql]set ANSI_NULLS ONrnset QUOTED_IDENTIFIER ONrnGOrnrnALTER trigger [dbo].[CDefect]rnon [dbo].[OutcomesData]rnafter insertrnas rndeclare @id intrndeclare @id2 intrnselect @id=outcome from inserted where hashkey='Observation'rnrnif @id is not nullrnbeginrnrnselect @id2=Recno from outcomes with (UPDLOCK) where operationtypename='Defective Log ' and passfail='1' and recno=@idrnif @id2 is not nullrnbeginrninsert into trepair(outcome,TLI,SN,OperationID,Operation,Defect1,Commets1,defect2,AAction,RootCause,DefectPartsn,NewPartsn,ModuleName,Components,commets2,Line)rnselect outcomes.recno,rn Products.TLI,rn Products.SerialNumber,rn max(case hashkey when 'OperatorID' then hashvalue else '' end) OperatorID,rn max(case hashkey when 'WhereFound' then hashvalue else '' end) Operation,rn max(case hashkey when 'observation' then hashvalue else '' end) observation,rn max(case hashkey when 'Comments' then hashvalue else '' end) Commets1,rn max(case hashkey when 'Symptom' then hashvalue else '' end) Symptom,rn ''as AAction,rn ''as RootCause,rn ''as DefectPartsn,rn ''as NewPartsn,rn ''as ModuleName,rn ''as Components,rn ''as Comments2,rn Products.linernfrom outcomesdata with (UPDLOCK)join outcomes with (UPDLOCK) on outcomesdata.outcome =outcomes.recnornjoin products with (UPDLOCK) on outcomes.product =products.recnornwhere outcomesdata.outcome =@idrngroup by outcomes.recno,serialnumber,tli,linernend rnrnrnrnendrnrnrnrnrnrnrnrnrn[/code]
@Value 取不到值
环境:springboot  在配置文件里设置了值 在Util里面去取值 取不到 原因: util类一般为static类 里面没有@Bean 而@Value 和@Bean 一般是一起使用,在注入Bean的时候,给Value赋值 如果类似Util里是没有@Bean(一般也不应该有) 所以@Value会失效 解决办法,so easy 在@Bean的类里面 加入@Value
getParameter取不到值
[code=HTML]rnrn rn AddAdPic.htmlrnrn rn rn rnrn rn rn rnrn rnrn rn rn rn 添加图片广告rn rn rn rn rn rn 广告名 rn rn rn rn rn rn rn rn 广告图片 rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrn[code=Java]package controller;rnrnimport java.io.*;rnimport java.util.*;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnimport model.*;rnimport org.apache.commons.fileupload.*;rnimport org.apache.commons.fileupload.servlet.*;rnimport org.apache.commons.fileupload.disk.*;rnrnpublic class AdPicServlet extends HttpServlet rn private String filePath; // 存放上传文件的目录rn private String tempFilePath; // 存放临时文件的目录rnrn public void init(ServletConfig config) throws ServletException rn super.init(config);rn filePath = config.getInitParameter("filePath");rn tempFilePath = config.getInitParameter("tempFilePath");rnrn filePath = this.getServletContext().getRealPath(filePath);rn tempFilePath = this.getServletContext().getRealPath(tempFilePath);rn rnrn public void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn rn try rn DiskFileItemFactory factory = new DiskFileItemFactory();rn factory.setSizeThreshold(4 * 1024);rn factory.setRepository(new File(tempFilePath));rnrn ServletFileUpload upload = new ServletFileUpload(factory);rn upload.setFileSizeMax(4 * 1024 * 1024);rnrn List items = upload.parseRequest(request);rn Iterator iter = items.iterator();rn while (iter.hasNext()) rn FileItem item = (FileItem)iter.next();rn if (item.isFormField()) rnrn else rn processUploadedFile(item);rn rn rn catch (Exception ex) rn ex.printStackTrace();rn rnrn //执行插入数据库操作rn PicInfoGo pig = new PicInfoGo();rn pig.picInfoInsert(request);rnrn //执行跳转操作rn this.getServletContext().getRequestDispatcher("/show.jsp").forward(rn request, response);rn rnrn private void processUploadedFile(FileItem item) rn String fileName = item.getName(); //获得文件的名字rn long fileSize = item.getSize(); //获得文件的大小rnrn if (fileName.equals("") && fileSize == 0) rn return;rn rnrn File uploadedFile = new File(filePath + "\\" +fileName);rnrn try rn item.write(uploadedFile);rn catch (Exception e) rn e.printStackTrace();rn rn rn rnrn[/code]rnrn[code=Java]package model;rnrnimport javax.servlet.http.*;rnimport model.entity.*;rnimport model.dataaccess.*;rnrnpublic class PicInfoGo rnrn public PicInfoGo() rnrn rnrn PicInfo pi = new PicInfo();rn PicInfoService pis = new PicInfoService();rnrn public void picInfoInsert(HttpServletRequest request) rn [color=#FF0000]String picName = request.getParameter("picName").trim();[/color]rn String picFilePath = request.getParameter("picFilePath").trim();rnrn pi.setAdPicName(picName);rn pi.setAdPicPicpath(picFilePath);rn pi.setAdPicClickCount(0);rnrn pis.insertAd(pi);rn rnrn[/code]rnrn严重: Servlet.service() for servlet AdPicServlet threw exceptionrnjava.lang.NullPointerExceptionrn at model.PicInfoGo.picInfoInsert(PicInfoGo.java:17)
reqest取不到值
action=request("action")rn'******************************rn '添加大类别rn'******************************rnif action="add" then'rnrn [color=#FF0000]Att_Name=trim(request("Att_Name"))[/color]rnrn sql="select * from cd_Att where 1=1"rn call openrs(rs,sql,3,3)rn rs.addnewrn rs("Att_Name")=Att_Namernrnrn[color=#FF0000]Att_Name=trim(request("Att_Name"))[/color]rnrnrn这一句取不到值
怎么会取不到值
点击投票按钮后显示的总是undefined,按常理来说应该是可以取到单选框的值的,不知道是什么原原rnaaaaaaaaa rnbbbbbbbbb rnccccccccc rnrn
ajax取不到值
在后台把数据json化,ajax取不出来[img=https://img-bbs.csdn.net/upload/201505/13/1431483848_722632.png][/img]
取不到值
rsd.open "select * from shm where bh="&wdns_ed,conn,1,1rnif not rsd.eof thenrnwdns_pm=rsd("mc")rnend ifrn--------rnrnrsd.open "select * from shm where bh="&wdns_ed"",conn,1,1rnif not rsd.eof thenrnwdns_pm=rsd("mc")rnend ifrnrnwdns_ed为表ASQ的hh字段已经取得的值1688,以其做查询表shm符和bh的行。。rnhh与bh均为数字型rn上两方法都用过但取不到rsd("mc")的值rn请高手指导..rnrnrnrn
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池