错误问题汇总

 

 

SinopecWeb问题解决方案

1、上传文件出错

 [com.opensymphony.xwork2.ognl.OgnlValueStack]-[WARN] Error setting value

ognl.MethodFailedException: Method "setUpload" failed for object com.newstar.content.action.ImageEnjAction@38d8fb [java.lang.NoSuchMethodException:setUpload([Ljava.lang.String;)]

上传文件出错,此时应该在设置form的属性如下所示:

enctype="multipart/form-data"

 

2 按照标题的拼音排序

 

3 Ajax异步提交IE浏览器不兼容的问题

$.getJSON

1 提交按钮

<input type="button"  value="生成首页" id="createButton" οnclick="createIndex();">

2 运行函数

<script type="text/javascript" >

function createIndex(){

        var button=$("#createButton")

        var value=button.val();

         button.val("正在生成..").attr("disabled","disabled")

        var noCache = Date(); //解决IE浏览器不兼容的问题

$.getJSON("perStaticManage!staticIndex.action",{"noCache":noCache},function(data){

            button.val(value).removeAttr("disabled");

             if(data==1){

                alert("操作成功")

             } else{

                 alert(data)

             }

        })  ;

    }

3 后台返回值

PrintWriter out = null;    //定义一个out

public String staticIndex() throws Exception{

        System.out.println("正在生成首页。。。");

        out = response.getWriter();

out.print("1");  //返回值

}

 

4 Struts属性注入

<a href="${ctx}/imageTextManage!showImageText.action?imageTextId=${imageText.id}&cateId=${cateId}">显示</a>

前台页面必须传入值后台才能接收到

此时后台有了cateId的值

当返回imageTextList();方法时不用在指定cateId的值就ok,因为此时是向后台传入的,cateId已经含有前台传入的值

5 expecting CLOSE异常

,611 [org.hibernate.hql.PARSER]-[ERROR] line 1:133: expecting CLOSE, found 'null'

此时sql语句少了一个括号:如下

 

6 textarea 显示异常

在textarea中光标的显示不在文本输入框的开头位置,

此时需要${product.modelSize}和前后必须得紧凑!

<textarea id="modelSize" name="product.modelSize" style="width:340px; height:90px;">${product.modelSize}</textarea>

 

 

7 oracle查询出重复的数据

 

select * from cms_news t where t.abst in(select a.abst from cms_news a group by a.abst having count(1)>=2)

 

 

7 freeMarker输出int类型带有逗号

 

解决方案:在news类型中,定义一个字段是string类型的,这样输出的时候就不会出现这种情况了,方法如下:

 

8 html静态化分页问题【两种解决方案】

 

一种方案:所有的新闻都生成对应的的页,一页可以30条记录,尽量多些记录,这样分的页数自然减少。

当点击一页的时候,链接到点击的30条记录的那页

 

<a href=“/ml/1.html“>首页<a>

 <a href=“/ml/1.html“>1<a>

<a href=“/ml/2.html“>2<a>

<a href=“/ml/3.html“>3<a>

<a href=“/ml/4.html“>下一页<a>

此时对应的魔板中的代码为:

<div class="">

   <a href="/sjzlh/lb/${i-1}.html" class="btn_prev"> 上一页${i-1}</a>

  <ahref="/sjzlh/lb/${page.currentPage+i-1}.html"变红">${page.currentPage+i-1}</a>

  <a href="/sjzlh/lb/${page.currentPage+i}.html">${page.currentPage+i}</a>

   <a href="/sjzlh/lb/${page.currentPage+i+1}.html">${page.currentPage+i+1}</a>

   <a href="/sjzlh/lb/${i+1}.html" class="btn_next">上一页${i+1}</a>

</div>

 

其中上图中的page 和i是从后台传过来的,

后台根据i不同生成不同的新闻目录页,其中i是第i页

核心代码如下:

String hql = " from News sd where sd.category.id=" + cateId + " order by sd.pubDate desc";

newsList = dbService.getDomainListUsePage(hql, Page.DEFAULT_PAGE_SIZE, nextPage);

page = dbService.getPageObject(hql, Page.DEFAULT_PAGE_SIZE, nextPage);//得到分页信息

  for(i=1;i<=page.getTotalPage();i++){  //根据上图的分页,循环取出每页的记录

 newsList = dbService.getDomainListUsePage(hql, Page.DEFAULT_PAGE_SIZE, i);

         mapRoot.put("page",page);//绑定分页

          mapRoot.put("i",i);//第几页

。。。。。1加载魔板目录

。。。。。2加载魔板文件

。。。。。3设置生成文件的目录,如果不存在那么就创建此目录

。。。。。4加载生成的文件名称已经路径文件名称以i为尾缀,如news_i.html其中i为动态的,此时每循环一个就生成一个新闻列表}

+++++++++++++++++++++++++++

9 获得文件的大小

  File file=new File("f:\\sinopecWebSite - 副本.rar");

   System.out.println(file.length()/1024+1);

10 页面不兼容-图片-UEditor

 如在本地测试,显示页面不兼容,此时需要部署到服务器上载测试下,用其他浏览器访问服务器上的主页,此时可能显示正常【方案:换不同版本的浏览器测试、用不同的电脑访问】

--Ueditor打开不显示编辑区,需要刷重新刷新才可显示。

Ueditor上传图片不显示:

 

此时部署到服务器后,问题都不再出现这种情况

 

11 Ueditor“在线管理“不显示图片

此时在线管理的图片不显示,因为插入的是绝对路径,截图如下

 

此时需要修改源码部分:

com.baidu.ueditor.hunter.FileManager

如下代码:

private String getPath ( File file ) {

//在线管理 显示图片

String path = file.getAbsolutePath();

      String str=path.replace(this.rootPath.replaceAll("\\/", "\\\\"), "\\" );

      return str;

}

 

图片路径

 

11 Oracle数据库中数据误删

 

#查看回收站的内容

SQL> show recyclebin

1、从回收站恢复时重命名表

SQL> flashback table t2 to before drop rename to t4 ;

12 Oracle数据库复制long类型的表

 

只需把此表重新命名即可

alter table cms_news1 rename to cms_news;

  1. 复制一个表:insert into new_table select * from old_table;
  2. 创建一个表create table 新表 as select * from 旧表   

 

13 Oracle序列重复老是报唯一键冲突

解决方案:此时需要查看当前的序列为什么,

1删除序列重新建立

drop Sequence ds_news_seq;    --删除序列

Create Sequence ds_news_seq Start With 2000 Increment by 1 --自增开始初始值和每次的增长值

select ds_news_seq.nextval from dual    --查当前的值

14 href带中文的无法解析

思路:Tomcat中的server.xml统一设定编码

错误提示:

思路:

<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" URIEncoding="UTF-8" />

15 json传到前台的数据乱码

解决方案:设置编码

response.setCharacterEncoding("UTF-8");

添加后可正常显示:

16 在数据库中根据字段name idcard查找时找不到对应的中文的记录码?

 

(在连接数据库时,util要写上jdbc:mysql://127.0.0.1:3306/gsms?useUnicode&characterEncoding=utf8)保证了查找中文的是的异常!

17 插入时间类型的数据

1利用的是prepareStatement 参数传递的形式

ps.setDate(7, new java.sql.Date(student.getGDate().getTime()));  

+++++++++++++++++++++++++++

Student s=new Student();

s.setDegressId(1);

Date date=new Date();

System.out.println(date);

s.setGDate(date);

student中的date传入util.date类型类型

+++++++++++++++++++++++++++

将字符串转换为date类型

String time=request.getParameter("gDate");

 

DateFormat     df=new SimpleDateFormat(      

"yyyy年MM月dd日");

Date date= df.parse(time);

++++++++++++++++++++++++++

数据库得到的数据显示在jsp

Date date=new Date();

SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日");

out.println(sdf.format(date));

++++++++++++++++++

18 如何导出xls格式的文

建立模板

1建一张xls的表头

2保存为网页格式的文件

jsp

1建立一张jsp页面

2模板代码—jsp(编码以及)

 

定义导出按钮

<input type="button" value="导出到Excel" οnclick="window.location.href('xls.jsp')" />

模板代码—jsp

动态数据---添加动态的数据,并制定格式,要求gb2312

19 严重: Error filterStart

项目启动不起来,报下面这些错误。

严重: Error filterStart

严重: Context [] startup failed due to previous errors

严重: The web application [] registered the JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

log4j:WARN No appenders could be found for logger (com.mchange.v2.c3p0.impl.NewPooledConnection).

 

 

 

 

最主要的是这两个问题。

1、xml配置失误

2jar包冲突或者是缺少某个jar包

20 ERROR!!_hibernate无法创建表

 

2014-05-06 18:33:36,836 [org.hibernate.tool.hbm2ddl.DatabaseMetadata]-[INFO] table not found: knowledge_point

2014-05-06 18:33:36,845 [org.hibernate.tool.hbm2ddl.SchemaUpdate]-[ERROR] Unsuccessful: create table knowledge_point (id number(10,0) not null, chapter varchar2(128), docContent clob, abst varchar2(200), lv varchar2(64), order number(10,0), cate_id number(10,0), primary key (id))

log4j:ERROR Failed to excute sql

出现此问题的可能原因是:有关关键字

 

21、配置tomca https

效果展示如下

第一步:生成中证书

http://jingyan.baidu.com/article/a948d6515d3e850a2dcd2ee6.html

 

 

第二部:

配置tomcat server.xml

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"

               maxThreads="150" scheme="https" secure="true"

               clientAuth="false" sslProtocol="TLS"

               keystoreFile="F:/tomcat/tomcat.keystore"

               keystorePass="tomcat"                

   />

第三部:访问 hhtps://localhost:8443/

22、插入时间类型数据

to_date(‘’,’yyyyMMdd’)

23、a href函数运行

24 系统配置 后台管理

先移除分配好的子菜单后才能删除权限,不然报空指针异常

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

十年呵护

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值