怎样让jsp 文本框只显示浮点数,不显示科学计数法

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq201596/article/details/83878438

数据过大或接近于0,java会自动使用科学计数法显示

要使得数据以正常的小数显示可使用DecimalFormat类:

DecimalFormat df= new DecimalFormat("0000000.000");//指定转换的格式

String strVal= df.format(doubleVal);//将double类型的值转换为String类型

展开阅读全文

求救?怎样让页面刷新的时候不显示刚才出来的文本框。:》

12-11

数据库表中有二个字段分别是censor1和str文本型的都是。现在表里面只有一条记录,ID号为3 ,字段内容分别是 2和审核|复核rn原来第一步是在页面上有一个下拉列表,列表的值是数字,选择不同的值。就能显示出不同个数的文本框。现在这个功能实现了。我刚才选择2,它就显示出二个文本框来,我在第一个文本框中输入“审核”,第二个文本框中输入“复核”,rn然后我保存了。并且让文本框的内容通过|相连。我也能成功的存入数据库了。rn但是我想修改它的时候是不是得显示出来内容呀。rn现在他也显示了。大家帮忙看看吧。rnrn如果我在修改的时候,我怎样才能让显示出来的文本框不显示??rn<%rnset conn=server.CreateObject("adodb.connection")rnconn.open "Driver=Microsoft Access Driver (*.mdb); dbq="&server.MapPath("data.mdb")rnset rs=server.createobject("adodb.recordset")rnrs.open "select * from db where id=3",conn,1,3%> rn rn<%if not rs.eof then%>rn rn <% do while not rs.eof %>rn 步聚数:<%rn for i=1 to 4 rn censor1=rs("censor1")rn response.write""&i&""rn next rnrn rn %>rn rn rn rn <%rn str=rs("str")rn ary=split(str,"|")rn for i=0 to ubound(ary)rn aa=ary(i)rnresponse.write" "rn nextrn rn %>rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn <% rn rs.movenextrn loop%>rn rn<% rs.closern conn.closern set rs=nothingrn set conn=nothing%>rn<% end if%>rnrnrn 论坛

文本框为什么不显示

08-24

一个简单的WBB页源码浏览程序,输入URL,获得指定的网页文本,显示。rnm_content是文本框的变量,可是执行的结果是文本框不显示内容,调试中m_content的确是有正确内容的。可是为什么不显示呢?rn我是VC新手,请指正!谢谢!rnrn显示部分:rnvoid CMyBrowserDlg::OnPaint() rnrn if (IsIconic())rn rn CPaintDC dc(this); // device context for paintingrnrn SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);rnrn // Center icon in client rectanglern int cxIcon = GetSystemMetrics(SM_CXICON);rn int cyIcon = GetSystemMetrics(SM_CYICON);rn CRect rect;rn GetClientRect(&rect);rn int x = (rect.Width() - cxIcon + 1) / 2;rn int y = (rect.Height() - cyIcon + 1) / 2;rnrn // Draw the iconrn dc.DrawIcon(x, y, m_hIcon);rn rn elsern rn CDialog::OnPaint();rn rnrnrn查询键点击程序:rnvoid CMyBrowserDlg::OnQuery() rnrn // TODO: Add your control notification handler code herern CInternetSession session(_T("我的浏览器1.0"),INTERNET_OPEN_TYPE_PRECONFIG);rn CHttpConnection *pServer = NULL;rn CHttpFile* pFile = NULL;rn rn UpdateData(TRUE);rn m_content="";rn UpdateData(FALSE);rn if(m_sitename.Find("http://"))rn m_sitename="http://"+m_sitename;rn tryrn rn CString strServerName;rn CString strObject;rn INTERNET_PORT nPort;rn DWORD dwServiceType;rnrn if(!AfxParseURL(m_sitename,dwServiceType,strServerName,strObject,nPort)||dwServiceType!=INTERNET_SERVICE_HTTP)rn rn MessageBox(_T("不是HTTP站点"),_T("错误"));rn rnrn pServer=session.GetHttpConnection(strServerName,nPort);rn rn pFile=pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject,NULL,1,NULL,NULL,NULL);rn pFile->AddRequestHeaders(_T("MyBrowser"));rn pFile->SendRequest();rnrn DWORD dwRet;rn pFile->QueryInfoStatusCode(dwRet);rnrn //如果操作被拒绝,则提示用户使用密码rn if(dwRet==HTTP_STATUS_DENIED)rn rn DWORD dwPrompt;rn dwPrompt = pFile->ErrorDlg(NULL,ERROR_INTERNET_INCORRECT_PASSWORD,FLAGS_ERROR_UI_FLAGS_GENERATE_DATA|FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,NULL);rnrn //如果用户取消了对话框,则退出rn if(dwPrompt !=ERROR_INTERNET_FORCE_RETRY)rn rn MessageBox(_T("操作被拒绝,密码无效"),_T("错误"));rn rnrn pFile->SendRequest();rn pFile->QueryInfoStatusCode(dwRet);rn rnrn CString strNewLocation;rn pFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF,strNewLocation);rnrn //是否需要重新定向rn if(dwRet == HTTP_STATUS_MOVED||dwRet == HTTP_STATUS_REDIRECT || dwRet == HTTP_STATUS_REDIRECT_METHOD)rn rn CString strNewLocation;rn pFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF,strNewLocation);rnrn int nPlace = strNewLocation.Find(_T("Location:"));rn if(nPort == -1)rn rn MessageBox(_T("站点地址改变"),_T("错误"));rn rnrn strNewLocation = strNewLocation.Mid(nPlace+10);rn nPlace = strNewLocation.Find('\n');rn if(nPlace>0)rn strNewLocation = strNewLocation.Left(nPlace);rnrn //关闭重定向站点rn pFile->Close();rn delete pFile;rn pServer->Close();rn delete pServer;rnrn //检查原来的位置rn if (!AfxParseURL(strNewLocation,dwServiceType,strServerName,strObject,nPort))rn rn MessageBox(_T("重定向的URL无法被解析"),_T("错误"));rn rnrn if(dwServiceType !=INTERNET_SERVICE_HTTP)rn rn MessageBox(_T("重定向的URL不是一个HTTP资源"),_T("错误"));rn rnrn //重试新的位置rn pServer=session.GetHttpConnection(strServerName,nPort);rn pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject,NULL,1,NULL,NULL,NULL);rn pFile->AddRequestHeaders(_T("MyBrowser"));rn pFile->SendRequest();rn pFile->QueryInfoStatusCode(dwRet);rn if(dwRet!=HTTP_STATUS_OK)rn rn MessageBox(_T("HTTP状态错误"),_T("错误"));rn rn rnrn CString line;rn //TRACE(line);rn while(pFile->ReadString(line))rn //TRACE("debug");rn //MessageBox(("debug"),_T("错误"));rn m_content += line+"\r\n";rn //TRACE("%s\",line);rn rn //CMyBrowserDlg::OnPaint();rn pFile->Close();rn pServer->Close();rn rn catch(CInternetException * pEx)rn rn TCHAR szErr[1024];rn pEx->GetErrorMessage(szErr,1024);rn MessageBox(szErr,_T("错误"));rn pEx->Delete();rn rnrn if(pFile!=NULL)rn delete pFile;rn if(pServer!=NULL)rn delete pServer;rn session.Close();rnrnrn 论坛

没有更多推荐了,返回首页