SSH个人相册

SSH个人相册

使用Maven环境下创建album相册管理

pom中找不到oracle数据库驱动问题

Missing artifact com.oracle:ojdbc6:jar:11.2.0.1.0

原因:Oracle的ojdbc.jar是收费的,所以maven的中央仓库中没有这个资源,只能通过配置本地库才能加载到项目中去。

废话不多说,解决方案如下:

1.首先确定你是否有安装oracle,如果有安装的话,找到ojdbc6.jar包

D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar(这是我路径,你们的可能与我不同)

2.将ojdbc6.jar包添加到maven,也就是运行下面的语句,注意:不是在C盘下运行,是在该目录下执行下面的语句,如果你不知道你的版本号,可以执行select * from v$version;进行查看

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc6.jar

img

安装成功

3.最后找到项目的pom.xml引入如下代码,右击项目名称,找到maven,找到update project更新下就ok了

com.oracle ojdbc6 11.2.0.1.0

作者:viktoria
来源:CSDN
原文:https://blog.csdn.net/viktoria/article/details/77503266/
版权声明:本文为博主原创文章,转载请附上博文链接!

关于在eclipse中web.xml找不到配置文件解决方案

eclipse中基于maven构建的web项目pom.xml中指定的jar包无法发布到tomcat中

1、点击项目然后右键proto

2.在文本框中输入Deployment Assembly 然后点击 add 找到 Java Build Path Entries

3.选择 Maven Dependencies即可

关于ssh整合中遇到找不到action或者是路径不对问题

注意:action即控制器中的方法必须是公开的

1.首先检查路径是否有误

2.检查是否开启动态调用 和 开启白名单

<constant name="struts.enable.DynamicMethodInvocation" value="true"/> 
 		<!-- 设置白名单 -->
		<global-allowed-methods>regex:.*</global-allowed-methods>  

3.如果以上还是出错,检查一下web.xml的struts2的中央控制器

4.如果以上还是出错,那么检查一下你的action中方法必须给public公开的

5.最后还是解决不了,就重新换一下jar包 依赖 可能是依赖冲突

关于js中使用submit会出现两次提交的形式

在from表单中input类型为submit,而提交方式为点击按钮使用ajax方式提交,会出现两次请求后台的情况

即出现表单提交 但是页面没有跳转成功,即出现两次请求后台的信息

解决方法,使用ajax提交时 input提交方式改为button方式,

 //注册
		  $("#registerForm").submit(function(){
		     if(checkuserName() && checkpassword() && checkemail()){  
				 addUserInfo_Ajax();
				 return true;
			 }/* else{
				 return false;
			 }   */
		 })

因为ajax是异步的,当在运行ajax的代码时候,此时程序提交了submit而没有进行进入ajax中,所以会在地址栏后面加上属性

因为使用submit提交方式

##关于sql多条件group by

select ai.albumId,ai.albumName,ai.albumCover,ai.albumDate,count(pi.photoId) as ct 
    from AlbumInfo ai left join PhotoInfo  pi on ai.albumId=pi.albumId 
     group by ai.albumId,ai.albumName,ai.albumCover,ai.albumDate

在hibernate如何使用呢?

一种使用构造函数的方法,即投影查询投影查询有三种方式:

1.直接查

2.查询返回对象

3.查询返回Map键值对

这里使用Map键值对查询

注意:使用键值对必须使用给其要列名创建别名

##关于上传图片 预览图片中遇到的坑?

1558343482038
在这里插入图片描述

<script type="text/javascript">
	function doFileChange(fileElm){
		var reader = new FileReader();//文件读取器
		reader.onload=function(e){    //文件加载
			$("#photoPreview").append("<img src='"+e.target.result+"'/>");
			
			
		}
		
		for(var i=0;i<fileElm.files.length;i++){
			reader.readAsDataURL(fileElm.files[i]);
			
		}
	
	}
</script>

当你添加多个图片的时候,则会在前台控制器报错

1558343570862
在这里插入图片描述
​ 即当前的程序正在读取图片,是什么原因呢?原因是当你第一张图片还没有reader.readAsDataURL(fileElm.files[i]);又在读取第二张图片

解决方法:使用回调函数:递归方法来执行

<script type="text/javascript">
	function doFileChange(fileElm){
		var reader = new FileReader();//文件读取器
		var index = 0; //声明第一张图片
		reader.onload=function(e){    //文件加载
			$("#photoPreview").append("<img src='"+e.target.result+"'/>");
			
			console.log(index);
			index++;//自身加一
			if(index<fileElm.files.length){//判断是否还有图片
				reader.readAsDataURL(fileElm.files[index]);//读取第二张 第三张。。。
			}
		}
		reader.readAsDataURL(fileElm.files[index]);//读取第一张图片
	}
</script>
用插件实现预览图片 这里插件引用的时lrz

就不用考虑线程阻塞问题

<script src="${pageContext.request.contextPath }/js/jquery-3.3.1.js"></script>
<script src="${pageContext.request.contextPath }/js/lrz/lrz.bundle.js"></script>
<script type="text/javascript">
		function doFileChange(fileElm){
			for(var i=0;i<fileElm.files.length;i++){
				lrz(fileElm.files[i],{width:900}).then(function(reslutObj){//对图片进行压缩
					$("#photoPreview").append("<img src='"+reslutObj.base64+"'/>");
				})
			}
			
		}


//这里仅仅是显示图片,对图片没有压缩
	/* function doFileChange(fileElm){
		var reader = new FileReader();//文件读取器
		var index = 0; //声明第一张图片
		$("#imgTip").show();
		reader.onload=function(e){    //文件加载
			$("#photoPreview").append("<img src='"+e.target.result+"'/>");
			
			console.log(index);
			index++;//自身加一
			if(index<fileElm.files.length){//判断是否还有图片
				reader.readAsDataURL(fileElm.files[index]);//读取第二张 第三张。。。
			}else{
				$("#imgTip").hide();
			}
		}
		reader.readAsDataURL(fileElm.files[index]);//读取第一张图片
	} */
</script>

关于图片垂直居中的方法

<div class="photoList">
		<s:iterator value="#request.photoList" var="pi">
			<section>
				<span><span> <img src="${rt }/${pi.photoUrl}">
				<label>文字说明</label>
			</section>
		</s:iterator>
	</div>

在图片旁边多加一个span标签;用的原理是 图片与文字垂直居中的方法

css样式的写法

	.photoList section img{
		max-height: 100%;max-width: 100%;
		vertical-align: middle;
	}
	.photoList section span{
		vertical-align: middle;height: 100%;display: inline-block;  <!--处理图片垂直居中的方法-->
	}

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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.bdqn.album.sys</groupId>
  <artifactId>album</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>album Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
   <!-- servlet的依赖 -->
   <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
			<scope>provided</scope>
		</dependency>
		<!-- junit -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/antlr/antlr -->
		<dependency>
			<groupId>antlr</groupId>
			<artifactId>antlr</artifactId>
			<version>2.7.7</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
		<dependency>
			<groupId>aopalliance</groupId>
			<artifactId>aopalliance</artifactId>
			<version>1.0</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.ow2.asm/asm -->
<!-- 		<dependency>
			<groupId>org.ow2.asm</groupId>
			<artifactId>asm</artifactId>
			<version>5.2</version>
		</dependency> -->
		<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>1.6.8</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.fasterxml/classmate -->
		<dependency>
			<groupId>com.fasterxml</groupId>
			<artifactId>classmate</artifactId>
			<version>1.3.0</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-pool/commons-pool -->
		<dependency>
			<groupId>commons-pool</groupId>
			<artifactId>commons-pool</artifactId>
			<version>1.5.3</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.4</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3.3</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.5</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.6</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.2</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.freemarker/freemarker -->
		<dependency>
			<groupId>org.freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>2.3.26-incubating</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.geronimo.specs/geronimo-jta_1.1_spec -->
		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-jta_1.1_spec</artifactId>
			<version>1.1.1</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.hibernate.common/hibernate-commons-annotations -->
		<dependency>
			<groupId>org.hibernate.common</groupId>
			<artifactId>hibernate-commons-annotations</artifactId>
			<version>5.0.1.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>5.1.4.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api -->
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.1-api</artifactId>
			<version>1.0.0.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.jboss/jandex -->
		<dependency>
			<groupId>org.jboss</groupId>
			<artifactId>jandex</artifactId>
			<version>2.0.3.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
		<dependency>
			<groupId>org.javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.20.0-GA</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging -->
		<dependency>
			<groupId>org.jboss.logging</groupId>
			<artifactId>jboss-logging</artifactId>
			<version>3.3.0.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
			<version>2.10.0</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/ognl/ognl -->
		<dependency>
			<groupId>ognl</groupId>
			<artifactId>ognl</artifactId>
			<version>3.1.15</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-expression -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.2.0.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-core -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-core</artifactId>
			<version>2.5.16</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-json-plugin -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-json-plugin</artifactId>
			<version>2.5.16</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-spring-plugin -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-spring-plugin</artifactId>
			<version>2.5.16</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-all -->
		<dependency>
			<groupId>org.apache.shiro</groupId>
			<artifactId>shiro-all</artifactId>
			<version>1.3.2</version>
		</dependency>
		<dependency>
			<groupId>com.oracle</groupId>
			<artifactId>ojdbc5</artifactId>
			<version>11.2.0.1.0</version>
		</dependency>
		<!-- action注解 -->
		<dependency>
		    <groupId>org.apache.struts</groupId>
		    <artifactId>struts2-convention-plugin</artifactId>
		    <version>2.5.16</version>
		</dependency>
	
		
  </dependencies>
  <build>
    <finalName>album</finalName>
    <plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			</plugins>
  </build>
</project>

下载路径
https://download.csdn.net/download/weixin_42736725/11190361

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值