首页
归档
留言
友链
广告合作
壁纸
更多
美女主播
Search
1
博瑞GE车机升级/降级
5,649 阅读
2
Mac打印机设置黑白打印
5,042 阅读
3
修改elementUI中el-table树形结构图标
4,945 阅读
4
Mac客户端添加腾讯企业邮箱方法
4,705 阅读
5
intelliJ Idea 2022.2.X破解
4,444 阅读
后端开发
HarmonyOS Next
Web前端
微信开发
开发辅助
App开发
数据库
随笔日记
登录
/
注册
Search
标签搜索
Spring Boot
Java
Vue
Mac
Spring Cloud
MyBatis
WordPress
MacOS
asp.net
Element UI
Nacos
MySQL
.Net
Spring Cloud Alibaba
Mybatis-Plus
Typecho
jQuery
Java Script
IntelliJ IDEA
微信小程序
Laughing
累计撰写
629
篇文章
累计收到
1,421
条评论
首页
栏目
后端开发
HarmonyOS Next
Web前端
微信开发
开发辅助
App开发
数据库
随笔日记
页面
归档
留言
友链
广告合作
壁纸
美女主播
搜索到
51
篇与
的结果
2018-01-22
jspSmartUpload使用
jspSmartUpload官方已经停止更新jspSmartUpload可以轻松实现文件的上传、下载功能,对于文件上传类型限制控制也非常灵活IntelliJ IDE引用jar包右键项目,选择Open Module Setting或者使用⌘+↓快捷键,在打开的界面,左侧选择Library,然后点击➕,选中对应的jar,引入后点击确定按钮引入完成后,查看项目目录应该如下:使用smartupload实现简单的文件上传功能
2018年01月22日
1,446 阅读
0 评论
1 点赞
2017-11-13
jsp包含页面的方法
在jsp中,我们可以通过两种方式包含页面,简单点的方法是包含一个或者几个静态页面,稍微高级一点的方式是包含动态页面,甚至像动态页面传递参数,下面我们针对这两种方式分别进行介绍。包含静态页面这里所谓的静态页面其实有点不太合适,我们也可以包含jsp页面,但是无法传递参数。包含静态页面通过<%@include file="" %>指令进行的。需要包含的页面index.jsp<%@include file="include.jsp" %> 被包含的页面include.jsp<h1>Include Page</h1> <h2><%=request.getParameter("included") %></h2>我们可以看一下下面的输出页面,由于无法传递参数,所以我们在页面获取的request的参数值是null包含动态页面并传递参数继续我们刚才的代码,我们修改index.jsp代码如下<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="true" isThreadSafe="true" autoFlush="true" info="我是首页" errorPage="errorPage.jsp"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>首页</title> </head> <body> <form action="index.jsp" name="form1" method="post"> <input type="text" name="userName" id="UserName"> <input type="submit" value="提交"> <% request.setCharacterEncoding("UTF-8"); String userName = request.getParameter("userName"); if(userName==null){ out.println("请输入用户名"); }else if(userName==""){ out.println("(づ ̄3 ̄)づ╭❤~,输入名称呀"); } else{ out.println(userName); } %> <%-- 注释 <%@include file="include.jsp" %> --%> <jsp:include page="include.jsp"> <jsp:param value="我被成功包含进来了" name="included"/> </jsp:include> </form> </body> </html>
2017年11月13日
1,230 阅读
0 评论
1 点赞
2017-11-11
JSP标签
JSP标签库,是使用XML语法格式完成程序操作的一种方法,其使用的语法类似于JavaBean的使用语法,于JavaBean一样,都可以通过类完成复杂的操作,而且最大的优势就是按照HTML标签的形式标签,这样可以方便的处理JSP页面的数据显示。定义空标签继承TagSupport类package me.lisen.JavaEEStudy; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport; public class HelloTag extends TagSupport { @Override public int doStartTag() throws JspException { JspWriter jspWriter = super.pageContext.getOut(); try{ jspWriter.write("<h1>Hello,World!</h1>"); }catch (Exception e){ e.printStackTrace(); } return TagSupport.SKIP_BODY;//表示标签体为空 } }定义标签描述文件 /WEB-INF/hellotag.tld<?xml version="1.0" encoding="ISO-8859-1"?> <taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"> <tlib-version>1.0</tlib-version> <short-name>firsttag</short-name> <uri>https://lisen.cc</uri> <!-- Invoke 'Generate' action to add tags or functions --> <tag> <name>hello</name> <tag-class>me.lisen.JavaEEStudy.HelloTag</tag-class> <body-content>empty</body-content> </tag> </taglib>使用标签<%@ page import="java.awt.*" %> <%@ page import="java.util.ArrayList" %><%-- Created by IntelliJ IDEA. User: lisen Date: 2017/11/10 Time: 下午12:43 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@page import="me.lisen.JavaEEStudy.Dpt" %> <%@taglib prefix="mytag" uri="/WEB-INF/hellotag.tld" %><%--定义标签--%> <html> <head> <title>首页</title> <script src="js/jquery-3.2.1.js" type="text/javascript"></script> <script src="css/bootstrap/js/bootstrap.js" type="text/javascript"></script> <link href="css/bootstrap/css/bootstrap.css" rel="stylesheet"> <script src="js/bootstrap-fileinput/js/fileinput.js" type="text/javascript"></script> <link href="js/bootstrap-fileinput/css/fileinput.css" rel="stylesheet"> <script src="js/bootstrap-fileinput/js/locales/zh.js" type="text/javascript"></script> </head> <body> <mytag:hello/><%--使用标签--%> </body> </html>如果标签描述文件的路径比较深,我们通过修改web.xml修改映射,然后调用对应的uri获取标签描述文件的位置首先,我们修改web.xml文件,对标签描述文件进行映射<jsp-config> <taglib> <taglib-uri>hellotagtld</taglib-uri> <taglib-location>/WEB-INF/hellotag.tld</taglib-location> </taglib> </jsp-config>修改标签引用的uri<%@taglib prefix="mytag" uri="hellotagtld" %><%--定义标签--%> 定义一个有属性的标签。修改继承的类package me.lisen.JavaEEStudy; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport; import java.text.SimpleDateFormat; import java.util.Date; public class HelloTag extends TagSupport { private String formatStr; public void setFormatStr(String formatStr) { this.formatStr = formatStr; } public String getFormatStr() { return formatStr; } @Override public int doStartTag() throws JspException { JspWriter jspWriter = super.pageContext.getOut(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatStr); try{ jspWriter.write(simpleDateFormat.format(new Date())); }catch (Exception e){ e.printStackTrace(); } return TagSupport.SKIP_BODY;//表示标签体为空 } }修改tld文件,加入定义的属性<?xml version="1.0" encoding="ISO-8859-1"?> <taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"> <tlib-version>1.0</tlib-version> <short-name>firsttag</short-name> <uri>https://lisen.cc</uri> <!-- Invoke 'Generate' action to add tags or functions --> <tag> <name>hello</name> <tag-class>me.lisen.JavaEEStudy.HelloTag</tag-class> <body-content>empty</body-content> <attribute> <name>formatStr</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> </taglib>修改调用方法,传入属性<mytag:hello formatStr="yyyy-MM-dd"/><%--使用标签--%>
2017年11月11日
1,269 阅读
0 评论
1 点赞
1
...
4
5