⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vsavetem.jsp

📁 程序为种种闪字图程序试用版,本程序采用JSP+MSSQL开发
💻 JSP
字号:
<%@ page pageEncoding="GB2312"
	import="java.util.Date"
	import="java.text.*"
	import="java.util.*"
	import="java.io.*"
%>
<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:requestEncoding value="GB2312" />
<% out.clear();%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保存模版</title>
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>

<body>
<c:catch var="isok">
<c:set var="isAdd" value="true" />
<c:if test="${empty fn:trim(param.templatename)}">
	<c:set var="templatenameMsg" scope="request" value="请输入模版名称。" />
	<c:set var="isAdd" value="false" />
</c:if>
<c:choose>
	<c:when test="${isAdd}">
    	<c:choose>
            <c:when test="${param.imgurl!='images/nophoto.jpg'}">
            	<c:set var="imgurls" value="${fn:trim(param.imgurl)}" />
                <c:set var="imgurl" value="${fn:replace(fn:trim(param.imgurl),'/temporary','')}" />
                <c:set var="copimgurl" value="/template/background${imgurl}"/>
                <c:if test="${fn:contains(fn:trim(param.imgurl),'/template/background')}">
                    <c:set var="copimgurl" value="${fn:trim(param.imgurl)}"/>
                </c:if>
                <sql:query var="isBackground">
                    Select id,photoPath from background where photoPath = ?
                    <sql:param value="${copimgurl}"/>
                </sql:query>
                <%boolean isbjok = true;%>
                <c:if test="${isBackground.rowCount == 0}">
                    <%
                    String copimgurl=(String)pageContext.getAttribute("copimgurl");
                    String imgurls=(String)pageContext.getAttribute("imgurls");
                    File f = new File(request.getRealPath("/")+imgurls);
                    //检察目录是否存在,不存在就建立
                    int wz = copimgurl.lastIndexOf("/");
                    String ml = copimgurl.substring(0,wz);
                    String m_path=request.getRealPath("/")+ml;
                    java.io.File r_path=new java.io.File(m_path);
                    if(!r_path.exists())
                    {
                       r_path.mkdir();
                    }
                    //检察目录是否存在,不存在就建立/
                    if (f.isFile()) {
                        int c;
                        FileInputStream in1 = new FileInputStream(f);
                        File x = new File(request.getRealPath("/")+copimgurl);// 新文件
                        FileOutputStream out1 = new FileOutputStream(x);
                        c = (int) f.length();
                        byte[] b = new byte[c];
                        in1.read(b);
                        in1.close();
                        out1.write(b);
                        out1.close();				
                    %>
                        <sql:update>
                            insert into background (photoPath,frequency,click) values (?,?,?)
                            <sql:param value="${copimgurl}"/>
                            <sql:param value="0" />
                            <sql:param value="0" />
                        </sql:update>
                        <sql:query var="isBackground">
                            Select id,photoPath from background where photoPath = ?
                            <sql:param value="${copimgurl}"/>
                        </sql:query>
                        
                    <%
                    }else{
                        isbjok = false;
                    }
                    %>
                </c:if>
                <%if (isbjok){%>
                    <c:set var="newpicss" value="${fn:trim(param.newpics)}" />
                    <c:set var="newpics" value="${fn:replace(fn:trim(param.newpics),'/temporary','')}" />
                    <c:set var="copnewpics" value="/template/results${newpics}"/>
                    <sql:query var="istemplate">
                        Select id,imgurl from template where imgurl = ?
                        <sql:param value="${copnewpics}"/>
                    </sql:query>
                    <c:set var="isavave" value="false" />
                    <c:if test="${istemplate.rowCount == 0}">
                        <%
                        String copnewpics=(String)pageContext.getAttribute("copnewpics");
                        String newpicss=(String)pageContext.getAttribute("newpicss");
                        File f = new File(request.getRealPath("/")+newpicss);
                        //检察目录是否存在,不存在就建立
                        int wz = copnewpics.lastIndexOf("/");
                        String ml = copnewpics.substring(0,wz);
                        String m_path=request.getRealPath("/")+ml;
                        java.io.File r_path=new java.io.File(m_path);
                        if(!r_path.exists())
                        {
                           r_path.mkdir();
                        }
                        //检察目录是否存在,不存在就建立/
                        if (f.isFile()) {
                            int c;
                            FileInputStream in1 = new FileInputStream(f);
                            File x = new File(request.getRealPath("/")+copnewpics);// 新文件
                            FileOutputStream out1 = new FileOutputStream(x);
                            c = (int) f.length();
                            byte[] b = new byte[c];
                            in1.read(b);
                            in1.close();
                            out1.write(b);
                            out1.close();				
                        %>
                            <sql:update>
                                insert into template (tName,imgurl,backgroundId,frequency,click) values (?,?,?,?,?)
                                <sql:param value="${fn:substring(fn:escapeXml(fn:trim(param.templatename)),0,35)}"/>
                                <sql:param value="${copnewpics}"/>
                                <sql:param value="${isBackground.rowsByIndex[0][0]}"/>
                                <sql:param value="0" />
                                <sql:param value="0" />
                            </sql:update>
                            <sql:query var="istemplate">
                                Select id,imgurl from template where imgurl = ?
                                <sql:param value="${copnewpics}"/>
                            </sql:query>
                            <sql:update>
                                insert into styles (templateId,backgroundId,fonts,fontsSize,d_bgcolor,isb,isx,jc,outline,d_outline,engrave,d_engrave,shadow,d_shadow,effects,d_3dEffects,d_3dEffects2,xz,yz) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
                                <sql:param value="${istemplate.rowsByIndex[0][0]}"/>
                                <sql:param value="${isBackground.rowsByIndex[0][0]}"/>
                                <sql:param value="${param.fonts}"/>
                                <sql:param value="${param.fontSize}"/>
                                <sql:param value="${param.d_bgcolor}"/>
                                <sql:param value="${param.isb}"/>
                                <sql:param value="${param.isx}"/>
                                <sql:param value="${param.jc}"/>
                                <sql:param value="${param.outline}"/>
                                <sql:param value="${param.d_outline}"/>
                                <sql:param value="${param.engrave}"/>
                                <sql:param value="${param.d_engrave}"/>
                                <sql:param value="${param.shadow}"/>
                                <sql:param value="${param.d_shadow}"/>
                                <sql:param value="${param.effects}"/>
                                <sql:param value="${param.d_3dEffects}"/>
                                <sql:param value="${param.d_3dEffects2}"/>
                                <sql:param value="${param.xz}"/>
                                <sql:param value="${param.yz}"/>
                            </sql:update>
                            <table width="300" border="0" cellpadding="5" class="p4">
                              <tr>
                                <td align="center">保存成功!</td>
                              </tr>
                              <tr>
                                <td align="center">
                                <input type="button" name="Button" value="关闭窗口" onClick="window.close();"></td>
                              </tr>
                          </table>
        					<c:set var="isavave" value="true" />
                        <%
                        }else{
                        %>
                        <table width="300" border="0" cellpadding="5" class="p4">
                              <tr>
                                <td align="center">没有找到模版文件,操作出错!</td>
                              </tr>
                              <tr>
                                <td align="center">
                                <input type="button" name="Button" value="关闭窗口" onClick="window.close();"></td>
                              </tr>
                          </table>	
                        <%
                        }
                        %>
                    </c:if>
                    <c:if test="${istemplate.rowCount != 0 and isavave=='false'}">
                        <table width="300" border="0" cellpadding="5" class="p4">
                              <tr>
                                <td align="center">你已经对模版进行过保存了,请不要重复操作!</td>
                              </tr>
                              <tr>
                                <td align="center">
                                <input type="button" name="Button" value="关闭窗口" onClick="window.close();"></td>
                              </tr>
                          </table>
                    </c:if>
                <%}else{%>
                	<table width="300" border="0" cellpadding="5" class="p4">
                          <tr>
                            <td align="center">没有找到上传的背景图片,操作失败,请重新操作!</td>
                          </tr>
                          <tr>
                            <td align="center">
                            <input type="button" name="Button" value="关闭窗口" onClick="window.close();"></td>
                          </tr>
                      </table>
                <%}%>
            </c:when>
            <c:otherwise>
            	<table width="300" border="0" cellpadding="5" class="p4">
                          <tr>
                            <td align="center">不能对默认背景图片进行效果保存!</td>
                          </tr>
                          <tr>
                            <td align="center">
                            <input type="button" name="Button" value="关闭窗口" onClick="window.close();"></td>
                          </tr>
                      </table>
            </c:otherwise>
        </c:choose>
    </c:when>
	<c:otherwise>
    	<c:set var="templatename" scope="request" value="${fn:escapeXml(fn:trim(param.templatename))}" />
		<c:set var="newpics" scope="request" value="${param.newpics}" />
        <c:set var="imgurl" scope="request" value="${param.imgurl}" />
        <c:set var="text" scope="request" value="${param.text}" />
        <c:set var="isb" scope="request" value="${param.isb}" />
        <c:set var="isx" scope="request" value="${param.isx}" />
        <c:set var="jc" scope="request" value="${param.jc}" />
        <c:set var="fontSize" scope="request" value="${param.fontSize}" />
        <c:set var="fonts" scope="request" value="${param.fonts}" />
        <c:set var="d_bgcolor" scope="request" value="${param.d_bgcolor}" />
        <c:set var="xz" scope="request" value="${param.xz}" />
        <c:set var="yz" scope="request" value="${param.yz}" />
        <c:set var="shadow" scope="request" value="${param.shadow}" />
        <c:set var="d_shadow" scope="request" value="${param.d_shadow}" />
        <c:set var="engrave" scope="request" value="${param.engrave}" />
        <c:set var="d_engrave" scope="request" value="${param.d_engrave}" />
        <c:set var="outline" scope="request" value="${param.outline}" />
        <c:set var="d_outline" scope="request" value="${param.d_outline}" />
        <c:set var="effects" scope="request" value="${param.effects}" />
        <c:set var="d_3dEffects" scope="request" value="${param.d_3dEffects}" />
        <c:set var="d_3dEffects2" scope="request" value="${param.d_3dEffects2}" />
    	<jsp:forward page="svavetem.jsp" />
	</c:otherwise>
</c:choose>
</c:catch>
<c:if test="${!empty isok}">
	<jsp:forward page="error.jsp" />
</c:if>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -