小编shi*_*iva的帖子

ANTLR没有为Scala Grammar提供正确的输出标记

我是Scala的新手,我正在尝试使用Scala Grammar和ANTLR来解析Scala文件.下面是我从git hub链接获得的Scala Grammar的代码:

https://github.com/antlr/grammars-v4/tree/master/scala

有可能移动repo所以我在这里粘贴Scala语法代码:

grammar Scala;

literal           : '-'? IntegerLiteral
                | '-'? FloatingPointLiteral
                | BooleanLiteral
                | CharacterLiteral
                | StringLiteral
                | SymbolLiteral
                | 'null' ;

qualId            : Id ('.' Id)* ;

ids               : Id (',' Id)* ;

stableId          : (Id | (Id '.')? 'this') '.' Id
                | (Id '.')? 'super' classQualifier? '.' Id ;

classQualifier    : '[' Id ']' ;

type              : functionArgTypes '=>' type
                | infixType existentialClause? ;

functionArgTypes  : infixType
                | '(' ( paramType (',' paramType )* …
Run Code Online (Sandbox Code Playgroud)

java parsing scala antlr4

7
推荐指数
1
解决办法
256
查看次数

Spring MVC将上传的图像显示到外部文件夹中

我正在使用Spring mvc创建一个图像上传应用程序.我将图像成功保存在外部文件夹中.保存图像的代码如下:

  MultipartFile productImage = product.getProductImage();

        path= Paths.get("/oms/images/"+product.getProductName()+".jpg");

        System.out.println(path.toString());
        if(productImage!=null && !productImage.isEmpty()){

            try {
                productImage.transferTo(new File(path.toString()));
            } catch (IOException e) {
                e.printStackTrace();
                throw new RuntimeException("Product Image Saving Failed ",e);

            }
        }
Run Code Online (Sandbox Code Playgroud)

图像已成功保存到该外部文件夹中.但是当我试图将相同的图像显示到jsp文件中时,我最终得到了这个错误....

http://localhost:8081/oms/images/Ss.jpg Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8081/oms/images/pup.jpg Failed to load resource: the server responded with a status of 404 (Not Found) 
Run Code Online (Sandbox Code Playgroud)

显示图像的代码是这样的......

  <img src="<c:url value="/oms/images/${product.productName}.jpg"/>"/>
Run Code Online (Sandbox Code Playgroud)

我看到了同样问题的一些链接,但大多数问题都是将图像保存到与webapp不同的目录中(显然)!

我错过了什么吗?如何将外部资源添加到Spring?如何将用户添加的上传图像显示到jsp页面?

jsp spring-mvc image-uploading

1
推荐指数
1
解决办法
3313
查看次数

标签 统计

antlr4 ×1

image-uploading ×1

java ×1

jsp ×1

parsing ×1

scala ×1

spring-mvc ×1