首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

小弟我在jsp里导入io包,如何说没定义呢

2011-12-29 
我在jsp里导入io包,怎么说没定义呢?用的下面3条语句%@ page import java.io.File%%@ page import java

我在jsp里导入io包,怎么说没定义呢?
用的下面3条语句
<%@ page import java.io.File;%>
<%@ page import java.util.Iterator;%>
<%@ page import java.util.List;%>

[解决办法]
<%@ page language="java" pageEncoding="UTF-8" import="java.io.*;"%>
[解决办法]
黄色波浪线说明没有使用,jar要添加到classpath,或者直接把jar粘贴到WEB-INF/lib
[解决办法]
方法体加到<%%>里就OK了,你是想把页面信息写入xml文件?
[解决办法]
<%Element root,student,number,name,age;%>不行吗?
[解决办法]
jsp里不要导入包 使用标签就行了

导入了包的项目 不看也罢 直接毙掉
[解决办法]
那这软件肯定要有签名的。要不安全提示会烦死
[解决办法]
我的天哪

HTML code
    <%  Element root= null;  Element student= null;  Element number= null;  Element name= null;  Element age= null;  root = new Element("student-info"); //生成根元素:student-info    student = new Element("student"); //生成元素:student,该元素中将包含元素number,name,age  number = new Element("number");  name = new Element("name");  age = new Element("age");  Document doc = new Document(root); //将根元素植入文档doc中  number.setText("001");  name.setText("lnman");  age.setText("24");  student.addContent(number);  student.addContent(name);  student.addContent(age);  root.addContent(student);  Format format = Format.getCompactFormat();  format.setEncoding("gb2312"); //设置xml文件的字符为gb2312  format.setIndent(" "); //设置xml文件的缩进为4个空格  XMLOutputter XMLOut = new XMLOutputter(format);//在元素后换行,每一层元素缩排四格   XMLOut.output(doc, new FileOutputStream("studentinfo.xml"));        %>
[解决办法]
错误信息贴出来
[解决办法]
org.apache.jasper.JasperException: /index.jsp(2,0) Page directive must not have multiple occurrences of pageencoding

index.jsp第二行是不是又引入<%@ page language="java" import="org.jdom.*" pageEncoding="GBK"%>了,只能设定一次编码。
[解决办法]
方法中用到包的方法都没有报错,说明包肯定导进去了

热点排行