小编Kam*_*ini的帖子

jquery autocomplete transformResult自动焦点属性不起作用

现在它看起来像这样 在此输入图像描述

我正在jquery自动完成下面是我的代码,我想搜索城市.

jQuery('#citySearch').autocomplete({
        serviceUrl: basePath + '/selectMycities.json',
        paramName: "tagName", // 
        onSelect: function(suggestion) {
            cityID = suggestion.data;
            cityId=cityID;
            jQuery("#cityId").val(cityID);
            return false;
        },
        transformResult: function(response) {

            return {

                suggestions: jQuery.map(jQuery.parseJSON(response), function(item) {
                    return {
                        value: item.cityName,
                        data: item.cityId,
                        id: item.cityId
                    };

                })
            };
        }
    });
Run Code Online (Sandbox Code Playgroud)

现在在上面的自动完成中我想将autoFocus设置为true但它不起作用.请帮忙.

它应该像第二张图像

在此输入图像描述

javascript jquery-plugins jquery-autocomplete

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

Spring启动如何在eclipse中使项目在服务器上运行

我是Spring Boot的新手,我在Eclipse IDE中有示例Spring启动代码.

现在运行该项目.在项目中有类"Application",我使用Run As Java Application运行它,然后在给定端口上运行它.

但我希望它使用Eclipse的Run on Server选项运行,因此每当我尝试在服务器上运行它时它就会给我404.

请给我任何解决此问题的想法.

码:

@ComponentScan
@Configuration
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer {

@Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return application.sources(Application.class);
        }

    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);

        System.out.println("Let's inspect the beans provided by Spring Boot:");
        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        System.out.println(Arrays.toString(beanNames));
    }
}
Run Code Online (Sandbox Code Playgroud)

application.properties

server.address=localhost
server.port=8080
server.contextPath=/spring-security-cas
app.service.security=http://localhost:8080/j_spring_cas_security_check
app.service.home=http://localhost:8080/
Run Code Online (Sandbox Code Playgroud)

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>org.esco.demo</groupId>
    <artifactId>spring-security-cas</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>demo-spring-security-cas</name>
    <description>Demo project …
Run Code Online (Sandbox Code Playgroud)

java eclipse spring spring-boot

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

获取异常FontFormatException不支持的sfnt resources/fonts/OpenSansEmoji.ttf

我有资源/字体文件夹中的OpenSansEmoji.ttf和其他字体,如Proxima Nova Regular.otf,对于Proxima Nova Regular.otf/Proxima Nova Alt Light.ttf它不会给我异常,OpenSansEmoji.otf也不是OpenSansEmoji. ttf它给了我以下异常我该怎么办?

 Feb  25, 2015 10:37:31 AM java2d.utils.FontUtils getFont
    SEVERE: null
    java.awt.FontFormatException: Unsupported sfnt resources/fonts/OpenSansEmoji.ttf
        at sun.font.TrueTypeFont.init(TrueTypeFont.java:522)
        at sun.font.TrueTypeFont.<init>(TrueTypeFont.java:191)
        at sun.font.SunFontManager.createFont2D(SunFontManager.java:2460)
        at java.awt.Font.<init>(Font.java:614)
        at java.awt.Font.createFont(Font.java:1023)
        at java2d.utils.FontUtils.getFont(FontUtils.java:53)
        at java2d.CrushCard.drawMessageString(CrushCard.java:311)
        at java2d.CrushCard.createCrushCard(CrushCard.java:134)
        at java2d.Java2D.main(Java2D.java:43)
Run Code Online (Sandbox Code Playgroud)

我的代码在这里

  try {
            FontUtils.registerFonts(fonts);
        } catch (IOException | FontFormatException ex) {
            Logger.getLogger(Java2D.class.getName()).log(Level.SEVERE, null, ex);
        }



  public static void registerFonts(List<String> paths) throws IOException, FontFormatException {

        for (String path : paths) {
            String fName = "resources/fonts/" + path;
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); …
Run Code Online (Sandbox Code Playgroud)

java fonts truetype opentype emoji

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

html5地理定位不适用于Safari浏览器

致力于html5地理定位.

尝试过mozilla,chrome,IE.他们工作正常,但没有为野生动物园工作.在Mac上的safari(8.0.5)上进行测试,在windows上使用safari(5.1)进行测试

只需点击网址

http://www.w3schools.com/html/html5_geolocation.asp
Run Code Online (Sandbox Code Playgroud)

要么

http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation

  <!DOCTYPE html>
<html>
<body>

<p>Click the button to get your coordinates.</p>

<button onclick="getLocation()">Try It</button>

<p id="demo"></p>

<script>
var x = document.getElementById("demo");

function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else { 
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}

function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude;  
}
</script>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

它允许弹出允许/禁止但在允许后不执行任何操作.我已经在Mac上测试了与wi-fi连接的Safari,但不适用于wi-fi和LAN上的笔记本电脑.

html javascript windows safari geolocation

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