jsp页面调用mysql的存储过程,一直获取不到total值,只能跳到error页面 10C

图片说明
图片说明
图片说明

 <%@ page contentType="text/html" language="java" import="java.sql.*"  errorPage="" pageEncoding="utf-8"%>
<!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="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body>
<% 
//获取提交的用户名与密码
String username="";
String pwd="";
if (request.getParameter("username")!=null)
username=request.getParameter("username");
if (request.getParameter("pwd")!=null)
pwd=request.getParameter("pwd");
try
{
//1.注册数据库引擎
String JDriver="com.mysql.jdbc.Driver";//SQL数据库引擎
Class.forName(JDriver);
//2.连接数据库
//String url = "jdbc:mysql://localhost:3306;DatabaseName=class1";
String url = "jdbc:mysql://localhost:3306/class1";
Connection conn = DriverManager.getConnection(url, "root", "123456");
CallableStatement cs;
//3.通过调用存储过程查询并执行

cs = conn.prepareCall("{call userlogin(?,?,?)}");
cs.setString(1,username);
cs.setString(2,pwd);
cs.registerOutParameter(3, java.sql.Types.INTEGER);
cs.execute();
//4.处理查询结果
int num=0;//默认为零,即无此用户
num=cs.getInt(3);
if (num==1)//存在该用户
{
  if(session.getAttribute("visited")==null){//判断是否session级变量visited为空,为空代表是第一次操作
    session.setAttribute("visited","y");//置visited为可访问
    session.setMaxInactiveInterval(60*60*24);
  response.sendRedirect("question.jsp");//跳转到查询页面
}
else//说明已将viseited置为可访问,直接跳转到查询页面
  response.sendRedirect("question.jsp");
}
else//不存在该用户,跳转到重新注册页面
{
  response.sendRedirect("error.html");
}
conn.close();//关闭连接对象
}
catch(Exception ex)
{
   out.println(ex.toString());//捕捉错误
}
%>
</body>
</html>

图片说明

图片说明
急求!!!!

3个回答

else//说明已将viseited置为可访问,直接跳转到查询页面
response.sendRedirect("question.jsp");
}
else//不存在该用户,跳转到重新注册页面
{
response.sendRedirect("error.html");
}
这段代码中的这个“else”貌似找不到对应的if。
try之后就直接调用error.html了

Mtone_007
Mtone_007 ![图片说明](http://img.ask.csdn.net/upload/201712/17/1513479245_425318.png)if(if...else....)else....这样的吧
接近 2 年之前 回复

图片说明
if(if...else....)else....这样的吧

事实上注值是得在total前加into吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
获取不到存储过程值
存储过程rncreate PROC [dbo].[count_user_order]rn@email nvarchar(50), @all_count int OUTPUTrnASrnrnbeginrnSELECT @all_count=@all_count+COUNT(*) FROM dbo.GoldOrders WHERE CONVERT(NVARCHAR(11),CreateTime,120)=CONVERT(NVARCHAR(11),GETDATE(),120) AND Email=@emailrnSELECT @all_count=@all_count+COUNT(*) FROM dbo.PLOrders WHERE CONVERT(NVARCHAR(11),CreateTime,120)=CONVERT(NVARCHAR(11),GETDATE(),120) AND Email=@emailrnSELECT @all_count=@all_count+COUNT(*) FROM dbo.AccountOrders WHERE CONVERT(NVARCHAR(11),CreateTime,120)=CONVERT(NVARCHAR(11),GETDATE(),120) AND Email=@emailrnSELECT @all_count=@all_count+COUNT(*) FROM dbo.CDKOrders WHERE CONVERT(NVARCHAR(11),CreateTime,120)=CONVERT(NVARCHAR(11),GETDATE(),120) AND Email=@emailrnSELECT @all_count=@all_count+COUNT(*) FROM dbo.ItemOrders WHERE CONVERT(NVARCHAR(11),CreateTime,120)=CONVERT(NVARCHAR(11),GETDATE(),120) AND Email=@emailrnreturn @all_countrnendrnrn调用rn public static int exec_proc_2(string pro,string email,string outPut, string connString)rn rn using (SqlConnection conn = new SqlConnection(connString)) rn rn tryrn rn SqlCommand cmd = new SqlCommand("count_user_order", conn);rn cmd.CommandType = CommandType.StoredProcedure;rnrn SqlParameter email_ = cmd.Parameters.Add("@email", SqlDbType.NVarChar,50);rn SqlParameter rtnval = cmd.Parameters.Add("@all_count", SqlDbType.Int,4);rn email_.Value = email;rn rtnval.Value = 0;rnrn email_.Direction = ParameterDirection.Input; rn rtnval.Direction = ParameterDirection.Output;rnrn conn.Open();rn cmd.ExecuteScalar();rn rnrn int result= (int)cmd.Parameters["@all_count"].Value; rn conn.Close();rn return result;rn rn catch (Exception) rn rn return 0;rn rn rnrn rn那位仁兄告诉下那个地方出错了
ModelAndView传参数到前端jsp页面,页面却获取不到值
后端:        @RequestMapping(&quot;index.do&quot;) public ModelAndView findIndex(){ List&amp;lt;EasybuyProduct&amp;gt; list = productBiz.findBy_8Line(); ModelAndView model = new ModelAndView(&quot;forward:/index.jsp&quot;); mod...
后台获取不到前台JSP页面的值...
JSP页面: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 rnrnWEB.XML:rn rn JspServletrn rn com.sysnet.sms.baseclass.jspservlet.JspServletrn rn rn rn JspServletrn /servlet/JspServletrn rn后台用request.getParameter()方法,为何只能得到year的值,month1,month2...的值都是NULL,这是怎么回事?
JSP页面获取不到request里面的值?
this.getRequest().setAttribute("error", "发生错误请与管理员联系!");rnreturn "error";rnrnpublic HttpServletRequest getRequest()rn HttpServletRequest request = ServletActionContext.getRequest();rn rn return request;rn rnrnerror页面:rn $error[color=#FF0000]//获取不到error里面的值 页面直接输出$errorrnrn在线等,解决立即给分,谢谢![/color]
Servlet获取不到JSP页面上的值
如下是Servlet代码:nn```n public void doPost(HttpServletRequest request, HttpServletResponse response)n throws ServletException, IOException n HttpSession session = request.getSession();n //String account = (String) request.getAttribute("account");n String account = request.getParameter("a");n System.out.println("--------------------------------"+account);n List oneTeaInfo = new ArrayList();n try n oneTeaInfo = new TeacherDao().queryTeaInfo(account);n session.setAttribute("oneTeaInfo", oneTeaInfo);n request.getRequestDispatcher("/teacher_info.jsp").forward(request,response);n catch (Exception e) n e.printStackTrace();n n n```n如下是JSP的相关代码:nn```n n```n我是把值写死的,不写死的情况下,代码如下:n```n n```n居然运行结果是空值,如下图所示:n![图片说明](https://img-ask.csdn.net/upload/201609/25/1474811843_826134.png)n![图片说明](https://img-ask.csdn.net/upload/201609/25/1474811986_663023.png)n请问各位大神,应该如何解决这个问题?
struts1.3获取不到jsp页面的值,求解
在struts中有form类和services类还有actions类,配置文件也写好了对应的和,可是还是取不到值,怎么回事?小弟刚学struts。。
求助! ResultSet一直获取不到值
ResultSet一直获取不到值,输出行数为0,可是在access中测试的有一个记录,希望各位大侠给看看rn下面是代码:rn[code=Java]rnpublic class studentjiemian rn public studentjiemian(String ch)rn tryrnClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn String url="jdbc:odbc:sour";rn Connection con=DriverManager.getConnection(url);rn Statement stmt=con.createStatement();rn rn beijing jFrame = new beijing();rn jFrame.setVisible(true);rn Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();rn jFrame.setBounds(((int)dimension.getWidth() - 200) / 2, ((int)dimension.getHeight() - 300) / 2, 900, 675);rn jFrame.setResizable(false);rn jFrame.setLayout(null);rn jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn rn JLabel label = new JLabel();rn label.setBounds(150,20,700,600);rn rn JLabel huanying=new JLabel("欢迎你来到学生奖学金管理系统");rn huanying.setBounds(50,50,200,30);rn label.add(huanying);rn rn String sqlstr="select username,usercollege,userprofessional from userinf where userid='ch' ";//这个ch是通过另一个类传过来的String值,输出也有值rn ResultSet rs=stmt.executeQuery(sqlstr);//rs。next为false。行数也是0rn if(rs.next())rn JLabel xingming=new JLabel(rs.getString("username"));rn xingming.setBounds(50,100,100,30);rn label.add(xingming);rn rn JLabel college=new JLabel(rs.getString("usercollege"));rn college.setBounds(50,150,100,30);rn label.add(college);rn rn JLabel professional=new JLabel(rs.getString("userprofessional"));rn professional.setBounds(50,200,100,30);rn label.add(professional);rn rn jFrame.add(label);rn[/code]rnrn
jsp页面获取不到session
登录的时候把user放入的session里面·但在跳转过去的页面中获取不到userrn只有在重启服务器之后第一次登录才获取不到,关上浏览器之后·以后就都能获取到了·
jsp页面获取不到数据
jsp页面代码,[code=html]rn rn rn rn rn rn rn rn rn 删除rn [color=#FF0000] [/color]rn rn rn rn[/code]rnrnrnJS代码:[code=javascript]rnvar tab=document.getElementById("tab");rn var arr = new Array( );rn var array = new Array( );rn for(var i=0;i
调用存储过程获取OutPut值
[img=https://img-bbs.csdn.net/upload/201506/18/1434616633_752933.png][/img]rn如图,应该怎么把OutPut的值给result赋上rn存储过程是没错的,好像就差了一句话. 我给忘了,路过的帮忙看下
分页存储过程问题,为什么只能返回一个值total?
在这个论坛里找到了下面这个分页存储过程。rnrnCREATE PROCEDURE PageGorn@tblName varchar(255), -- 表名rn@strGetFields varchar(1000) = '*', -- 需要返回的列 rn@fldName varchar(255)='', -- 排序的字段名rn@PageSize int = 10, -- 页尺寸rn@PageIndex int = 1, -- 页码rn@doCount bit = 0, -- 返回记录总数, 非 0 值则返回rn@OrderType bit = 0, -- 设置排序类型, 非 0 值则降序rn@strWhere varchar(1500) = '' -- 查询条件 (注意: 不要加 where)rnrnASrnrndeclare @strSQL varchar(5000) -- 主语句rndeclare @strTmp varchar(110) -- 临时变量rndeclare @strOrder varchar(400) -- 排序类型rnrnif @doCount != 0rn beginrn if @strWhere !=''rn set @strSQL = 'select count(*) as Total from [' + @tblName + '] where '+@strWherern elsern set @strSQL = 'select count(*) as Total from [' + @tblName + ']'rnend rnrnelsernbeginrnif @OrderType != 0rnbeginrn set @strTmp = '<(select min'rnset @strOrder = ' order by [' + @fldName +'] desc'rnendrnrnelsernrnbeginrn set @strTmp = '>(select max'rn set @strOrder = ' order by [' + @fldName +'] asc'rnendrnrnif @PageIndex = 1rnbeginrn if @strWhere != '' rn set @strSQL = 'select top ' + str(@PageSize) +' '+@strGetFields+ ' from [' + @tblName + '] where ' + @strWhere + ' ' + @strOrderrn elsern set @strSQL = 'select top ' + str(@PageSize) +' '+@strGetFields+ ' from ['+ @tblName + '] '+ @strOrderrnendrnrnelsernbeginrnset @strSQL = 'select top ' + str(@PageSize) +' '+@strGetFields+ ' from ['rn + @tblName + '] where [' + @fldName + ']' + @strTmp + '(['+ @fldName + ']) from (select top ' + str((@PageIndex-1)*@PageSize) + ' ['+ @fldName + '] from [' + @tblName + ']' + @strOrder + ') as tblTmp)'+ @strOrderrnrnif @strWhere != ''rn set @strSQL = 'select top ' + str(@PageSize) +' '+@strGetFields+ ' from ['rn + @tblName + '] where [' + @fldName + ']' + @strTmp + '(['rn + @fldName + ']) from (select top ' + str((@PageIndex-1)*@PageSize) + ' ['rn + @fldName + '] from [' + @tblName + '] where ' + @strWhere + ' 'rn + @strOrder + ') as tblTmp) and ' + @strWhere + ' ' + @strOrderrnend rnrnend rnrnexec (@strSQL)rnrnGOrn------------rn我在查询分析器里调用:rnPageGo 'joblist','jid,subcatelog,jobname,salary,publishtime','publishtime','10','1','1','1','username=''admin'''rn得到的结果是:Totalrn 2rn这条语句选出的结果一共是2条没错,我在前台要怎么调用分页存储过程呢?怎么写到记录集里?不明白!rn
jsp页面执行java语法,获取的值在页面调用
首先在页面头引用用到类的包路径 写需要执行的java语法 页面转换引用 &amp;lt;!-- 引用包路径 --&amp;gt; &amp;lt;%@ page language=&quot;java&quot; import=&quot;java.util.*&quot; pageEncoding=&quot;UTF-8&quot;%&amp;gt; &amp;lt;%@ page language=&quot;java&quot; import=&quot;com.inspur.icpmg.sys
救命?ADO调用存储过程的不到输出值?
int row = 0;rn _variant_t varRow;rn _ParameterPtr mp_Row;rn CString strerror;rn varRow.vt = VT_I2;rn varRow.iVal = row;rn _bstr_t strUpdateSql1 = L"sp_test";rn pApp->m_pCommand->ActiveConnection = pApp->m_pConnection;rn pApp->m_pCommand->CommandText = strUpdateSql1;rn pApp->m_pCommand->CommandType = adCmdStoredProc;rn pApp->m_pCommand->CommandTimeout = 3600;rn// varRow.intVal = _variant_t(row);rn mp_Row.CreateInstance(__uuidof(Parameter));rn mp_Row = pApp->m_pCommand->CreateParameter(_bstr_t("var1"),adInteger,adParamOutput,sizeof(int),varRow);rn pApp->m_pCommand->Parameters->Append(mp_Row);rn _variant_t vNull; rn vNull.vt=VT_ERROR; rn vNull.scode=DISP_E_PARAMNOTFOUND;rn if(pApp->m_pCommand->Execute(&vNull,&vNull,adCmdStoredProc))rn rn _variant_t temp =pApp->m_pCommand->Parameters->GetItem("var1")->Value;rnrn row = temp.iVal;rn CString strTest;rn strTest.Format("%d",row);rn AfxMessageBox(strTest);rn rnrn这是调用ADO的代码,但是得不到输出的值,row的值是初值0?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]
form.innerHtml获取不到页面当中手动输入的值
问题是这样的,页面上有很多组件,input,radio,textarea,checkbox,select....,然后用户在页面上进行操作填写后,我们需要通过form.innerHtml提交整个表单的信息,包括页面的源码和用户输入的内容。现在的情况是这样,换IE 8的话,可以取到所有的表单数据,但在IE11上只能取到页面上的源码信息,用户填写的表单数据内容全部为空。求大神献身,在线求解,谢谢。。。
ACTION到一个页面获取不到值?
静态页面提交到A.aspx[code=HTML]rnrnrn 无标题页rnrnrn rn rn rn rnrn[/code]rnrnA.aspx的CS代码rn[code=C#] protected void Page_Load(object sender, EventArgs e)rn rn Response.Write(Request.Form["Content"]);rn [/code]rnrnrn请问为什么获取不了值呢?rn
页面内获取不到值的问题
简述下问题:我有个jsp页面,有个表单需要上传文件和传递参数。页面最下方有分页。rnrn现在的问题是 不点分页的情况下 跳转包括获取参数一切正常 说明后台action没问题 但一分页后就获取不到参数了rnrn表单我给大家帖出来 麻烦大家了 急!rnrn rn 点击回答内容可以重新编辑rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn 提问主题:$continueAnswer.title rn rn rn rn rn rn 学员:$continueAnswer.user.username rn rn 提问时间: rn rn rn rn 【提问内容】rn $continueAnswer.content rn rn rn rn rn rn rn 老师:$continueAnswer.teacher.username rn rn 回答时间: rn rn rn onclick="window.location='$ctx /teacher/toexsanswer.html?mid=$courseWareAnswer.id &id=$continueAnswer.id &type=$courseWareAnswer.questionType&questionType=$questionType '" style="cursor:hand;" title="点击内容可以重新编辑" >【答疑老师解答】rn rn rn rn rn 快速回答 rn rn rn rn rn 学员评价rn rn <%=SatisfyConstant.getLabelByValue((Integer)request.getAttribute("satisfy")) %>rn rn : $continueAnswer.info rn rn rn rn rn rn rn rn rn rn rn $footer rn rn rnrnrnonclick="window.location='$ctx /teacher/toexsanswer.html?mid=$courseWareAnswer.id &id=$continueAnswer.id &type=$courseWareAnswer.questionType&questionType=$questionType '" style="cursor:hand;" title="点击内容可以重新编辑" rnrn就是这段的type和questionType获取不到 另外两个可以 不分页全都可以正常获取 一分页只有后两个获取不到!
在ASP.NET页面获取不到Session值。
Sessions.LoginName = cusName; rnSessions.CustomerID = Convert.ToInt32(ds.Tables[0].Rows[0]["PKID"]);rnpublic static class Sessionsrn rn private static HttpContext CurrContextrn rn get return HttpContext.Current; rn rnrn /// rn /// 用户登陆后的用户ID,0表示没有登陆rn /// rn public static int CustomerIDrn rn getrn rn tryrn return CurrContext.Session["CustomerID"] == null ? 0 : Convert.ToInt32(CurrContext.Session["CustomerID"]); rn catchrn return 0; rn rn setrn CurrContext.Session["CustomerID"] = value; rn rnrn /// rn /// 用户登陆后的用户登录名,""表示没有登陆rn /// rn public static string LoginNamern rn getrn rn return CurrContext.Session["LoginName"] == null ? "" : CurrContext.Session["LoginName"].ToString().Trim();rn rn setrn CurrContext.Session["LoginName"] = value; rn rn}rnrn if (!Page.IsPostBack)rn rn if (Sessions.LoginName.ToString() == "")rn rn Response.Redirect(Request.ApplicationPath.ToString() + "index.aspx", true);rn rn elsern rn int pkid = Convert.ToInt32(Sessions.CustomerID.ToString());rn FillInfo(pkid);rn rn rn代码如上:为什么我在另一个页面(从登录页面跳转过去的页面)获取不到Sessions.LoginName呢?rn
jsp页面取不到cookie值
在登录ACTION中通过如下代码写入COOKIE值rnCookie namecookie = new Cookie(cookie_user_name,users.get(0).getLoginName());rnnamecookie.setMaxAge(60 * 60 * 24 * 365);rnrequest.addCookie(namecookie);rnrn通过以下代码也可以访问COOKIE的值rnCookie[] cookies = this.getActionContext().getRequest().getCookies();rn for( Cookie c : cookies )rn System.out.println(c.getName()+"--->"+c.getValue());rn rnrn但是在JSP页面中却无法访问到COOKIE,浏览器COOKIE没有被禁用,是什么原因?rnvar mc = '$cookie.cookie_user_name.value';
jsp页面取不到值,纠结....
用java写了一个发帖的小程序,可以发帖子,但是帖子在jsp页面读不出来!郁闷,求解...rn贴出一部分我的代码:rn[color=red]jsp页面代码:[/color]用了两种标签都取不出来!rn $textrn rn rn rn $v.namern $v.titlern $v.contentrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[color=red]ForumAction一部分代码:([/color]action可以取到已发布的帖子)rnrn public String find() throws Exception rn BbsDao bbsdao = new BbsDao();rn bbs = bbsdao.findAllBbs();rn for(Bbs b : bbs)rn System.out.println(b.getContent());rn rn return "find";rn rn[color=red]strutrs.xml代码:[/color]rnrn rnrn /bbs_list.jsprn /bbs_list.jsprn rnrnrn就是郁闷action里面已经取到帖子,就是传不到jsp页面遍历???那里出错了呢?积分太少,只有5分了...
JSP页面读不到Map的值
从数据库调用了一个返回类型是map的函数,然后试图在jsp页面中以表格的形式呈现出来,然后。。似乎并没有成功地调到map,小白求问问题出在哪里[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/11.gif][/img]
jsp页面接收不到回传的值
这是ajax中的rnfunction getResult()rn if(4==req.readyState)rn if(200==req.status)rn alert(req.responseText);这里能弹出返回的串rn //eval(req.responseText);rn alert(document.getElementById('smallType').innerHTML);这里也能弹出 textrn document.getElementById('smallType').innerHTML=eval(req.responseText);就是这没有结果rn elsern alert("您所请求的页面有错误!");rn rn rn下边是接收页面的一段代码rnrn textrn
jsp页面seesion值取不到
jsp页面seesion值取不到 jsp上画面取不到session的值。会不会是配置文件问题~ 后台设值了,前台就是取不到啊~ 有没有人遇到过这个问题的,求指导 org.apache.jasper.JasperException at org.apache.jasper.servlet.JspServletWrapper.servic...
Ext.Ajax.request一直获取不到返回
前端代码:rn[code=javascript] Ext.Ajax.request(rn url: this.baseUrl + 'update',rn method: 'POST',rn params: vRecords[0].data,//datas: vDatas,rn timeout: 60,rn async : false,rn scope: this,rn success: function(action,options) rn vLoadMask.hide(); //关闭遮罩窗口rn alert("success");rn var vResponse = Ext.util.JSON.decode(action.responseText);rn alert(vResponse.data);rn if (vResponse.success) rn this.store.commitChanges(); //还原数据修改提示rn else rn Ext.MessageBox.show(rn title: '标题',rn msg: vResponse.message,rn buttons: Ext.MessageBox.OK,rn icon: Ext.MessageBox.ERRORrn );rn rn ,rn failure: function(response) rn vLoadMask.hide(); //关闭遮罩窗口rn Ext.MessageBox.show(rn title: '直接错误',rn msg: response.responseText,rn buttons: Ext.MessageBox.OK,rn icon: Ext.MessageBox.ERRORrn );rn });rn[/code]rnrnAction处理:rn[code=java]pw.write("\"success\":true,\"data\":\"更新成功\"");rn response.setStatus(HttpServletResponse.SC_OK);rn System.out.println("\"success\":true,\"data\":\"更新成功\"");rn pw.flush();rn pw.close();rn return SUCCESS;[/code]rnrnrn奇怪的有两点rn1、Ext.Ajax.request请求后,Action其它操作都正常就是没返回rn2、用form.submit对这个Action作请求,结果正常
调用自定义的oracle 函数获取不到值
--oracle函数如下:rnCREATE OR REPLACE FUNCTION PJ_GDJHSSL_SCORE (mXZQDM VARCHAR2,mNF number)rnRETURN int ISrnvSCORE int;rnBEGINrn selectrn case rn when jh_ssl>=0.8 and jh_ssl<1.2 then 8rn when (jh_ssl>=0.75 and jh_ssl<0.8) or (jh_ssl>=1.2 and jh_ssl<1.25) then 7rn when (jh_ssl>=0.7 and jh_ssl<0.75) or (jh_ssl>=1.25 and jh_ssl<1.3) then 6rn when (jh_ssl>=0.65 and jh_ssl<0.7) or (jh_ssl>=1.3 and jh_ssl<1.35) then 5rn when (jh_ssl>=0.6 and jh_ssl<0.65) or (jh_ssl>=1.35 and jh_ssl<1.4) then 4rn when (jh_ssl>=0.55 and jh_ssl<0.6) or (jh_ssl>=1.4 and jh_ssl<1.45) then 3rn when (jh_ssl>=0.5 and jh_ssl<0.55) or (jh_ssl>=1.45 and jh_ssl<1.5) then 2rn when (jh_ssl>=0.45 and jh_ssl<0.5) or (jh_ssl>=1.5 and jh_ssl<1.55) then 1rn else 0rn end as fz into vSCORErn from t_pj_gdjhssl where XZQ_DM=mXZQDM AND nf=mNF;rn RETURN vSCORE;rnEND PJ_GDJHSSL_SCORE;rnrn--在SQL语句中使用上面定义的函数。rnselect PJ_GDJHSSL_SCORE('4406',2012) from t_pj_gdjhssl where xzq_dm='4406' and nf=2012;rn查询的记录中jh_ssl=0.8772,按常理说得出来的结果应该是8,但是执行的结果为空。rn
在jsp页面调用不到ajax方法
今天项目中碰到一个问题。就是我需要在一个页面中加一个ajax方法,但在调用的时候,死活走不进这个ajax方法。经过调查发现,该页面是由前一页中的一个get方法调用跳转过来,而该方法是带请求参数的:http://localhost:8081/meeting/getOne/1.这样一来,ajax方法就不起作用了。 解决方法一:把get改为post方法,或者是想办法把请求参数拿掉。总之,当前页的ur...
struts跳转不到error页面
public ActionForward execute(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response) rn UserForm userForm = (UserForm) form;rn Manage m = new Manage();rn Userbean b = null;rn HttpSession session = request.getSession();rn b = m.check(userForm.getUsername(), userForm.getPassword());rn if (b!=null) rn b.setMessage((Constants.title_first));rn session.setAttribute("user", b);rn return mapping.findForward("mainhome");rn else rn return mapping.findForward("error");rn rnrn rn以上是action中的代码rn经过debug确定b确实为nullrn可是仍然进入if (b!=null)的语句中跳转到mainhome中rn却跳转不到error中rn请高手指点
jsp页面获取文本框的值
rn rn rn rn 员工编号: rn rn rn rn rn rn rn rn 员工姓名: rn rn rn rnrn rn rn rn rn 部门工资: rn rn rn rnrn rn rn rn rn 职位工资: rn rn rn rnrn rn rn rn rn 工龄工资: rn rn rn [color=#FF0000][/color]rnrn rn rn rn rn 考勤工资: rn rn rn rnrn rn rn rn rn 出差补贴: rn rn rn rnrn rn rnrn怎么获得当前文本框中的ID在该文本框中使用
ajax获取jsp页面的值
jsp页面:rn<%=com.iconfluence.framework.util.DateUtils.getString("yyyy-MM-dd HH:mm:ss")%>rnrn我就是在jsp页面中显示服务器当前时间, 我怎么能 在其他页面获取到这个值?rn
Jsp页面获取session值
JSTL标签获取Session: [java] view plain copy  print? session.setAttribute("age","123");   ${ sessionScope.age}  在页面上显示的就是123了      sessionScope指的是session的范围,类似还有requestScope,pag
jsp页面获取session的值,jsp页面获取cookie的值
先在Servlet中 先设置共享域request; name = request.getParameter(“username”) // Session session = request.getSession(); // session.seAttribute(String ,Object); request.getSession().setAttribute(“username”,nam...
JSP页面jQuery $.ajax一直返回error(parsererror)
另外两项XMLHttpRequest.status返回200;XMLHttpRequest.readyState返回4.都正常rn[code=javascript]rn$.ajax(rn data:"ids":id,rn url:url,rn dataType:"json",rn type:"GET",rn success:function(data,textStatus)rn console.log(data);rn console.log(textStatus);rn $.showTips(data.message);rn reloadPlugin(rn rn "date":lastDate,rn "search":$("#search").val()rn ,rn rn table:["list"],rn chart:[dgtCht]rn );rn ,rn error:function(XMLHttpRequest, textStatus, errorThrown)rn alert("失败");rn console.log(XMLHttpRequest.status);//200客户端请求已成功rn console.log(XMLHttpRequest.readyState);//4响应内容解析完成,可以在客户端调用了rn console.log(textStatus);//parsererrorrn rn );rn[/code]rn在控制台的Response返回了整个页面rn在控制台的Response Headers打印出的信息如下:rn [color=#FF0000] Content-Type:text/html;charset=utf-8[/color]rn Date:Tue,16 Sep 2014 00:35:02 GMTrn Server:Apache-Coyote/1.1rn Transfer-Encoding:chunkedrnrn但是另外一个请求,仅改变了请求地址url,请求就发送成功了进入successrn在控制台的Response Headers打印出的信息如下:rn[color=#FF0000]Content-Disposition:inlinernContent-Type:text/html[/color]rnDate:Tue, 16 Sep 2014 01:36:53 GMTrnServer:Apache-Coyote/1.1rnTransfer-Encoding:chunkedrnrn我百度了,有些说Header的类型有关,及编码header('Content-type: text/html; charset=utf8');rn还有说struts.xml中ajax请求的action中的result返回类型不是json,但是我看了好像都不太符合我这个问题。rnrn[code=text] rn rn rn text/htmlrn resultrn rn rn text/htmlrn resultrn rn [/code]
MYSQL 存储过程调用存储过程
P1rnCREATE PROCEDURE P1(IN hid int(8))rnbenginrn..rnendrnrnP2rnCREATE PROCEDURE P2(IN hid int(8))rnbenginrnexec P1(hid);rn..rnendrnrn为什么提示exec P1(hid); 有错呢
Connections Total一直增加
服务器是weblogic7.1,使用连接池,控制台上连接池的参数 Connections Totals一直在增加,而Connections没有变。连接池选用了Shrink, Connections Totals应该会收回不使用的连接,但是现在不是这样的。网络上安装了网闸。rn 现在的问题是用过一段时间就死机了,找不到原因,我怀疑是数据库连接的问题。请指教。
实体类获取不到值
enbuzApplyHome.setFuheTime(applyHomeAllInfo.getFuheTime()); 问题在于能得到值,却不能给实体类赋值,找了好长时间发现一个乌龙,在实体映射文件中将insert属性写成FALSE,导致不能插入值== 太悲催
获取不到combox 的值
比如我用一个combox控件,直接在里面写入,男,女 ,两个值,不是从数据库中载入进去的,也不是用控件贴上去的。rnrn我要 获取 选中的值,比如,男,或,女rnrn为了 string sql = string.Format("update users set nickname='0',[color=#FF0000]sex=1[/color],name='2',age=3,starid=4,bloodtypeid=5 where id=6", this.txtnickname.Text, [color=#FF0000]this.cobsex.SelectedIndex[/color], this.txtname.Text, this.txtage.Text, this.cbostar.SelectedIndex, this.cbobloodtype.SelectedIndex,int.Parse(this.txtid.Text));rnrn为了选 中一个值,去更新到数据库,数据库用的也是char型的。rnrn我现在获取不到combox 的值,请大家出个注意谢谢。rn
HttpWebResponse获取不到值
1.aspx通过POST把值传递给2.aspx,2.aspx处理后把结果返回给1.aspx,1.aspx在同一个页面把2.aspx结果显示出来。所有这些操作都在后台执行。rnrn1.aspx代码如下:rn Sub postData(ByVal url As String, ByVal data As String)rn If Not url Is Nothing AndAlso InStr(url, "http") > 0 Thenrn Dim myEncoding As Encoding = Encoding.GetEncoding("gb2312")rn Dim buff As Byte() = myEncoding.GetBytes(data)rn Dim myRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)rn myRequest.Method = "POST"rn myRequest.ContentType = "application/x-www-form-urlencoded"rn myRequest.ContentLength = buff.Lengthrn Dim newStream As Stream = myRequest.GetRequestStream()rn newStream.Write(buff, 0, buff.Length)rn newStream.Close()rn '获取返回值rn Dim myResponse As HttpWebResponse = myRequest.GetResponsern Dim sr As StreamReader = New StreamReader(myResponse.GetResponseStream, System.Text.Encoding.GetEncoding("gb2312"))rn lbl_Status.Text = sr.ReadToEndrn sr.Close()rn End Ifrn End Subrnrn1.aspx值已经顺利POST至2.aspx,但2.aspx该如何把值返回给1.aspx呢?我在2.aspx上把值POST回1.aspx,但在1.aspx上通过myRequest.GetResponse获取不到值。请问该如何进行操作呢?谢谢!rn
获取不到值
[code=csharp]<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="sxzafcyy.WebForm3" %>rnrnrnrnrnrn rn rnrn rnrn rn rnrn rn rn rn rn rn rn <%#Eval("navigation") %>rn rn rn rn rn rn rn <%#Eval("navigation_Name") %>rn rn rn rn rn rn rn rnrn[/code]rnrn[code=csharp]rn public partial class WebForm3 : System.Web.UI.Pagern rn DB db = new DB();rn public int id;rn protected void Page_Load(object sender, EventArgs e)rn rn index_on();rn index_tw();rn rn //一级导航栏rn //navigation 名字rn public void index_on()rn rn string sql = "select id,navigation from navigation";rn DataTable dt = db.reDt(sql);rn index_one.DataSource = dt;rn index_one.DataBind();rn rn //二级导航栏rn //navigation_Name 名字rn //navigation_id 和一级 id 关联rn public void index_tw()rn rn id = string.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : int.Parse(Request.QueryString["id"]);rn string sql = "select navigation_id,id,navigation_Name from navigation_Name where id = "+id;rn DataTable dts = db.reDt(sql);rnrn index_two.DataSource = dts;rn index_two.DataBind();rn rn[/code]rnocument.getElementById(<%#Eval("navigation_id")%>).innerHTML += data;rnrn我鼠标经过获取不到值.报错rnrn这个是错了?rnrn我前台改如何改?rnrn后台改如何改?rnrn求大神
Set方法获取不到值
这是我的servlet里的增删改的方法,但是在items.set*方法都获取不到值是为什么,其他地方都没问题,需要其他地方截图的说一下,求大神解答!!困了好久...
struts2拦截器获取不到值
[color=#FF0000]login.jsp[/color]rnrn rnrn用户名: rnrnrnrn[color=#FF0000]rnloginAction[/color]rnpublic class LoginAction extends ActionSupport rn private String name;rnrnrn public String getName() rn return name;rn rnrnrn public void setName(String name) rn this.name = name;rn rnrnrn public String execute() throws Exception rn ActionContext.getContext().getSession().put("user", "aa");rn return "success";rn rn rnrnrnrn[color=#FF0000]struts.xml[/color]rnrnrnrnrnrnindex.jsprnrnrnrnrnrnrn[color=#FF0000]拦截器:AuthorityIntercetor[/color]rnpublic class AuthorityIntercetor extends AbstractInterceptorrnrn @Overridern public String intercept(ActionInvocation invocation) throws Exception rn ActionContext ctx=invocation.getInvocationContext();rn rn Map session=ctx.getSession();rn //取出名位user的Session属性rn String user=(String)session.get("user");rn //如果没有登录,或者登录所用的用户名不是scoot,都返回重新登录rn if(user!=null && user.equals("scott"))rn return invocation.invoke();rn rn //没有登录,讲服务器提示设置成一个HttpServletRequest属性rn ctx.put("tip", "您还没有登录,请输入scott,tiger登录系统");rn return Action.SUCCESS;rn rn rnrnrnrn我调试发现拦截器中 [color=#FF0000]String user=(String)session.get("user"); 该 user获得为null[/color],麻烦各位高手指点指点,为什么不能获取到该值列rn
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件