易截截图软件、单文件、免安装、纯绿色、仅160KB

JSP在线编辑器

 本例子在Windows+Tomcat6(weblogic9.2)+jdk1.6下运行。
1)安装好jdk1.6,然后安装tomcat6.
2)在tomcat目录的conf目录下,修改server.xml。
 本例子是默认配置运行在虚拟目录下,,并且上传基准目录的物理路径在当前应用下。请根据第3点,在对应的host节点上加入蓝色部分代码。
1)如果应用部署在网站根目录下运行,并且上传基准目录的物理路径在当前应用下: http://localhost:8080
<!--[1]start -->
<Context path="" reloadable="true" docBase="E:/jspsample/web" debug= "0"/>
<!--[1]end-->
2)如果应用部署在网站根目录下运行,但是上传基准目录的物理路径与当前应用不在同一个物理文件夹下: http://localhost:8080
<!--[2]start  -->
<Context path="" reloadable="true" docBase="E:/jspsample/web" debug="0" crossContext="true"/>
<Context path="/upload" docBase="E:/upload" debug="0" reloadable= "true"/>
<!--[2]end-->
如果发现配置 upload 虚拟目录路径,图片上传正确,但是浏览器上浏览不到图片,请重新启动tomcat一次。
3)运行在虚拟目录下,,并且上传基准目录的物理路径在当前应用下http://localhost:8080/jspsample
<Context path="/jspsample" reloadable="true" docBase="E:/jspsample/web" debug= "0"/>
4)运行在虚拟目录下,但是上传基准目录的物理路径与当前应用不在同一个物理文件夹下。http://localhost:8080/jspsample
<!--[4]start  -->
<Context path="/jspsample" reloadable="true" docBase="E:/jspsample/web" debug="0" crossContext="true"/>
<Context path="/upload" docBase="E:/upload" debug="0" reloadable= "true"/>
<!--[4]end-->
3)修改web.xml
 在<web-app>节点中,增加:
 A)允许上传的图片格式。可以根据实际自行增加或减少。
 <context-param>  
  <param-name>config_allow_image_ext</param-name>  
  <param-value>jpeg,jpg,gif,png,tif</param-value>  
 </context-param>
B)允许上传的文件格式。可以根据实际自行增加或减少。
 <context-param>  
  <param-name>config_allow_upload_file_ext</


相关文档:

jsp 跳转方式

使用JSP大约有下列三种跳转方式:
1. response.sendRedirect();
2. response.setHeader("Location","");
3. <jsp:forward page="" />
经过试验得到下面的一些规则:
一. response.sendRedirect()
此语句前不允许有out.flush(),如果有out.flush(),会有异常:
java.lang.IllegalStateException: Can't send ......

jsp中连接数据库的问题

今天在学习jsp中数据库的使用时,遇到一个很奇怪的情况(至少现在看来是的)。jsp中连接mysql数据库,开启mysql数据库后,在jsp页面中嵌入的java连接mysql数据库的那几句代码。好像 Class.forName("org.gjt.mm.mysql.Driver");没起到作用,只需要Connection con=DriverManager.getConnection("jdbc:mysql://localhost/test? ......

jsp连接MySQL数据库 2

●jsp连接MySQL数据库
testmysql.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?
user=soft&pas ......

Html/Jsp常用的页面跳转方法

第一种:
<script language="javascript" type="text/javascript">
    window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
    alert("返回");
    window.history.back ......

servlet、jsp中获得项目绝对路径

servlet中获得项目绝对路径
String filePath=this.getServletConfig().getServletContext().getRealPath("/");
根目录所对应的绝对路径:request.getServletPath();
文件的绝对路径 :request.getSession().getServletContext().getRealPath(request.getRequestURI())
当前web应用的绝对路径 :servletConfig.getServletCo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号