jsp中<base target='' />标签用法

本文详细介绍了如何在页面跳转后,实现iframe元素在不同页面间的跳转与加载,通过实例展示了如何在index.jsp页面中跳转到manage/menu.jsp菜单页及基于data.json的数据展示页。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用于页面跳转后,页面最后跳转到哪个iframe。例子如下:

index.jsp :首页

<head>

    <base href="<%=basePath %>"/>
    <title>系统管理</title>
</head>
<body >


<div class="left" style="height: 700px;">
	<div class="menu">
		 <iframe src="manage/menu.jsp" id="menufra" name="menu" frameborder="0" style="margin-top:20px"></iframe>
	</div>
</div>

<div style="height:600px;" >
	<div class="main" align="right">
		<iframe src="basedata.json?method=findArealist" id="main" name="main" frameborder="1" style="margin-left: 1px;border: 0px solid red;width: 750px;margin-right: 30px"></iframe>
	</div>
</div>

</body>
</html>

menu.jsp:菜单页

<head>
  <title>菜单</title>
  <base href="<%=basePath %>">
  <base target="main" />
</head>

<body>
<table width="180"  align="center" border='0' cellspacing='0' cellpadding='0'>
	<tr>
		<td width='180' id='mainct' valign="top">
			<dl class='bitemdl'>
				<dt onClick="Show(this)">医院管理</dt>
				<dd class='sitem'>
					<ul class='sitemu'>
						<li><a href='basedata.json?method=findArealist' target="main">地区信息</a></li>
						<li><a href='basedata.json?method=findHospitallist' target="otherId">医院信息</a></li>
						<li><a href='basedata.json?method=findDeptlist'>科室信息</a></li>
					</ul>
				</dd>
			</dl>
			<dl class='bitemdl'>
				<dt onClick="Show(this)">用户管理</dt>
				<dd class='sitem'>
					<ul class='sitemu'>
						<li><a href='basedata.json?method=toAddUser'>添加用户</a></li>
						<li><a href='basedata.json?method=userList'>管理用户</a></li>
						<li><a href='basedata.json?method=userList&isVisable=0'>已删用户</a></li>
					</ul>
				</dd>
			</dl>	 
		</td>
	</tr>

</table>
</body>

把下面的source,改写成thymeleaf形式文件。 <%@ page contentType="text/html; charset=UTF-8"%> <%@ page pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <!DOCTYPE html> <html> <head> <!-- IEバージョン設定 --> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"> <title> 会社マスタ一覧画面</title> <!-- jQuery設定 --> <script src="<c:url value="/resources/js/jquery-1.11.3.min.js" />"></script> <!-- CSS設定 --> <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/tsocms.css" />"> <script> $(function() { $(".stockCompanyMasterListTable tr:odd").addClass("odd"); $(".stockCompanyMasterListTable tr:even").addClass("even"); }); </script> <script> <!-- function stockCompanyclearButton() { document.select.mechSubCode.value = ""; document.select.stockCompanyName.value =""; } function updateSubmitCheck() { if(!radioCheck("更新対象をラジオボタンで選択してください。")) return; stockCompanyMasterListUpdateButton(); } function deleteSubmitCheck() { if(!radioCheck("削除対象をラジオボタンで選択してください。")) return; stockCompanyMasterListDeleteButton(); } function stockCompanySearchButton() { var target = document.getElementById("stockCompanyMasterListForm"); target.action = "${pageContext.request.contextPath}/stockcompanymasterlist/select"; target.submit(); } function stockCompanyMasterListDeleteButton() { var target = document.getElementById("stockCompanyMasterListForm"); target.action = "${pageContext.request.contextPath}/stockcompanymasterdelete"; target.submit(); } function stockCompanyMasterListUpdateButton() { var target = document.getElementById("stockCompanyMasterListForm"); target.action = "${pageContext.request.contextPath}/stockcompanymasterupdate"; target.submit(); } function radioCheck(msg) { var flag = false; var elm = document.getElementsByName('selectedKey'); for (i = 0; i < elm.length; i++) { if (elm[i].checked) { flag = true; } } if (!flag) { alert(msg); return false; } return true; } //--> </script> </head> <body> <!-- <!-- ページ見出し --> <div> <h1> 会社マスタ一覧画面</h1> </div> <form:form name="select" modelAttribute="stockCompanyMasterListForm" method="post" action="${pageContext.request.contextPath}/stockcompanymasterlist/select"> <!-- 会社結果一覧表 --> <div class="stockCompanyMasterListTableAll"> <div class="keyleft"> <!-- 検索キー --> <!-- 機構加入者コード --> <div class="searchkey"> <span class="mechSubCodeKey">機構加入者コード</span> <form:input type="search" path="mechSubCode" size="45" /> </div> <!-- 会社名 --> <div class="searchkey"> <span class="stockCompanyNameKey">会社名</span> <form:input type="search" path="stockCompanyName" size="45" /> </div> <!-- Hidden検索キー --> <form:hidden path="mechSubCodeHidden" /> <form:hidden path="stockCompanyNameHidden" /> </div> <div class="keyright"> <!-- 検索ボタン --> <form:button type="submit" name="stockCompanySearchbutton" id="stockCompanySearchbutton" onclick="stockCompanySearchButton()">検索</form:button> <!-- 初期化ボタン --> <form:button type="button" name="stockCompanyclearbutton" id="stockCompanyclearbutton" onclick="stockCompanyclearButton()">初期化</form:button> </div> <div class="stockCompanyMasterListTable"> <table class="stockCompanyMasterListTable"> <thead class="stockCompanyMasterList"> <tr> <th class="radioButton"></th> <th class="mechSubCode">機構加入者コード</th> <th class="stockCompanyName">会社名</th> <th class="stockCompanyNameKana">会社名カナ</th> <th class="effectiveDate">適用開始日</th> <th class="expireDate">適用終了日</th> </tr> </thead> <tbody class="searchListBody"> <c:forEach var="detail" items="${stockCompanyMasterListForm.stockCompanyMasterListDetailFormList}" varStatus="status"> <tr> <td class="radioButton"> <form:radiobutton path="selectedKey" value="${detail.mechanismSubscriberCd},${detail.effectiveDate}" /><br> </td> <td class="mechSubCode"> <c:out value="${detail.mechanismSubscriberCd}"></c:out> </td> <td class="stockCompanyName"> <c:out value="${detail.stockcompany}"></c:out> </td> <td class="stockCompanyNameKana"> <c:out value="${detail.stockcompanyKana}"></c:out> </td> <td class="effectiveDate"> <c:out value="${detail.effectiveDate}"></c:out> </td> <td class="expireDate"> <c:out value="${detail.expireDate}"></c:out> </td> </tr> </c:forEach> </tbody> </table> </div> <div class="left"></div> <div class="right"> <!-- 新規登録ボタン --> <form:button type="button" name="stockCompanyMasterListRegisterbutton" id="stockCompanyMasterListRegisterbutton" onclick="location.href='${pageContext.request.contextPath}/stockcompanymasterregister'">新規登録</form:button> <!-- 更新ボタン --> <form:button type="button" name="stockCompanyMasterListUpdatebutton" id="stockCompanyMasterListUpdatebutton" onclick="updateSubmitCheck()">更新</form:button> <!-- 削除ボタン --> <form:button type="button" name="stockCompanyMasterListDeletebutton" id="stockCompanyMasterListDeletebutton" onclick="deleteSubmitCheck()">削除</form:button> <!-- 戻るボタン --> <form:button type="button" name="stockCompanyMasterListReturnbutton" id="stockCompanyMasterListReturnbutton" onclick="location.href='${pageContext.request.contextPath}/master'">戻る</form:button> </div> </div> </form:form> </body> </html>
07-18
有网页的源码,怎么在idea里用vue复现,运用element-UI组件,view-source:https://rloopbase.nju.edu.cn/ ,源码如下: <html xmlns="http://www.w3.org/1999/xhtml " xml:lang="en" lang="en"> <link rel="stylesheet" type="text/css" href="/css/myIndex.css"> <head> <title>R-loopBase</title> <link rel="icon" href="/images/icon-rloop-purple-circle-2.png" type="image/x-icon"> </head> <body> <div class="container"> <div class="indexBar"></div> <div class="card"> <!-- Introduction --> <div class="cardTitle"> Introduction </div> <div class="cardContext"> <p id="introductionText" class="cardP">The R-loop, a three-stranded nucleic acid structure composed of an RNA:DNA hybrid and a displaced single-stranded DNA, plays versatile roles in many physiological and pathological processes. However, its controversial genomic localization and incomplete understanding of its regulatory network raise great challenges for R-loop research. Here, we present R-loopBase to tackle these pressing issues by systematic integration of a huge amount of genomics and literature data. A reference set of human R-loop zones is computed with confidence scores and detailed annotations (<span style="font-weight: bold"><a href="/index.jsp">Search</a></span>, <span style="font-weight: bold"><a href="/help.jsp">Help</a></span> and <span style="font-weight: bold"><a href="/download.jsp">Download</a></span>), all of which can be visualized in well-annotated genomic context in a local genome browser (<span style="font-weight: bold"><a href="https://rloopbase.nju.edu.cn/browser/cgi-bin/hgTracks ">Browser</a></span>). A list of 1,185 R-loop regulators is manually curated from PubMed literatures and annotated with most up-to-date multi-omics data (<span style="font-weight: bold"><a href="/rloopRegulator.jsp">Regulator</a></span></span>). We have also manually curated 24 R-loop regulators in mouse, 63 in yeast (<i>saccharomyces cerevisiae</i>) and 21 in <i>Escherichia coli</i> to facilicate R-loop research in these model organisms (<span style="font-weight: bold"><a href="/rloopRegulator.jsp">Regulator</a></span>). We further deduce the functional relationship between individual R-loops and their putative regulators (<span style="font-weight: bold"><a href="/rloopRegulator.jsp">Regulator</a></span> and <span style="font-weight: bold"><a href="/download.jsp">Download</a></span>). In total, we have generated billions of entries of functional annotations, which can be easily accessed in our user-friendly interfaces (<span style="font-weight: bold"><a href="/help.jsp">Help</a></span>). The regulator summary and genomic annotation of R-loop regions will be constantly updated along the research progress of field. You are welcome to contribute to updating R-loop regulators and related literatures (Regulator Updating System on <span style="font-weight: bold"><a href="/rloopRegulator.jsp">Regulator</a></span> page). Any suggestions and feedbacks from you are also welcome (<span style="font-weight: bold"><a href="/contact.jsp">Contact</a></span>). </p> </div> <a href="##"><div id="showIntroduction" onclick="showMoreOrLess()" style="text-decoration: underline; text-align: right; padding-right: 20px; margin-top: -15px;">Show more</div></a> <hr class="cardHr"> </div> <!-- Introduction --> <div class="searchContainer"> <div class="searchLogo"> <ul> <li class="searchLogoText">R-loopBase</li> <li class="searchLogoImg"><img src="/images/icon-rloop-purple-circle-2.png" style="height: 60px;"></li> </ul> </div> <div class="searchForm"> <input id="searchText" type="text" name="" placeholder="e.g. BRCA2 or chr1:154572702-154628593" onkeypress="handle(event)"> <a href="#"><div class="searchItem" href="#" onclick="toGeneList()"> <i>search</i> </div></a> </div> </div> <div class="horizontalMenu"> <!-- horizontal menu --> <ul id="indexNavigator"> <li> <a href="/browser/cgi-bin/hgTracks"> <img src="/images/browser.png"> <div>Browser</div> </a> </li> <li> <a href="/rloopRegulator.jsp"> <img src="/images/regulator.png"> <div>Regulator</div> </a> </li> <li> <a href="https://rloopbase.nju.edu.cn/deepr/tool/model "> <img src="/images/tool.png"> <div>Tool</div> </a> </li> <li> <a href="/download.jsp"> <img src="/images/download.png"> <div>Download</div> </a> </li> <li> <a href="/help.jsp"> <img src="/images/help.png"> <div>Help</div> </a> </li> <li> <a href="/contact.jsp"> <img src="/images/contact.png"> <div>Contact</div> </a> </li> </ul> </div> <!-- horizontal menu --> <div class="twoCardContainer"> <div class="card cardLeft"><!-- News --> <div class="cardTitle"> News </div> <div class="cardContext" id="newsDiv" style="overflow:hidden;clear:both;height:220px"> <ul> <li>2023.10.01 Online of <a href='https://rloopbase.nju.edu.cn/deepr/tool/model '>DeepER</a>, an R-loop prediction tool.</li> <li>2022.02.19 A new <a href="https://doi.org/10.1101/2022.02.18.480986 ">preprint</a> by R-loopBase team.</li> <li>2021.11.18 Published on <a href="https://doi.org/10.1093/nar/gkab1103 ">Nucleic Acids Res</a>.</li> <li>2021.06.20 Official release of R-loopBase v1.0.</li> <li>2021.06.15 Internal evaluation before public release.</li> <li>2021.05.10 Build-up of R-loopBase genome browser.</li> <li>2021.03.31 Data freeze for R-loopBase v1.0.</li> <li>2021.01.18 Launching R-loopBase project.</li> <li>2020.10.10 Systematic evalation of all R-loop mapping technologies.</li> </ul> </div> <a href="##"><div id="showNews" onclick="showMoreOrLess2()" style="text-decoration: underline; text-align: right; padding-right: 20px; margin-top: 4px;">Show more</div></a> <hr class="cardHr"> </div><!-- News --> <div class="card cardRight"> <!-- Publication --> <div class="cardTitle"> Latest Publications </div> <div class="cardContext" id="publicationDiv"> <ul> <li><a style="color: black" href="https://pubmed.ncbi.nlm.nih.gov/38590928/ ">LUC7L3 is a downstream factor of SRSF1 and prevents genomic instability.</a> Cell Insight. 2024.</li> <li><a style="color: black" href="https://pubmed.ncbi.nlm.nih.gov/38677845/ ">Smartphone-based device for rapid and single-step detection of piRNA-651 using anti-DNA:RNA hybrid antibody and enzymatic signal amplification.</a> Anal Chim Acta. 2024.</li> <li><a style="color: black" href="https://pubmed.ncbi.nlm.nih.gov/38609257/ ">Split activator of CRISPR/Cas12a for direct and sensitive detection of microRNA.</a> Anal Chim Acta. 2024.</li> </ul> <div style="width: 100%; text-align: right; margin-top: -4px;"><a href="https://pubmed.ncbi.nlm.nih.gov/?term=%28R-loop%29+OR+%28R-loops%29+OR+%28%22RNA+DNA+hybrid%22%29+OR+%28%22RNA+DNA+hybrids%22%29+OR+%28%22DNA+RNA+hybrid%22%29+OR+%28%22DNA+RNA+hybrids%22%29&sort=pubdate ">More publications in PubMed</a></div> </div> <hr class="cardHr"> </div> <!-- Publication --> </div> <div class="footer"> <div style="background-color: rgb(90,19,92); height: 60px; line-height: 60px; text-align: center; color: white; "> <div style="display: inline-block; height: 20px; line-height: 20px; margin-top: 15px; margin-bottom: 4px;">© 2020-2025 NANJING UNIVERSITY. ALL RIGHTS RESERVED. </div> <div style="height: 20px; line-height: 20px; margin-top: 0px;">CONDITIONS OF USE</div> </div> </div> </div> <!-- container --> </body> </html> <script type="text/javascript" language="JavaScript"> function handle(e){ if(e.keyCode === 13){ e.preventDefault(); // Ensure it is only this code that runs toGeneList(); } } function toGeneList(){ //var type = document.getElementById('searchSelect').value; var type; var value = document.getElementById('searchText').value; if(value==''){ alert("Please input keyword!"); }else if(value.match(/[^a-zA-Z0-9:-]/)){ alert("Only numbers, letters, \":\" and \"-\" are allowed!"); }else{ //top.location = '/geneList.jsp?searchFor=' + type + '&keyword=' + value; if(value.match(/^chr.+:\d+-\d+$/)){ type="location"; }else{ type="symbols"; } top.location = '/rloopList.jsp?searchFor=' + type + '&keyword=' + value; } } function changeLiSize(){ var selectId = document.getElementById("myNavigator"); } function showMoreOrLess(){ var selectId = document.getElementById("showIntroduction"); var selectText = document.getElementById("introductionText"); if(selectId.innerText == "Show more"){ selectText.style.height="auto"; selectId.innerText="Show less"; }else{ selectText.style.height="120px"; selectId.innerText="Show more"; } } function showMoreOrLess2(){ var selectId2 = document.getElementById("showNews"); var selectText2 = document.getElementById("newsDiv"); if(selectId2.innerText == "Show more"){ selectText2.style.height="auto"; selectId2.innerText="Show less"; }else{ selectText2.style.height="220px"; selectId2.innerText="Show more"; } } var publicationDivHeight = document.getElementById('publicationDiv').clientHeight; </script>
最新发布
07-29
pom.xml:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>jdwlw</groupId> <artifactId>jdwlw</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>maven Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> </dependency> --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>com.sun.xml.messaging.saaj</groupId> <artifactId>saaj-impl</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.1.6.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.ksoap2/ksoap2 --> <dependency> <groupId>org.ksoap2</groupId> <artifactId>ksoap2</artifactId> <version>2.1.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.1.6.RELEASE</version> </dependency> <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>4.1.6.RELEASE</version> </dependency> --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.2.13.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>3.2.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc-portlet</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-websocket</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>quartz</groupId> <artifactId>quartz</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>org.apache.ibatis</groupId> <artifactId>ibatis-sqlmap</artifactId> <version>2.3.4.726</version> </dependency> <!-- <dependency>--> <!-- <groupId>com.ibatis</groupId>--> <!-- <artifactId>ibatis2-sqlmap</artifactId>--> <!-- <version>2.1.7.597</version>--> <!-- </dependency>--> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> <version>1.6</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.4.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.5.0-b01</version> </dependency> <!-- 激光消息推送Starts --> <dependency> <groupId>cn.jpush.api</groupId> <artifactId>jpush-client</artifactId> <version>3.1.3</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>17.0</version> </dependency> <dependency> <groupId>com.squareup.okhttp</groupId> <artifactId>mockwebserver</artifactId> <version>1.5.4</version> <scope>test</scope> </dependency> <!-- 激光消息推送END --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.11</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.10.0</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-net/commons-net --> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.3</version> </dependency> <!-- https://mvnrepository.com/artifact/com.mchange/c3p0 --> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.ws.commons.axiom/axiom-api --> <dependency> <groupId>org.apache.ws.commons.axiom</groupId> <artifactId>axiom-api</artifactId> <version>1.2.13</version> </dependency> <!-- https://mvnrepository.com/artifact/dom4j/dom4j --> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis/axis --> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api --> <dependency> <groupId>javax.xml.rpc</groupId> <artifactId>javax.xml.rpc-api</artifactId> <version>1.1.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2 --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> <version>1.7.6</version> <type>pom</type> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-adb</artifactId> <version>1.7.6</version> </dependency> <!-- https://mvnrepository.com/artifact/soap/soap --> <dependency> <groupId>soap</groupId> <artifactId>soap</artifactId> <version>2.3</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.10.4</version> </dependency> <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.2</version> </dependency> </dependencies> <build> <finalName>jdwlw</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>utf-8</encoding> <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project> DESUtil.java:package com.source.root.tools.util; import java.io.IOException; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class DESUtil { private final static String DES = "DES/CBC/PKCS5Padding"; public static void main(String[] args) throws Exception { String data = "123456789"; String key = "jia%duo$"; System.err.println(encrypt(data, key)); System.err.println(decrypt(encrypt(data, key), key)); } /** * Description 根据键值进行加密 * * @param data * @param key * 加密键byte数组 * @return * @throws Exception */ public static String encrypt(String data, String key) throws Exception { byte[] bt = encrypt(data.getBytes(), key.getBytes()); return new BASE64Encoder().encode(bt); } /** * Description 根据键值进行解密 * * @param data * @param key * 加密键byte数组 * @return * @throws IOException * @throws Exception */ public static String decrypt(String data, String key) throws IOException, Exception { if (data == null) return null; BASE64Decoder decoder = new BASE64Decoder(); byte[] buf = decoder.decodeBuffer(data); byte[] bt = decrypt(buf, key.getBytes()); return new String(bt); } /** * Description 根据键值进行加密 * * @param data * @param key * 加密键byte数组 * @return * @throws Exception */ private static byte[] encrypt(byte[] data, byte[] key) throws Exception { // 生成一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 从原始密钥数据创建DESKeySpec对象 DESKeySpec dks = new DESKeySpec(key); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(dks); // Cipher对象实际完成加密操作 Cipher cipher = Cipher.getInstance("DES"); // 用密钥初始化Cipher对象 cipher.init(Cipher.ENCRYPT_MODE, securekey, sr); return cipher.doFinal(data); } /** * Description 根据键值进行解密 * * @param data * @param key * 加密键byte数组 * @return * @throws Exception */ private static byte[] decrypt(byte[] data, byte[] key) throws Exception { // 生成一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 从原始密钥数据创建DESKeySpec对象 DESKeySpec dks = new DESKeySpec(key); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(dks); // Cipher对象实际完成解密操作 Cipher cipher = Cipher.getInstance("DES"); // 用密钥初始化Cipher对象 cipher.init(Cipher.DECRYPT_MODE, securekey, sr); return cipher.doFinal(data); } } 不改变pom.xml中配置,不改变DESUtil.java代码,当前环境为java11必须使用java11,解决mvn package后的报错。[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jdwlw: Compilation failure: Compilation failure: [ERROR] /D:/biancheng/yf服务器代码/jdwlw/src/main/java/com/source/root/tools/util/DESUtil.java:[11,16] 找不到符号 [ERROR] 符号: 类 BASE64Decoder [ERROR] 位置: 程序包 sun.misc [ERROR] /D:/biancheng/yf服务器代码/jdwlw/src/main/java/com/source/root/tools/util/DESUtil.java:[12,16] 找不到符号 [ERROR] 符号: 类 BASE64Encoder [ERROR] 位置: 程序包 sun.misc [ERROR] /D:/biancheng/yf服务器代码/jdwlw/src/main/java/com/source/root/tools/util/DESUtil.java:[38,28] 找不到符号 [ERROR] 符号: 类 BASE64Encoder [ERROR] 位置: 类 com.source.root.tools.util.DESUtil [ERROR] /D:/biancheng/yf服务器代码/jdwlw/src/main/java/com/source/root/tools/util/DESUtil.java:[55,17] 找不到符号 [ERROR] 符号: 类 BASE64Decoder [ERROR] 位置: 类 com.source.root.tools.util.DESUtil [ERROR] /D:/biancheng/yf服务器代码/jdwlw/src/main/java/com/source/root/tools/util/DESUtil.java:[55,45] 找不到符号 [ERROR] 符号: 类 BASE64Decoder [ERROR] 位置: 类 com.source.root.tools.util.DESUtil [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
07-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值