小编kri*_*Ram的帖子

警告 osweb.servlet.PageNotFound - 未找到带有 URI 的 HTTP 请求的映射

添加 Assets 文件夹时出现此错误。它为“资产”文件夹中包含的每个文件提供错误。

WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/assets/plugins/datepicker/datepicker3.css] in DispatcherServlet with name 'dispatcher'
Run Code Online (Sandbox Code Playgroud)

这是 Dispacther 配置文件

package com.springmaven.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;


@Configuration
@EnableWebMvc
@ComponentScan({"com.springmaven.controller"})
public class DispatcherConfig {

    @Bean
    public InternalResourceViewResolver getInternalResourceViewResolver()
    {
        InternalResourceViewResolver internalResourceViewResolver=new InternalResourceViewResolver();
        internalResourceViewResolver.setPrefix("/WEB-INF/JSP/");
        internalResourceViewResolver.setSuffix(".jsp");
        return internalResourceViewResolver;
    }   
}
Run Code Online (Sandbox Code Playgroud)

这是应用配置

package com.springmaven.config;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

public class AppIntializer implements WebApplicationInitializer{ …
Run Code Online (Sandbox Code Playgroud)

java spring jsp spring-mvc spring-security

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

无法使用请求的结果类型为返回多个以上查询的查询创建TypedQuery

我收到错误消息“无法使用请求的结果类型为多个返回的查询创建TypedQuery”,我尝试对所有列的值进行返回。到那时应用程序挂起。我需要在arraylist中获取客户端列表。请帮助,我是JPA的新手。

@Override
    public ArrayList<Client> findAllClients() {
        EntityManager entity = this.emf.createEntityManager();
        List<Client> clients = entity.createQuery("select clientID,clientName from Client", Client.class).getResultList();
        return (ArrayList<Client>) clients;
    }
Run Code Online (Sandbox Code Playgroud)

客户类别为

package com.springmaven.models;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;


import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="tblclient")
public class Client {
    @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="ntClientID")
    private Long clientId;

    @Column(name="vcClientName")
    private String clientName;

    @Column(name="vcLocation")
    private String location;

    @Column(name="ofstTimeZone")
    private Date timeZone;

    @Column(name="vcCommunicationMode")
    private String communicationMode;

    @Column(name="vcContact")
    private String …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa

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

标签 统计

java ×2

spring ×2

hibernate ×1

jpa ×1

jsp ×1

spring-mvc ×1

spring-security ×1