NoSuchMethodException

风再起时_2014 2010-04-02 04:05:17
当用户拼接非法路径时,出现java.lang.NoSuchMethodException.
我想像错误页面那样,当出现此异常时跳转到指定页面.请问各位大侠,应该怎么做呢?
...全文
1316 44 打赏 收藏 转发到动态 举报
写回复
用AI写文章
44 条回复
切换为时间正序
请发表友善的回复…
发表回复
风再起时_2014 2010-04-05
  • 打赏
  • 举报
回复
不好意思,放假了,就没再上。谢谢你哈,明天我试试!
风再起时_2014 2010-04-03
  • 打赏
  • 举报
回复
[Quote=引用 40 楼 tubage408 的回复:]
<error-page>
<exception-type>java.lang.NoSuchMethodException</exception-type>
<location></location>
</error-page>
[/Quote]
这样也不行的啊!!!还未解决呢,渴望得到大家的帮助!
inritxihc 2010-04-03
  • 打赏
  • 举报
回复
在struts的配置文件里面配个exception呢
ineedaname 2010-04-02
  • 打赏
  • 举报
回复
试验下40楼的方法,我准备做笔记,哈哈
tubage408 2010-04-02
  • 打赏
  • 举报
回复
<error-page>
<exception-type></exception-type>
<location></location>
</error-page>
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
还有知道怎么解决的大侠吗?谢谢了!
injuer 2010-04-02
  • 打赏
  • 举报
回复
用异步到能解决你这种问题,但就看你会用不,我已经现帮你写好了JS,你只要把处理不份弄完基本就OK了!
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
谢谢了,我再想想别的方法吧.
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 dreamming_now 的回复:]
引用楼主 dreamming_now 的回复:
当用户拼接非法路径时,出现java.lang.NoSuchMethodException.
我想像错误页面那样,当出现此异常时跳转到指定页面.请问各位大侠,应该怎么做呢?
很明确了啊,就是当用户直接拼接访问路径访问程序时.
[/Quote]
汗,是我描述有问题?
injuer 2010-04-02
  • 打赏
  • 举报
回复
能帮你想的办法都想了......还不能解决的话,那只能说,楼主你今天RP不是太好!呵呵!
injuer 2010-04-02
  • 打赏
  • 举报
回复
如果是用户点击生成地址的话,在目标元素的onClick时间中触发!
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
呵呵,又回来了.我又不知道从哪个页面发生的,如果知道的话,直接用errorPage就搞定了!
injuer 2010-04-02
  • 打赏
  • 举报
回复

这些是JS脚本..........

写在网页<script>标签内

在页面加载触发onload事件的时候触发........
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
我是说什么时候调用这些内容
injuer 2010-04-02
  • 打赏
  • 举报
回复
IE7以上啊FF2.x以上才取的到XMLHttpRequest对象..
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
可是这些内容写在哪里呢,什么时候调用?
injuer 2010-04-02
  • 打赏
  • 举报
回复
给你个例子:

var request=null;

request = new XMLHttpRequest();

request.open("opst","拼接的网址",)

request.send(null);

request.onreadystatechange="你目标函数名"

function 目标函数名(){
if(request.readyState!=4 && request.status!=200){
............your cede here.........
}else{
...........business processing here...........
}
}
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
是防止用户直接拼接地址
风再起时_2014 2010-04-02
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 dreamming_now 的回复:]
引用楼主 dreamming_now 的回复:
当用户拼接非法路径时,出现java.lang.NoSuchMethodException.
我想像错误页面那样,当出现此异常时跳转到指定页面.请问各位大侠,应该怎么做呢?
很明确了啊, 就是当用户直接拼接访问路径访问程序时.
[/Quote]
问题是这样的
xiaohuanjie 2010-04-02
  • 打赏
  • 举报
回复
[Quote=引用 24 楼 xiaohuanjie 的回复:]
java.lang.NoSuchMethodException

说明你使用的某个方法未定义,

可能是你使用的时候,调用的方法名写错了
[/Quote]

方法的参数类型或者参数个数与定义的方法不一样,都可能引起这个异常

加载更多回复(24)
文件加密解密算法(Java源码) java,file,算法,加密解密,java源码 package com.crypto.encrypt; import java.security.SecureRandom; import java.io.*; import javax.crypto.spec.DESKeySpec; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.Cipher; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import javax.crypto.NoSuchPaddingException; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import java.lang.reflect.Constructor; import java.security.spec.KeySpec; import java.lang.reflect.InvocationTargetException; public class EncryptData { private String keyfile=null; public EncryptData() { } public EncryptData(String keyfile) { this.keyfile=keyfile; } /** * 加密文件 * @param filename String 源路径 * @param filenamekey String 加密后的路径 */ public void createEncryptData(String filename,String filenamekey) throws IllegalStateException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException, IOException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException, IllegalStateException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException, IOException { //验证keyfile if(keyfile==null || keyfile.equals("")) { throw new NullPointerException("无效的key文件路径"); } encryptData(filename,filenamekey); } /** * 加密类文件 * @param filename String 原始的类文件 * @param encryptfile String 加密后的类文件 * @throws IOException * @throws InvalidKeyException * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException * @throws NoSuchPaddingException * @throws NoSuchAlgorithmException * @throws BadPaddingException * @throws IllegalBlockSizeException * @throws IllegalStateException */ private void encryptData(String filename,String encryptfile) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, NoSuchAlgorithmException, BadPaddingException, IllegalBlockSizeException, IllegalStateException, ClassNotFoundException, SecurityException, NoSuchMethodException, InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { byte data[]=Util.readFile(filename); // 执行加密操作 byte encryptedClassData[] = getencryptData(data); // 保存加密后的文件,覆盖原有的类文件。 Util.writeFile(encryptedClassData,encryptfile); } /** * 直接获得加密数据 * @param bytes byte[] * @throws IllegalStateException * @throws IllegalBlockSizeException * @throws BadPaddingException * @throws InvalidKeyException * @throws NoSuchPaddingException * @throws InvalidKeySpecException * @throws NoSuchAlgorithmException * @throws InstantiationException * @throws IllegalAccessException * @throws IllegalArgumentException * @throws InvocationTargetException * @throws NoSuchMethodException * @throws SecurityException * @throws ClassNotFoundException * @throws IOException * @return byte[] */ public byte[] createEncryptData(byte[] bytes) throws IllegalStateException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchPaddingException, InvalidKeySpecException, NoSuchAlgorithmException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException, IOException { bytes=getencryptData(bytes); return bytes; } private byte[] getencryptData(byte[] bytes) throws IOException, ClassNotFoundException, SecurityException, NoSuchMethodException, InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, IllegalStateException { // 产生一个可信任的随机数源 SecureRandom sr = new SecureRandom(); //从密钥文件key Filename中得到密钥数据 byte[] rawKeyData = Util.readFile(keyfile); // 从原始密钥数据创建DESKeySpec对象 Class classkeyspec=Class.forName(Util.getValue("keyspec")); Constructor constructor = classkeyspec.getConstructor(new Class[]{byte[].class}); KeySpec dks = (KeySpec) constructor.newInstance(new Object[]{rawKeyData}); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(Util.getAlgorithm()); SecretKey key = keyFactory.generateSecret(dks); // Cipher对象实际完成加密操作 Cipher cipher = Cipher.getInstance(Util.getAlgorithm()); // 用密钥初始化Cipher对象 cipher.init(Cipher.ENCRYPT_MODE, key, sr); // 执行加密操作 bytes = cipher.doFinal(bytes); // 返回字节数组 return bytes; } /** * 设置key文件路径 * @param keyfile String */ public void setKeyFile(String keyfile) { this.keyfile=keyfile; } }

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧