sencha touch 2键“minimum-ui”不被承认和忽视 [英] sencha touch 2 the key "minimum-ui" is not recognized and ignored

查看:584
本文介绍了sencha touch 2键“minimum-ui”不被承认和忽视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





ControllerConfiguration.java

  package org.java.springmvc.bootstrap; 

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(basePackages =org.java.springmvc.controller)
public class ControllerConfiguration {

@Bean
public InternalResourceViewResolver configureInternalResourceViewResolver(){
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix(/ WEB-INF / views /);
resolver.setSuffix(。jsp);
return resolver;
}
}

WebAppInitializer.java / p>

  package org.java.springmvc.bootstrap; 

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

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

public class WebAppInitializer实现WebApplicationInitializer {

@Override
public void onStartup(final ServletContext servletContext)throws ServletException {
final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext );
root.setServletContext(servletContext);
root.scan(org.java.springmvc.bootstrap);
root.refresh();

final动态servlet = servletContext.addServlet(spring,新的DispatcherServlet(root));
servlet.setLoadOnStartup(1);
servlet.addMapping(/ views / *);
}

}

WebMvcConfigAdapter.java

  package org.java.springmvc.bootstrap; 

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableWebMvc
public class WebMvcConfigAdapter扩展WebMvcConfigurerAdapter {

// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry ){
// registry.addResourceHandler(/ js / **)。addResourceLocations(/ js /);
//}

}

WebMvcConfigSupport。 java

  package org.java.springmvc.bootstrap; 

import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

public class WebMvcConfigSupport扩展WebMvcConfigurationSupport {

protected void configureMessageConverters(List< HttpMessageConverter<?>>转换器){
converters.add(converter()) ;
addDefaultHttpMessageConverters(转换器);
}

@Bean
MappingJackson2HttpMessageConverter转换器(){
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
//在这里做你的定制...
return converter;
}
}

FilmController.java / p>

  package org.java.springmvc.controller; 

// import java.io.IOException;
// import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.java.springmvc.model.Film;
import org.java.springmvc.model.Film.FilmTurleri;
import org.springframework.stereotype.Controller;
// import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(/ film)
public class FilmController {
//
// @RequestMapping(value =filmler )
// public void filmler(final Writer writer)
// throws IOException {
// writer.append(< html>< head>< meta http-equiv = \Content-Type\content = \text / html; charset = ISO-8859-9\>< title> ... Filmler ...< / title>);
// writer.append(< script type = \text / javascript\src = \/js/touch/sencha-touch-all.js\>< /脚本>中);
// writer.append(< script type = \text / javascript\src = \/js/film/filmler.js\>< / script>) ;
// writer.append(< / head>< body>< / body>< / html>);
//
//}

@RequestMapping(value =filmleriGetir,method = RequestMethod.GET)
public @ResponseBody Map< String,List< Film> ;> FilmleriGetir(){
列表< Film> movies = new ArrayList< Film>();

//用于测试...
movies.add(new Film(0,Birinci Film,BirinciYönetmen,2015,FilmTurleri.Aksiyon));
movies.add(new Film(0,İkinciFilm,İkinciYönetmen,2015,FilmTurleri.Komedi));
movies.add(new Film(0,ÜçüncüFilm,ÜçüncüYönetmen,2015,FilmTurleri.Aile));

地图< String,List< Film>> resp = new HashMap< String,List< Film>>();
resp.put(filmListesi,电影);
返回
}

@RequestMapping(ttt)
public @ResponseBody Film getPerson(){
Film Film = new Film(0,Birinci Film, BirinciYönetmen,2015,FilmTurleri.Aksiyon);
返回电影;
}

}

HomeController.java

  package org.java.springmvc.controller; 

import java.io.IOException;
import java.io.Writer;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {

@RequestMapping(value =/)
public void home(final Writer writer)
throws IOException {
writer.append(< h2> Welcome,XML Free Spring MVC!< / h2>);
}

@RequestMapping(value =/ giris)
public void giris(final Writer writer)
throws IOException {
writer.append Giris);
}

}

Film.java

  package org.java.springmvc.model; 

public class Film {

public int Id;
public String FilmAdi,Yonetmen;
public int CikisTarihi;
public FilmTurleri Turu;

public enum FilmTurleri {
Aksiyon,Komedi,Aile,Korku,Savas;
}

public Film(){

}

public Film(int id,String title,String director,int yearOfRelease, FilmTurleri tur)
{
super();
this.Id = id;
this.FilmAdi = title;
this.Yonetmen =导演;
this.CikisTarihi = yearOfRelease;
this.Turu = tur;
}
// getter,设置方法
}

filmler.js

  Ext.application({
name:'Sencha',

launch:function(){

var touchTeam = Ext.create('Ext.DataView',{
fullscreen:true,

商店:{
fields:['name','age'],
data:[
{name:'Greg',age:100},
{name:布兰登,年龄:21},
{名称:Scott,年龄:21},
{名称:加里,年龄:24},
{名称: ,年龄:24},
{name:'Seth',age:26},
{name:'Kevin',age:26},
{name:'Israel',age :26},
{name:'Mitch',age:26}
]
},

itemTpl:'{name}是{age}岁'
});
}
});

//如果我实现运行上面的代码,我会尝试从服务器端获取数据,如下所示。

//Ext.application({
// name:'Fiddle',
//
// launch:function(){
/ /
// var store = Ext.create('Ext.data.Store',{
// autoLoad:true,
// fields:['title'],
// proxy:{
// type:'jsonp',
// url:uygulamaAdi +'/ filmleriGetir',
// reader:{
// rootProperty: 'topic',
// totalProperty:'totalCount'
//}
//}
//});
//
// Ext.create('Ext.DataView',{
// fullscreen:true,
// store:store,
// itemTpl:'{title}'
// });
//}
//});

filmler.jsp

 <%@ page language =javacontentType =text / html; charset = ISO-8859-9
pageEncoding =ISO-8859-9 %>
<!DOCTYPE html PUBLIC - // W3C // DTD HTML 4.01 Transitional // ENhttp://www.w3.org/TR/html4/loose.dtd\">
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = ISO-8859-9>
< title> Filmler< / title>
< script type =text / javascriptsrc =../../ js / touch / ayarlar.js>< / script>
< script type =text / javascriptsrc =../../ js / film / filmler.js>< / script>
< / head>
< body>
< / body>
< / html>

我的逻辑是在WebContent / jsp下调用classic jsp文件。
在jsp中有主要的js文件。
它将从MVC获取服务器端的数据。
但在第一个测试示例中,基本dataview不会显示。
Chrome控制台屏幕在下面。





<我从这些警告和错误中都没有理解?
任何帮助?



regards。

解决方案

发现原因。
它是关于元标记。
我已经改变了以下的filmler.jsp,它已经工作。

 <!DOCTYPE html> 
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8>
< meta name =viewportcontent =width = device-width,initial-scale = 1.0,maximum-scale = 1.0,minimum-scale = 1.0,user-scalable = no
< meta name =format-detectioncontent =telephone = no>
< meta name =apple-mobile-web-app-capablecontent =yes>
< meta name =apple-mobile-web-app-status-bar-stylecontent =default>
< meta name =msapplication-tap-highlightcontent =否/>
< title> Filmler< / title>
< link rel =stylesheethref =../../ js / touch / resources / css / sencha-touch.csstype =text / css>
< script type =text / javascriptsrc =../../ js / touch / ayarlar.js>< / script>
< script type =text / javascriptsrc =../../ js / film / filmler.js>< / script>
< / head>
< body>
< / body>
< / html>

也许它有助于某人。




my Project structure is below.

ControllerConfiguration.java

package org.java.springmvc.bootstrap;

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(basePackages = "org.java.springmvc.controller")
public class ControllerConfiguration {

    @Bean
    public InternalResourceViewResolver configureInternalResourceViewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        return resolver;
    }
}

WebAppInitializer.java

package org.java.springmvc.bootstrap;

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

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

public class WebAppInitializer implements WebApplicationInitializer {

    @Override
    public void onStartup(final ServletContext servletContext) throws ServletException {
        final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
        root.setServletContext(servletContext);
        root.scan("org.java.springmvc.bootstrap");
        root.refresh();

        final Dynamic servlet = servletContext.addServlet("spring", new DispatcherServlet(root));
        servlet.setLoadOnStartup(1); 
        servlet.addMapping("/views/*");
    }

}

WebMvcConfigAdapter.java

package org.java.springmvc.bootstrap;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableWebMvc
public class WebMvcConfigAdapter extends WebMvcConfigurerAdapter  {

//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/js/**").addResourceLocations("/js/");
//    }

} 

WebMvcConfigSupport.java

package org.java.springmvc.bootstrap;

import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

public class WebMvcConfigSupport extends WebMvcConfigurationSupport {

    protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.add(converter());
        addDefaultHttpMessageConverters(converters);
    }

    @Bean
    MappingJackson2HttpMessageConverter converter() {
        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
        //do your customizations here...
        return converter;
    }
}

FilmController.java

package org.java.springmvc.controller;

//import java.io.IOException;
//import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.java.springmvc.model.Film;
import org.java.springmvc.model.Film.FilmTurleri;
import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/film")
public class FilmController {
//
//  @RequestMapping(value = "filmler")
//  public void filmler(final Writer writer) 
//          throws IOException  {
//      writer.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-9\"><title>...Filmler...</title>");
//      writer.append("<script type=\"text/javascript\" src=\"/js/touch/sencha-touch-all.js\"></script>");
//      writer.append("<script type=\"text/javascript\" src=\"/js/film/filmler.js\"></script>");
//      writer.append("</head><body></body></html>");
//
//  } 

    @RequestMapping (value = "filmleriGetir", method = RequestMethod.GET)
    public @ResponseBody Map<String, List<Film>> FilmleriGetir() {
        List<Film> movies = new ArrayList<Film>();

        // For testing...
        movies.add(new Film(0, "Birinci Film", "Birinci Yönetmen", 2015, FilmTurleri.Aksiyon));
        movies.add(new Film(0, "İkinci Film", "İkinci Yönetmen", 2015, FilmTurleri.Komedi));
        movies.add(new Film(0, "Üçüncü Film", "Üçüncü Yönetmen", 2015, FilmTurleri.Aile));

        Map<String, List<Film>> resp = new HashMap<String, List<Film>>();
        resp.put("filmListesi", movies);
        return resp;
    }

    @RequestMapping("ttt")
    public @ResponseBody Film getPerson(){
        Film film = new Film(0, "Birinci Film", "Birinci Yönetmen", 2015, FilmTurleri.Aksiyon);
        return film;
    }

}

HomeController.java

package org.java.springmvc.controller;

import java.io.IOException;
import java.io.Writer;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {

    @RequestMapping(value = "/")
    public void home(final Writer writer) 
            throws IOException  {
        writer.append("<h2>Welcome, XML Free Spring MVC!</h2>");
    }

    @RequestMapping(value = "/giris")
    public void giris(final Writer writer) 
            throws IOException  {
            writer.append("Giris");
    } 

}

Film.java

package org.java.springmvc.model;

public class Film {

    public int Id;
    public String FilmAdi, Yonetmen;
    public int CikisTarihi;
    public FilmTurleri Turu;

    public enum FilmTurleri {
        Aksiyon, Komedi, Aile, Korku, Savas;
    }

    public Film(){

    }

    public Film(int id, String title, String director, int yearOfRelease, FilmTurleri tur)
    {
        super();
        this.Id = id;
        this.FilmAdi = title;
        this.Yonetmen = director;
        this.CikisTarihi = yearOfRelease;
        this.Turu = tur;
    }
    //getter, settings method
}

filmler.js

Ext.application({
    name: 'Sencha',

    launch: function() {

        var touchTeam = Ext.create('Ext.DataView', {
            fullscreen: true,

            store: {
                fields: ['name', 'age'],
                data: [
                    {name: 'Greg',  age: 100},
                    {name: 'Brandon',   age: 21},
                    {name: 'Scott',   age: 21},
                    {name: 'Gary', age: 24},
                    {name: 'Fred', age: 24},
                    {name: 'Seth',   age: 26},
                    {name: 'Kevin',   age: 26},
                    {name: 'Israel',   age: 26},
                    {name: 'Mitch', age: 26}
                ]
            },

            itemTpl: '{name} is {age} years old'
        });
    }
});

// if i achieve to run the code above, i'll try to get the data from server side like below.

//Ext.application({
//    name : 'Fiddle',
//
//    launch : function() {
//
//        var store = Ext.create('Ext.data.Store', {
//            autoLoad: true,
//            fields: ['title'],
//            proxy: {
//                type: 'jsonp',
//                url: uygulamaAdi + '/filmleriGetir',
//                reader: {
//                    rootProperty: 'topics',
//                    totalProperty: 'totalCount'
//                }
//            }            
//        });
//
//        Ext.create('Ext.DataView', {
//            fullscreen: true,
//            store: store,
//            itemTpl: '{title}'
//        });
//    }
//});

filmler.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-9"
    pageEncoding="ISO-8859-9"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<title>Filmler</title>
<script type="text/javascript" src="../../js/touch/ayarlar.js"></script>
<script type="text/javascript" src="../../js/film/filmler.js"></script>
</head>
<body>
</body>
</html>

My logic is calling classic jsp file from under WebContent/jsp. there is main js file in jsp. it will get the data from server side with MVC. but in first test example, basic dataview does not appear. Chrome console screen is below.

i understood nothing from these warning and errors? any help?

regards.

解决方案

i've found the reason. it's about meta tags. i've changed filmler.jsp like below and it has worked.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
        <meta name="format-detection" content="telephone=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="default">
        <meta name="msapplication-tap-highlight" content="no"/>
<title>Filmler</title>
        <link rel="stylesheet" href="../../js/touch/resources/css/sencha-touch.css" type="text/css">
<script type="text/javascript" src="../../js/touch/ayarlar.js"></script>
<script type="text/javascript" src="../../js/film/filmler.js"></script>
</head>
<body>
</body>
</html>

maybe it helps someone.

regards.

这篇关于sencha touch 2键“minimum-ui”不被承认和忽视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆