当前位置:首页 » 文件管理 » tomcat上传

tomcat上传

发布时间: 2023-01-02 02:57:17

㈠ dist上传去tomcat怎么启动

dist上传去tomcat按以下步骤启动:
1、在开始菜单中选择所有程序,在所有程序中有一个ApacheTomcat的文件夹,单击展开。
2、选择这个文件夹中的ConfigureTomcat程序、单击启动。
3、在主界面中就可以看到一个Start的开始按钮了,单击等待一会就可以启动tomcat了。

㈡ 怎么向tomcat服务器上传文件

1.将tomcat环境搭配好

path中加入:

%CATALINA_HOME%\lib;%CATALINA_HOME%\bin;

2.修改tomcat中config/server.xml

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>
<Context docBase="D:\workspace\picture\target\mvc-basic.war" path="/picture"/>

</Host>

添加红色部分

docBase中要为项目打包成的war文件。

path随意

启动tomcat bin\startup.bat,如果这时tomcat一闪而过,表示启动异常,很可能是配置或者server.xml出问题了。

注意:有时即使更改了war文件里面的文件,程序仍然没有任何变化,这个时候要把apache-tomcat-7.0.11\webapps下的项目文件给删除,再重新启动tomcat。

由于我是用eclipse开发的,下面那段红色线表示我发布的位置,wtpwebapps下,我试过,只有把图片放在D:\workspace
\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\ROOT里面项目
才能读取到图片。而如果将项目打包成war后,更改<Context docBase="D:\workspace\picture\target\mvc-basic.war" path="/picture"/>更tomcat的根目录是apache-tomcat-7.0.11\webapps,只需要在这个下面建立images目录,把图片往里面存就行了。

3.代码

[java] view plain
private static final String PICTURE_WEB_INF = "/picture/WEB-INF";
private static final String ROOT_IMAGES_PICTURE = "/ROOT/images/picture";
private static final String IMAGES_PICTURE = "/images/picture";

@RequestMapping(value = "/add",method = RequestMethod.POST)
public String save(Picture picture, HttpServletRequest request) {
this.FileAndSaveFile(request, picture);
this.pictureService.save(picture);
return "redirect:/index";
}

private void FileAndSaveFile(HttpServletRequest request, Picture material) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
for (Map.Entry<String, MultipartFile> entity : multipartRequest.getFileMap().entrySet()) {
MultipartFile mf = entity.getValue();
String uuid = UUID.randomUUID().toString();
String classPath = this.getClass().getClassLoader().getResource("/").getPath();
try {
classPath =URLDecoder.decode(classPath, "gb2312");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
classPath = classPath.split(PICTURE_WEB_INF)[0];
File pictureFile = new File(classPath+ROOT_IMAGES_PICTURE);
if(!pictureFile.exists()){
pictureFile.mkdirs();
}

String path = pictureFile.getPath();
String ext = null;
try {
if (null == mf || mf.isEmpty() || null == mf.getInputStream() || mf.getSize() > 40000000) {
return;
}
ext = Files.getFileExtension(mf.getOriginalFilename());
if(classPath.indexOf("wtpwebapps")!=-1){
path = classPath+ROOT_IMAGES_PICTURE;
}else{
path = classPath+IMAGES_PICTURE;
}
File f = new File(path +"/" + uuid + "." + ext);
Files.createParentDirs(f);
FileCopyUtils.(mf.getBytes(), f);
material.setFilePath(IMAGES_PICTURE + "/" + uuid + "." + ext);
material.setFileName(mf.getOriginalFilename());
} catch (IOException e) {
e.printStackTrace();
}
}
}

因为使用eclipse开发的,所以会是indexof(wtpwebapps),其他的开发工具要看情况。

jsp:

另外img src好像不支持用绝对路径,显示不出来,我也不知道为什么,网络了很多都没说,但是绝对路径应该是不可行的,因为有时需要移植什么的容易出现问题。

[html] view plain
<head>
<title>图片列表</title>
<script language="javascript" src="./resources/js/jquery-1.8.3.js"> </script>
<script language="javascript" src="./resources/js/jquery.validate.min.js"> </script>
<script language="javascript" src="./resources/js/picture/add.js"> </script>
</head>
<body>
<form action = "<c:url value = "/picture/add"></c:url>" method = "post" id="add_form" enctype="multipart/form-data">
<table class="tab01">
<tr>
<td class="name">名称:</td>
<td><input id = "name" type="text" class="text_input" name="title" placeholder="标题"/></td>
<td><label for="title" class="error" generated="true" style="color:red;font-size:12px;"></label></td>
</tr>
<tr>
<td class="name">上传图片:</td>
<td><input type="file" class="text_input" name="file" id="file" placeholder="上传图片"/></td>
<td><label for="file" class="error" generated="true" style="color:red;font-size:12px;"></label></td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<input type="submit" class="button" id="submitButton" value="提交" name="reset" />
<input type="reset" class="button" value="重置" name="reset" />
</td>
</tr>
</table>
</form>
<br/><br/><br/>
<c:forEach items = "${pictureList }" var = "picture">
<p>${picture.title }</p>
<div><img src="${picture.filePath }" width = "500" height = "500" BORDER="0" ALT="无图片"/>
</div>
</c:forEach>
</body>

[javascript] view plain
$(function(){
jQuery.validator.messages.required = "<span class='error' generated='true' style='color: red; font-size: 12px;'>*请填写此内容</span>";
jQuery.validator.messages.maxlength = "<span class='error' generated='true' style='color: red; font-size: 12px;'>*已达到最大字符数 </span>";
jQuery.validator.messages.accept = "<span class='error' generated='true' style='color: red; font-size: 12px;'>*请输入拥有合法后缀名的字符串 </span>";

$("#add_form").validate({

rules : {
title : {required : true, maxlength :200 },
file : {required : true}
}
});
$("input[type='file']").change(function(){
alert(this.files[0].size);
if(this.files[0].size>300*1024){
alert("图片太大!!图片不大于300KB");
$("#submitButton").attr("disabled","disabled");
}else{
$("#submitButton").removeAttr("disabled");
}
});

$("#add_form").submit(function() {
var filepath=$("input[name='file']").val();
var extStart=filepath.lastIndexOf(".");
var ext=filepath.substring(extStart,filepath.length).toUpperCase();
if(ext!=".BMP"&&ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
alert("图片限于bmp,png,gif,jpeg,jpg格式");
return false;
}
return true;
});
});

㈢ tomcat怎么上传war包

首先,在项目上右击,选择export,之后选择other,在找到war file,点击下一步; 然后,选择保存路径为tomcat下的webappen路径,并填写上文件名称,之后finsh; 最后,找到tomcat下的bin路径,点击startup.bat运行即可,

㈣ tomcat中如何设置文件上传大小的控制,例如:超过Tomcat限定的50M , 而本人需要上传90M的WAR文件。

1、打开tomcat的默认配置文件(tomcat程序安装目录下的conf文件夹中的server.xml文件)。
2、找到里面的<Connector>标签,在该标签中添加"maxPostSize"属性,将该属性值设置成你想要的最大值,单位是字节,或者把这个值设置为 0(maxPostSize="0"),tomcat将不再检查文件的大小。即可解决上述问题。

㈤ Tomcat中上传应用程序时,应用程序是什么类型的文件

WebArchive。
Tomcat中上传应用程序时,应用程序是一个(WebArchive)类型的文件。WAR是Sun提出的一种Web应用程序格式,与JAR类似,也是许多文件的一个压缩包。
应用程序是指为了完成某项或某几项特定任务而被开发运行于操作系统之上的计算机程序。应用程序与应用软件的概念不同,但常常因为概念相似而被混淆。软件指程序与其相关文档或其他从属物的集合。一般我们视程序为软件的一个组成部分。

㈥ 怎样通过tomcat上传文件

你是想发布工程,还是想发布或新增修改个页面,例如jsp。如果是这样的话,看看你是什么服务器,如果windows,直接替换就可以。如果是unix或linux等系统,利用ftp,或 scp命令行 替换即可。然后重新启动 tomcat。就OK 了。

㈦ tomcat上传文件问题

第一步:需要先创建一个server,可以通过windows中的show view,之后找到server,

第二步:在server窗口中右击,选择”new-server“,之后创建好tomcat server。

第三步:双击创建的server,进入server设置界面,设置Server Location,选择编译路径是”Use Tomcat“即可切换到Tomcat的路径,保存。

第四步:之后将server项目添加到此server下,这样就完成了部署到Tomcat下。

㈧ SpringBoot tomcat 上传文件大小受限制

applicaton.properties配置:

spring.servlet.multipart.max-file-size=200MB

spring.servlet.multipart.max-request-size=200MB



application.yml配置:

# Spring配置

spring:

  # 文件上传

  servlet:

    multipart:

      # 单个文件大小

      max-file-size:  20000MB

      # 设置总上传的文件大小

      max-request-size:  50000MB

并且添加如下配置文件

import javax.servlet.MultipartConfigElement;

import org.springframework.boot.web.servlet.MultipartConfigFactory;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.util.unit.DataSize;

@Configuration

public class UploadConfig {

    @Bean

    public MultipartConfigElement multipartConfigElement() {

        MultipartConfigFactory factory = new MultipartConfigFactory();

        //文件最大20000M

        factory.setMaxFileSize(DataSize.ofMegabytes(20000));

//        factory.setMaxFileSize(DataSize.parse("100MB"));

        // 设置总上传数据总大小

        factory.setMaxRequestSize(DataSize.parse("50000MB"));

        return factory.createMultipartConfig();

    }

}

㈨ tomcat上传比远程桌面复制慢

因为文件容量过大。
tomcat运行正常,上传数据很缓慢,或者数据丢失。检查网络正常,检查数据库正常,也不卡顿,就是上传数据到数据库的时候很卡顿。如果是上述情况,既不是网络也不是数据库出现问题,建议压缩文件,或者选择远程桌面复制上传。

热点内容
我的世界网易ec服务器ip地址 发布:2025-08-26 15:00:36 浏览:139
pythongzip解压 发布:2025-08-26 14:55:10 浏览:411
wifi的密码是什么意思啊 发布:2025-08-26 14:45:43 浏览:762
3070linux驱动 发布:2025-08-26 14:42:48 浏览:128
编程小课包 发布:2025-08-26 14:35:35 浏览:803
分卷解压不了 发布:2025-08-26 13:38:10 浏览:219
word2010加密怎么 发布:2025-08-26 13:36:36 浏览:674
访问学者访问时间 发布:2025-08-26 13:33:46 浏览:583
tc软件编程 发布:2025-08-26 13:33:44 浏览:315
医保卡的密码怎么修改密码 发布:2025-08-26 13:23:53 浏览:629