reactjs+springboot修改表格报错:PUT http://localhost:3000/xxx 405 (Method Not Allowed)

用MyBatis update方法修改数据,页面报错:
PUT http://localhost:3000/xxx 405 (Method Not Allowed)
SpringBoot后台报错:
WARN 12144 --- [nio-8080-exec-5] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported]

下面是代码:

 class StaffEdit extends Component {

  emptyItem = {
    name: '',
    address: '',
    city: '',
    stateOrProvince: '',
    country: '',
    postalCode: ''
  };

  constructor(props) {
    super(props);
    this.state = {
      item: this.emptyItem
    };
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  async componentDidMount() {
    if (this.props.match.params.id !== 'new') {
      const staffAO = await (await fetch(`/api/staff/${this.props.match.params.id}`)).json();
      this.setState({item: staffAO});
    }
  }

  handleChange(event) {
    const target = event.target;
    const value = target.value;
    const name = target.name;
    let item = {...this.state.item};
    item[name] = value;
    this.setState({item});
  }

  async handleSubmit(event) {
    event.preventDefault();
    const {item} = this.state;

    await fetch('/api/staff', {
      method: (item.id) ? 'PUT' : 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(item),
    });
    this.props.history.push('/staffs');
  }

  render() {
    const {item} = this.state;
    const title = <h2>{item.id ? 'Edit Staff' : 'Add Staff'}</h2>;

    return <div>
      <AppNavbar/>
      <Container>
        {title}
        <Form onSubmit={this.handleSubmit}>
          <FormGroup>
            <Label for="name">Name</Label>
            <Input type="text" name="name" id="name" value={item.name || ''}
                   onChange={this.handleChange} autoComplete="name"/>
          </FormGroup>
          <FormGroup>
            <Label for="department">Department</Label>
            <Input type="text" name="department" id="department" value={item.department || ''}
                   onChange={this.handleChange} autoComplete="Chemistry"/>
          </FormGroup>
          <FormGroup>
            <Label for="position">Position</Label>
            <Input type="text" name="position" id="position" value={item.position || ''}
                   onChange={this.handleChange} autoComplete="unknown"/>
          </FormGroup>
          <div className="row">
            <FormGroup className="col-md-4 mb-3">
              <Label for="permission">Permission</Label>
              <Input type="text" name="permission" id="permission" value={item.permission || ''}
                     onChange={this.handleChange} autoComplete="all"/>
            </FormGroup>
          </div>
          <FormGroup>
            <Button color="primary" type="submit">Save</Button>{' '}
            <Button color="secondary" tag={Link} to="/staffs">Cancel</Button>
          </FormGroup>
        </Form>
      </Container>
    </div>
  }
}

export default withRouter(StaffEdit);

 public class StaffManagementController {
    private StaffManagementFunction function;
    private final org.slf4j.Logger log = LoggerFactory.getLogger(StaffManagementController.class);

    public StaffManagementController(StaffManagementFunction function) {
        this.function = function;
    }

    @PutMapping("/staff/{id}")
    ResponseEntity<StaffManagement> editStaff(@PathVariable Long id, @Valid @RequestBody StaffManagementArgumentObject staffAO) throws Exception {
        staffAO.setId(id);
        log.info("Request to update staff: {}", staffAO);
        StaffManagement result = function.updateStaff(staffAO);
        return ResponseEntity.ok().body(result);
    }

Controller测试过可以修改数据库,但是用页面调用就报错,新手请高手指教!谢谢了!

1个回答

应该是你的submit方法里面使用了put传参,但是url的id没有整进去,没找到正确的接口吧

wzhuwzhu
wzhuwzhu 多谢指教!fetch里的url改成(item.id)?'/api/staff/'+(item.id):'/api/staff',可以update了。谢谢了!!
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
reactjs+springboot修改表格报错:PUT http://localhost:3000/xxx 405 (Method Not Allowed)
用MyBatis update方法修改数据,页面报错: PUT http://localhost:3000/xxx 405 (Method Not Allowed) SpringBoot后台报错: WARN 12144 --- [nio-8080-exec-5] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported] 下面是代码: ``` class StaffEdit extends Component { emptyItem = { name: '', address: '', city: '', stateOrProvince: '', country: '', postalCode: '' }; constructor(props) { super(props); this.state = { item: this.emptyItem }; this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } async componentDidMount() { if (this.props.match.params.id !== 'new') { const staffAO = await (await fetch(`/api/staff/${this.props.match.params.id}`)).json(); this.setState({item: staffAO}); } } handleChange(event) { const target = event.target; const value = target.value; const name = target.name; let item = {...this.state.item}; item[name] = value; this.setState({item}); } async handleSubmit(event) { event.preventDefault(); const {item} = this.state; await fetch('/api/staff', { method: (item.id) ? 'PUT' : 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify(item), }); this.props.history.push('/staffs'); } render() { const {item} = this.state; const title = <h2>{item.id ? 'Edit Staff' : 'Add Staff'}</h2>; return <div> <AppNavbar/> <Container> {title} <Form onSubmit={this.handleSubmit}> <FormGroup> <Label for="name">Name</Label> <Input type="text" name="name" id="name" value={item.name || ''} onChange={this.handleChange} autoComplete="name"/> </FormGroup> <FormGroup> <Label for="department">Department</Label> <Input type="text" name="department" id="department" value={item.department || ''} onChange={this.handleChange} autoComplete="Chemistry"/> </FormGroup> <FormGroup> <Label for="position">Position</Label> <Input type="text" name="position" id="position" value={item.position || ''} onChange={this.handleChange} autoComplete="unknown"/> </FormGroup> <div className="row"> <FormGroup className="col-md-4 mb-3"> <Label for="permission">Permission</Label> <Input type="text" name="permission" id="permission" value={item.permission || ''} onChange={this.handleChange} autoComplete="all"/> </FormGroup> </div> <FormGroup> <Button color="primary" type="submit">Save</Button>{' '} <Button color="secondary" tag={Link} to="/staffs">Cancel</Button> </FormGroup> </Form> </Container> </div> } } export default withRouter(StaffEdit); ``` ``` public class StaffManagementController { private StaffManagementFunction function; private final org.slf4j.Logger log = LoggerFactory.getLogger(StaffManagementController.class); public StaffManagementController(StaffManagementFunction function) { this.function = function; } @PutMapping("/staff/{id}") ResponseEntity<StaffManagement> editStaff(@PathVariable Long id, @Valid @RequestBody StaffManagementArgumentObject staffAO) throws Exception { staffAO.setId(id); log.info("Request to update staff: {}", staffAO); StaffManagement result = function.updateStaff(staffAO); return ResponseEntity.ok().body(result); } ``` Controller测试过可以修改数据库,但是用页面调用就报错,新手请高手指教!谢谢了!
SpringBoot中,定时任务:httpclient调用WebService。
Springboot框架中,httpClient调用WebService类中的main方法,怎么改为项目启动,就自动执行这个方法? @Sch@Scheduled(cron = "*/10 * * * * ?"): public static void main(String[] args) throws Exception { // TODO Auto-generated method stub DynamicHttpclientCall dynamicHttpclientCall = new DynamicHttpclientCall( "http://service.example.com/", "getUser", "http://localhost:8080/webservice/userService?wsdl"); Map<String, String> patameterMap = new HashMap<String, String>(); patameterMap.put("id", "1"); String soapRequestData = dynamicHttpclientCall.buildRequestData(patameterMap); System.out.println(soapRequestData); int statusCode = dynamicHttpclientCall.invoke(patameterMap); String returnJson = ""; if(statusCode == 200) { System.out.println("调用成功!"); System.out.println(dynamicHttpclientCall.soapResponseData); } else { System.out.println("调用失败!错误码:" + statusCode); } }
有关jasperreports报错的问题java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException
有关jasperreport开发的问题,单元测试的时候,已经通过,可以生成没有数据的pdf文件,但是整合到项目中的时候,却会报错 java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException 下面是相关的代码 ``` public class ATestJasperReport2 { public ATestJasperReport2() { } public static void testReport(){ File jasperFileName = new File("f://Report/remoteReason.jasper"); HashMap<String, Object> params = new HashMap<String, Object>();// 建立参数表 params.put("reason_id", "原因编码"); // 设置参数值 - 暂时没用上 try { JasperPrint jasperPrint = JasperFillManager.fillReport(jasperFileName.getPath(), params , new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile(jasperPrint, "f://Report/test1.pdf"); } catch (JRException e) { System.out.println("异常"); e.printStackTrace(); } } public static void main(String arg[]){ testReport(); } } ``` 下面是引用的jar包 ![图片说明](https://img-ask.csdn.net/upload/201902/19/1550565428_239323.png) 开发环境是 eclipse-INDIGO java build path ![图片说明](https://img-ask.csdn.net/upload/201902/19/1550566273_862769.png) 实在是搞不懂到底怎么回事,求大牛帮忙
Jersey上传图片报错,409错误
com.sun.jersey.api.client.UniformInterfaceException: PUT http://localhost:8081/ecps-file/image/20160224100959304331.jpg returned a response status of 409 ![图片说明](https://img-ask.csdn.net/upload/201602/24/1456280413_789713.jpg)
有关jasperreports的问题 java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException
有关jasperreport开发的问题,单元测试的时候,已经通过,可以生成没有数据源的pdf文件,但是整合到项目中的时候,却会报错 java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException 下面是相关的代码 ``` public class ATestJasperReport2 { public ATestJasperReport2() { } public void testReport(){ File jasperFileName = new File("f://Report/remoteReason.jasper"); HashMap<String, Object> params = new HashMap<String, Object>();// 建立参数表 params.put("reason_id", "原因编码"); // 设置参数值 - 暂时没用上 try { JasperPrint jasperPrint = JasperFillManager.fillReport(jasperFileName.getPath(), params , new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile(jasperPrint, "f://Report/test1.pdf"); } catch (JRException e) { System.out.println("异常"); e.printStackTrace(); } } public static void main(String arg[]){ File jasperFileName = new File("f://Report/remoteReason.jasper"); HashMap<String, Object> params = new HashMap<String, Object>();// 建立参数表 params.put("reason_id", "原因编码"); // 设置参数值 - 暂时没用上 try { JasperPrint jasperPrint = JasperFillManager.fillReport(jasperFileName.getPath(), params , new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile(jasperPrint, "f://Report/test1.pdf"); } catch (JRException e) { System.out.println("异常"); e.printStackTrace(); } } ``` 下面是引用的jar包 ![图片说明](https://img-ask.csdn.net/upload/201902/19/1550565146_571243.png) 开发环境是 eclipse-INDIGO 实在是搞不懂到底怎么回事
springBoot整合mybatis时的错,求助!
项目结构![图片说明](https://img-ask.csdn.net/upload/201903/15/1552617152_885756.png) yml配置 ``` spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/zmz username: root password: root mybatis: typeAliasesPackage: Beans mapperLocations: classpath:mappers/*.xml logging: level: mapper: debug ``` 报错信息 ``` java.lang.IllegalStateException: Could not evaluate condition on com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure#dataSource due to org/springframework/boot/web/servlet/ServletRegistrationBean not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake) at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:333) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at start.Start.main(Start.java:12) [classes/:na] Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/web/servlet/ServletRegistrationBean at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_144] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_144] at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_144] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:609) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:521) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:507) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:567) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:683) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:627) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1445) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:975) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry$OptimizedBeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:289) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry$OptimizedBeanTypeRegistry.addBeanType(BeanTypeRegistry.java:278) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry$OptimizedBeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:259) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:182) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:171) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:139) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:113) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] ... 17 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.servlet.ServletRegistrationBean at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144] ... 37 common frames omitted 2019-03-15 10:27:17.852 INFO 3600 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/resources.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/rt.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/jsse.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/jce.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/charsets.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/jfr.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/access-bridge-64.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/cldrdata.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/dnsns.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/jaccess.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/jfxrt.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/localedata.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/nashorn.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/sunec.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/sunjce_provider.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/sunmscapi.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/sunpkcs11.jar, file:/C:/Program%20Files/Java/jdk1.8.0_144/jre/lib/ext/zipfs.jar, file:/D:/software/workspace/spb/target/classes/, file:/D:/software/repo/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-starter-web/1.3.3.RELEASE/spring-boot-starter-web-1.3.3.RELEASE.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-starter/1.3.3.RELEASE/spring-boot-starter-1.3.3.RELEASE.jar, file:/D:/software/repo/org/springframework/boot/spring-boot/1.3.3.RELEASE/spring-boot-1.3.3.RELEASE.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-starter-logging/1.3.3.RELEASE/spring-boot-starter-logging-1.3.3.RELEASE.jar, file:/D:/software/repo/ch/qos/logback/logback-classic/1.1.5/logback-classic-1.1.5.jar, file:/D:/software/repo/ch/qos/logback/logback-core/1.1.5/logback-core-1.1.5.jar, file:/D:/software/repo/org/slf4j/slf4j-api/1.7.16/slf4j-api-1.7.16.jar, file:/D:/software/repo/org/slf4j/jcl-over-slf4j/1.7.16/jcl-over-slf4j-1.7.16.jar, file:/D:/software/repo/org/slf4j/jul-to-slf4j/1.7.16/jul-to-slf4j-1.7.16.jar, file:/D:/software/repo/org/slf4j/log4j-over-slf4j/1.7.16/log4j-over-slf4j-1.7.16.jar, file:/D:/software/repo/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar, file:/D:/software/repo/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-starter-tomcat/1.3.3.RELEASE/spring-boot-starter-tomcat-1.3.3.RELEASE.jar, file:/D:/software/repo/org/apache/tomcat/embed/tomcat-embed-core/8.0.32/tomcat-embed-core-8.0.32.jar, file:/D:/software/repo/org/apache/tomcat/embed/tomcat-embed-el/8.0.32/tomcat-embed-el-8.0.32.jar, file:/D:/software/repo/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.32/tomcat-embed-logging-juli-8.0.32.jar, file:/D:/software/repo/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.32/tomcat-embed-websocket-8.0.32.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-starter-validation/1.3.3.RELEASE/spring-boot-starter-validation-1.3.3.RELEASE.jar, file:/D:/software/repo/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar, file:/D:/software/repo/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/D:/software/repo/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar, file:/D:/software/repo/com/fasterxml/classmate/1.1.0/classmate-1.1.0.jar, file:/D:/software/repo/com/fasterxml/jackson/core/jackson-databind/2.6.5/jackson-databind-2.6.5.jar, file:/D:/software/repo/com/fasterxml/jackson/core/jackson-annotations/2.6.5/jackson-annotations-2.6.5.jar, file:/D:/software/repo/com/fasterxml/jackson/core/jackson-core/2.6.5/jackson-core-2.6.5.jar, file:/D:/software/repo/org/springframework/spring-web/4.2.5.RELEASE/spring-web-4.2.5.RELEASE.jar, file:/D:/software/repo/org/springframework/spring-aop/4.2.5.RELEASE/spring-aop-4.2.5.RELEASE.jar, file:/D:/software/repo/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/D:/software/repo/org/springframework/spring-beans/4.2.5.RELEASE/spring-beans-4.2.5.RELEASE.jar, file:/D:/software/repo/org/springframework/spring-context/4.2.5.RELEASE/spring-context-4.2.5.RELEASE.jar, file:/D:/software/repo/org/springframework/spring-webmvc/4.2.5.RELEASE/spring-webmvc-4.2.5.RELEASE.jar, file:/D:/software/repo/org/springframework/spring-expression/4.2.5.RELEASE/spring-expression-4.2.5.RELEASE.jar, file:/D:/software/repo/org/mybatis/spring/boot/mybatis-spring-boot-starter/1.3.0/mybatis-spring-boot-starter-1.3.0.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-starter-jdbc/1.3.3.RELEASE/spring-boot-starter-jdbc-1.3.3.RELEASE.jar, file:/D:/software/repo/org/apache/tomcat/tomcat-jdbc/8.0.32/tomcat-jdbc-8.0.32.jar, file:/D:/software/repo/org/apache/tomcat/tomcat-juli/8.0.32/tomcat-juli-8.0.32.jar, file:/D:/software/repo/org/springframework/spring-jdbc/4.2.5.RELEASE/spring-jdbc-4.2.5.RELEASE.jar, file:/D:/software/repo/org/springframework/spring-tx/4.2.5.RELEASE/spring-tx-4.2.5.RELEASE.jar, file:/D:/software/repo/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/1.3.0/mybatis-spring-boot-autoconfigure-1.3.0.jar, file:/D:/software/repo/org/mybatis/mybatis/3.4.4/mybatis-3.4.4.jar, file:/D:/software/repo/org/mybatis/mybatis-spring/1.3.1/mybatis-spring-1.3.1.jar, file:/D:/software/repo/com/alibaba/druid-spring-boot-starter/1.1.0/druid-spring-boot-starter-1.1.0.jar, file:/D:/software/repo/com/alibaba/druid/1.1.0/druid-1.1.0.jar, file:/D:/software/repo/org/springframework/boot/spring-boot-autoconfigure/1.3.3.RELEASE/spring-boot-autoconfigure-1.3.3.RELEASE.jar] ```
为什么我用freemarker导出word文档,导出的里面全是ftl文字内容,而不是正确的格式呢?找了好久了都没找出来问题。。。
java代码: ``` import freemarker.template.Configuration; import freemarker.template.DefaultObjectWrapper; import freemarker.template.Template; import freemarker.template.TemplateExceptionHandler; import lombok.extern.slf4j.Slf4j; import sun.misc.BASE64Encoder; import java.io.*; import java.util.*; @Slf4j public class WordReporter { private static final String ENCODING = "UTF-8"; private static Configuration cfg = new Configuration(); //初始化cfg static { //设置模板所在文件夹 try { cfg.setDirectoryForTemplateLoading(new File("D:/")); } catch (IOException e) { e.printStackTrace(); } // setEncoding这个方法一定要设置国家及其编码,不然在ftl中的中文在生成html后会变成乱码 cfg.setEncoding(Locale.getDefault(), ENCODING); // 设置对象的包装器 cfg.setObjectWrapper(new DefaultObjectWrapper()); // 设置异常处理器,这样的话就可以${a.b.c.d}即使没有属性也不会出错 cfg.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER); } //获取模板对象 public static Template getTemplate(String templateFileName) throws IOException { return cfg.getTemplate(templateFileName, ENCODING); } /** * 据数据及模板生成文件 * @param data Map的数据结果集 * @param templateFileName ftl模版文件名 * @param outFilePath 生成文件名称(可带路径) */ public static File crateFile(Map<String, Object> data, String templateFileName, String outFilePath) { Writer out = null; File outFile = new File(outFilePath); try { // 获取模板,并设置编码方式,这个编码必须要与页面中的编码格式一致 Template template = getTemplate(templateFileName); if (!outFile.getParentFile().exists()) { outFile.getParentFile().mkdirs(); } out = new OutputStreamWriter(new FileOutputStream(outFile), ENCODING); // 处理模版 template.process(data, out); out.flush(); log.info("由模板文件" + templateFileName + "生成" + outFilePath + "成功."); } catch (Exception e) { log.error("由模板文件" + templateFileName + "生成" + outFilePath + "出错"); e.printStackTrace(); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { log.error("关闭Write对象出错", e); e.printStackTrace(); } } return outFile; } public static void main(String[] args) { try { Map<String, Object> data = new HashMap<String, Object>(); List<Map<String, String>> newsList = new ArrayList<Map<String, String>>(); for(int i=1;i<=5;i++){ Map<String, String> map=new HashMap<String, String>(); map.put("stName", "字段姓名"+i); newsList.add(map); } data.put("list",newsList); crateFile(data, "a.ftl", "D:/aaa.docx"); } catch (Exception e) { e.printStackTrace(); } } } ``` ftl文件内容: ``` <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:wpsCustomData="http://www.wps.cn/officeDocument/2013/wpsCustomData" mc:Ignorable="w14 w15 wp14"> <w:body> <#list list as data> <w:tbl> <w:tblPr> <w:tblStyle w:val="4"/> <w:tblW w:w="0" w:type="auto"/> <w:tblInd w:w="0" w:type="dxa"/> <w:tblBorders> <w:top w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:left w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:bottom w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:right w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:insideH w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:insideV w:val="single" w:color="auto" w:sz="4" w:space="0"/> </w:tblBorders> <w:tblLayout w:type="autofit"/> <w:tblCellMar> <w:left w:w="108" w:type="dxa"/> <w:right w:w="108" w:type="dxa"/> </w:tblCellMar> </w:tblPr> <w:tblGrid> <w:gridCol w:w="2840"/> <w:gridCol w:w="2841"/> <w:gridCol w:w="2841"/> </w:tblGrid> <w:tr> <w:tblPrEx> <w:tblBorders> <w:top w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:left w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:bottom w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:right w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:insideH w:val="single" w:color="auto" w:sz="4" w:space="0"/> <w:insideV w:val="single" w:color="auto" w:sz="4" w:space="0"/> </w:tblBorders> <w:tblCellMar> <w:left w:w="108" w:type="dxa"/> <w:right w:w="108" w:type="dxa"/> </w:tblCellMar> </w:tblPrEx> <w:tc> <w:tcPr> <w:tcW w:w="2840" w:type="dxa"/> </w:tcPr> <w:p> <w:pPr> <w:rPr> <w:rFonts w:hint="eastAsia" w:eastAsiaTheme="minorEastAsia"/> <w:vertAlign w:val="baseline"/> <w:lang w:val="en-US" w:eastAsia="zh-CN"/> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:rFonts w:hint="eastAsia"/> <w:vertAlign w:val="baseline"/> <w:lang w:val="en-US" w:eastAsia="zh-CN"/> </w:rPr> <w:t>1</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w="2841" w:type="dxa"/> </w:tcPr> <w:p> <w:pPr> <w:rPr> <w:rFonts w:hint="eastAsia" w:eastAsiaTheme="minorEastAsia"/> <w:vertAlign w:val="baseline"/> <w:lang w:val="en-US" w:eastAsia="zh-CN"/> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:rFonts w:hint="eastAsia"/> <w:vertAlign w:val="baseline"/> <w:lang w:val="en-US" w:eastAsia="zh-CN"/> </w:rPr> <w:t>1</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w="2841" w:type="dxa"/> </w:tcPr> <w:p> <w:pPr> <w:rPr> <w:rFonts w:hint="default" w:eastAsiaTheme="minorEastAsia"/> <w:vertAlign w:val="baseline"/> <w:lang w:val="en-US" w:eastAsia="zh-CN"/> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:rFonts w:hint="eastAsia"/> <w:vertAlign w:val="baseline"/> <w:lang w:val="en-US" w:eastAsia="zh-CN"/> </w:rPr> <w:t>${data.stName}</w:t> </w:r> </w:p> </w:tc> </w:tr> </w:tbl> </#list> <w:p> <w:bookmarkStart w:id="0" w:name="_GoBack"/> <w:bookmarkEnd w:id="0"/> </w:p> <w:sectPr> <w:pgSz w:w="11906" w:h="16838"/> <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="851" w:footer="992" w:gutter="0"/> <w:cols w:space="425" w:num="1"/> <w:docGrid w:type="lines" w:linePitch="312" w:charSpace="0"/> </w:sectPr> </w:body> </w:document> ``` ![图片说明](https://img-ask.csdn.net/upload/201912/11/1576078986_743908.png) 导出的文件里面全是ftl文件里的文字内容
android中sqlite一直报错
在应用中用到sqlite,创建了一些表,代码如下: db.execSQL("CREATE TABLE IF NOT EXISTS " + GAMES_HISTORY_TABLE+ " (" + GAME_KEY + " INTEGER PRIMARY KEY AUTOINCREMENT, " + RIGHT_DRILLS + "INTEGER NOT NULL, " + NUM_OF_DRILLS + "INTEGER NOT NULL, " + GAME_DATE + "DATE);" ); 添加记录的代码: public long addScore(int totalDrills, int numberOfRightDrills) { ContentValues cv = new ContentValues(); cv.put(RIGHT_DRILLS, numberOfRightDrills); cv.put(NUM_OF_DRILLS, totalDrills); Date date = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); cv.put(GAME_DATE, dateFormat.format(date)); return dataBase.insert(GAMES_HISTORY_TABLE, null, cv); } 常变量的声明如下: private static final String GAMES_HISTORY_TABLE = "scoers"; private static final String GAME_KEY = "game_id"; private static final String RIGHT_DRILLS = "number_of_rihgt_drill"; private static final String NUM_OF_DRILLS = "total_drill"; private static final String GAME_DATE = "game_date"; 然后在logcat中获得下面异常: 01-13 20:13:45.485: D/szipinf(658): Initializing inflate state 01-13 20:13:47.375: D/szipinf(658): Initializing inflate state 01-13 20:13:47.485: I/Database(658): sqlite returned: error code = 1, msg = table scoers has no column named game_date 01-13 20:13:47.495: E/Database(658): Error inserting game_date=13-01-2013 20:13:47 total_drill=4 number_of_rihgt_drill=0 01-13 20:13:47.495: E/Database(658): android.database.sqlite.SQLiteException: table scoers has no column named game_date: , while compiling: INSERT INTO scoers(game_date, total_drill, number_of_rihgt_drill) VALUES(?, ?, ?); 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:41) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1149) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1569) 01-13 20:13:47.495: E/Database(658): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1426) 01-13 20:13:47.495: E/Database(658): at com.simplemathgame.GameDB.addScore(GameDB.java:83) 01-13 20:13:47.495: E/Database(658): at com.simplemathgame.Results.onCreate(Results.java:99) 01-13 20:13:47.495: E/Database(658): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 01-13 20:13:47.495: E/Database(658): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 01-13 20:13:47.495: E/Database(658): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 01-13 20:13:47.495: E/Database(658): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 01-13 20:13:47.495: E/Database(658): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 01-13 20:13:47.495: E/Database(658): at android.os.Handler.dispatchMessage(Handler.java:99) 01-13 20:13:47.495: E/Database(658): at android.os.Looper.loop(Looper.java:123) 01-13 20:13:47.495: E/Database(658): at android.app.ActivityThread.main(ActivityThread.java:3683) 01-13 20:13:47.495: E/Database(658): at java.lang.reflect.Method.invokeNative(Native Method) 01-13 20:13:47.495: E/Database(658): at java.lang.reflect.Method.invoke(Method.java:507) 01-13 20:13:47.495: E/Database(658): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 01-13 20:13:47.495: E/Database(658): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 01-13 20:13:47.495: E/Database(658): at dalvik.system.NativeStart.main(Native Method) 01-13 20:13:47.495: I/Database(658): sqlite returned: error code = 1, msg = no such column: sent 01-13 20:13:47.495: W/System.err(658): android.database.sqlite.SQLiteException: no such column: sent: , while compiling: SELECT sent FROM feedback 01-13 20:13:47.495: W/System.err(658): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189) 01-13 20:13:47.506: W/System.err(658): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1271) 01-13 20:13:47.506: W/System.err(658): at com.simplemathgame.GameDB.isFeedbackGiven(GameDB.java:117) 01-13 20:13:47.506: W/System.err(658): at com.simplemathgame.Results.onCreate(Results.java:100) 01-13 20:13:47.506: W/System.err(658): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 01-13 20:13:47.506: W/System.err(658): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 01-13 20:13:47.506: W/System.err(658): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 01-13 20:13:47.506: W/System.err(658): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 01-13 20:13:47.515: W/System.err(658): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 01-13 20:13:47.515: W/System.err(658): at android.os.Handler.dispatchMessage(Handler.java:99) 01-13 20:13:47.515: W/System.err(658): at android.os.Looper.loop(Looper.java:123) 01-13 20:13:47.515: W/System.err(658): at android.app.ActivityThread.main(ActivityThread.java:3683) 01-13 20:13:47.515: W/System.err(658): at java.lang.reflect.Method.invokeNative(Native Method) 01-13 20:13:47.515: W/System.err(658): at java.lang.reflect.Method.invoke(Method.java:507) 01-13 20:13:47.515: W/System.err(658): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 01-13 20:13:47.515: W/System.err(658): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 01-13 20:13:47.515: W/System.err(658): at dalvik.system.NativeStart.main(Native Method) 01-13 20:13:47.525: W/db(658): problem
angularjs访问webapi总是出现 not allowed access
最近在学习angularjs,尝试通过调用webapi的时候,直接 $http({ method: "get", url: "http://localhost:301/api/basic/get", dataType: 'JSONP' }).success(function (resultdata) { return resultdata ; }).error(function (error) { }); 这样子调用,是没有问题的。 一旦尝试增加一个header的设置,就会出现错误。如下所示: $http({ method: "get", url: "http://localhost:301/api/basic/get", dataType: 'JSONP' ,headers:{'Authorization':'Basic dHp5OjEyMw=='} }).success(function (resultdata) { return resultdata ; }).error(function (error) { }); 出现的错误信息是: XMLHttpRequest cannot load http://localhost:301/api/basic/get. The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:400, *', but only one is allowed. Origin 'http://localhost:400' is therefore not allowed access. 我的web.config中的设置,已经增加了 <add name="Access-Control-Allow-Origin" value="*" /> <add name="Access-Control-Allow-Headers" value="Content-Type" /> <add name="Access-Control-Request-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /> 这究竟是啥情况? 有没有人碰到过? 求解答
安卓,新建simpleAdapter报错,求大神看看
在girdview中添加simpleAdapter,为什么新建SimpleAdapter的时候会报错? 我的代码如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" android:orientation="vertical"> <GridView android:id="@+id/gridview" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".activity" android:orientation="vertical"> <ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> package com.example.test4; import android.os.Bundle; import android.widget.*; import java.util.*; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { SimpleAdapter s=null; GridView grid=null; List<Map<String,Integer>> list=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); grid=(GridView)super.findViewById(R.id.gridview); initAdapter(); grid.setAdapter(s); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void initAdapter() { Map<String,Integer> map=new HashMap<String,Integer>(); map.put("图片", R.drawable.a1); list.add(map); map.put("图片", R.drawable.a2); list.add(map); map.put("图片", R.drawable.a1); list.add(map); s=new SimpleAdapter(MainActivity.this,list,R.layout.imageview,new String[]{"图片"},new Integer[]{R.id.image}); } } 其中,s=new SimpleAdapter.....那行被报错,我截张图: ![图片说明](https://img-ask.csdn.net/upload/201511/17/1447764297_753602.png) 应该就是说构造方法没这样的重载,明明就应该没错的吧,请问这里是怎么回事?应该怎么解决?
用freemarker生成word文档,文档打开报错,求高手`
我用freemarker生成word文档,文档打开报错,用UE打开文档后发现文档没有写完,如下: <w:t>文件测试</w:t> </w:r> </w:p> <w:p wsp:rsidR="00BA541E" wsp:rsidRDefault="00BA541E"/> <w:tbl> <w:tblPr> <w:tblW w:w="0" w:type="auto"/> <w:tblBorders> <w:top w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:left w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:bottom w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color=" 写到color那就没了,为什么? 这个是java代码: [code="java"]package com.feifei.test; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import freemarker.template.Configuration; import freemarker.template.ObjectWrapper; import freemarker.template.Template; import freemarker.template.TemplateException; public class CreateWordDemo { private Configuration configuration = null; public CreateWordDemo() { configuration = new Configuration(); configuration.setDefaultEncoding("utf-8"); } public void createDoc() { //要填入模本的数据文件 Map dataMap=new HashMap(); getData(dataMap); //设置模本装置方法和路径,FreeMarker支持多种模板装载方法。可以重servlet,classpath,数据库装载, //这里我们的模板是放在com.havenliu.document.template包下面 configuration.setClassForTemplateLoading(this.getClass(), "/com/feifei/test/template"); Template t=null; try { //test.ftl为要装载的模板 t = configuration.getTemplate("test.ftl"); } catch (IOException e) { e.printStackTrace(); } //输出文档路径及名称 File outFile = new File("D:/tmp/outFile.doc"); Writer out = null; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8")); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { t.process(dataMap,out,ObjectWrapper.BEANS_WRAPPER); } catch (TemplateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } /** * 注意dataMap里存放的数据Key值要与模板中的参数相对应 * @param dataMap */ private void getData(Map dataMap) { dataMap.put("remark", "这是测试备注信息"); List table=new ArrayList(); PersonEntity p1 = new PersonEntity(); p1.setName("yaofeihu"); p1.setXingzuo("tianxie"); table.add(p1); dataMap.put("table", table); } public static void main(String[] args) { CreateWordDemo c = new CreateWordDemo(); c.createDoc(); } } [/code] 下面这个是模板文件 [code="java"]<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?mso-application progid="Word.Document"?> <w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve"> <w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"/> <o:DocumentProperties> <o:Author>feihu yao</o:Author> <o:LastAuthor>feihu yao</o:LastAuthor> <o:Revision>2</o:Revision> <o:TotalTime>1</o:TotalTime> <o:Created>2014-10-22T14:55:00Z</o:Created> <o:LastSaved>2014-10-22T14:55:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>8</o:Words> <o:Characters>46</o:Characters> <o:Company>Hewlett-Packard Company</o:Company> <o:Lines>1</o:Lines> <o:Paragraphs>1</o:Paragraphs> <o:CharactersWithSpaces>53</o:CharactersWithSpaces> <o:Version>12</o:Version> </o:DocumentProperties> <w:fonts> <w:defaultFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> <w:font w:name="Times New Roman"> <w:panose-1 w:val="02020603050405020304"/> <w:charset w:val="00"/> <w:family w:val="Roman"/> <w:pitch w:val="variable"/> <w:sig w:usb-0="E0002EFF" w:usb-1="C0007843" w:usb-2="00000009" w:usb-3="00000000" w:csb-0="000001FF" w:csb-1="00000000"/> </w:font> <w:font w:name="宋体"> <w:altName w:val="SimSun"/> <w:panose-1 w:val="02010600030101010101"/> <w:charset w:val="86"/> <w:family w:val="auto"/> <w:pitch w:val="variable"/> <w:sig w:usb-0="00000003" w:usb-1="288F0000" w:usb-2="00000016" w:usb-3="00000000" w:csb-0="00040001" w:csb-1="00000000"/> </w:font> <w:font w:name="Cambria Math"> <w:panose-1 w:val="02040503050406030204"/> <w:charset w:val="01"/> <w:family w:val="Roman"/> <w:notTrueType/> <w:pitch w:val="variable"/> <w:sig w:usb-0="00000000" w:usb-1="00000000" w:usb-2="00000000" w:usb-3="00000000" w:csb-0="00000000" w:csb-1="00000000"/> </w:font> <w:font w:name="Calibri"> <w:panose-1 w:val="020F0502020204030204"/> <w:charset w:val="00"/> <w:family w:val="Swiss"/> <w:pitch w:val="variable"/> <w:sig w:usb-0="E00002FF" w:usb-1="4000ACFF" w:usb-2="00000001" w:usb-3="00000000" w:csb-0="0000019F" w:csb-1="00000000"/> </w:font> <w:font w:name="@宋体"> <w:panose-1 w:val="02010600030101010101"/> <w:charset w:val="86"/> <w:family w:val="auto"/> <w:pitch w:val="variable"/> <w:sig w:usb-0="00000003" w:usb-1="288F0000" w:usb-2="00000016" w:usb-3="00000000" w:csb-0="00040001" w:csb-1="00000000"/> </w:font> </w:fonts> <w:styles> <w:versionOfBuiltInStylenames w:val="7"/> <w:latentStyles w:defLockedState="off" w:latentStyleCount="267"> <w:lsdException w:name="Normal"/> <w:lsdException w:name="heading 1"/> <w:lsdException w:name="heading 2"/> <w:lsdException w:name="heading 3"/> <w:lsdException w:name="heading 4"/> <w:lsdException w:name="heading 5"/> <w:lsdException w:name="heading 6"/> <w:lsdException w:name="heading 7"/> <w:lsdException w:name="heading 8"/> <w:lsdException w:name="heading 9"/> <w:lsdException w:name="toc 1"/> <w:lsdException w:name="toc 2"/> <w:lsdException w:name="toc 3"/> <w:lsdException w:name="toc 4"/> <w:lsdException w:name="toc 5"/> <w:lsdException w:name="toc 6"/> <w:lsdException w:name="toc 7"/> <w:lsdException w:name="toc 8"/> <w:lsdException w:name="toc 9"/> <w:lsdException w:name="caption"/> <w:lsdException w:name="Title"/> <w:lsdException w:name="Default Paragraph Font"/> <w:lsdException w:name="Subtitle"/> <w:lsdException w:name="Strong"/> <w:lsdException w:name="Emphasis"/> <w:lsdException w:name="Table Grid"/> <w:lsdException w:name="Placeholder Text"/> <w:lsdException w:name="No Spacing"/> <w:lsdException w:name="Light Shading"/> <w:lsdException w:name="Light List"/> <w:lsdException w:name="Light Grid"/> <w:lsdException w:name="Medium Shading 1"/> <w:lsdException w:name="Medium Shading 2"/> <w:lsdException w:name="Medium List 1"/> <w:lsdException w:name="Medium List 2"/> <w:lsdException w:name="Medium Grid 1"/> <w:lsdException w:name="Medium Grid 2"/> <w:lsdException w:name="Medium Grid 3"/> <w:lsdException w:name="Dark List"/> <w:lsdException w:name="Colorful Shading"/> <w:lsdException w:name="Colorful List"/> <w:lsdException w:name="Colorful Grid"/> <w:lsdException w:name="Light Shading Accent 1"/> <w:lsdException w:name="Light List Accent 1"/> <w:lsdException w:name="Light Grid Accent 1"/> <w:lsdException w:name="Medium Shading 1 Accent 1"/> <w:lsdException w:name="Medium Shading 2 Accent 1"/> <w:lsdException w:name="Medium List 1 Accent 1"/> <w:lsdException w:name="Revision"/> <w:lsdException w:name="List Paragraph"/> <w:lsdException w:name="Quote"/> <w:lsdException w:name="Intense Quote"/> <w:lsdException w:name="Medium List 2 Accent 1"/> <w:lsdException w:name="Medium Grid 1 Accent 1"/> <w:lsdException w:name="Medium Grid 2 Accent 1"/> <w:lsdException w:name="Medium Grid 3 Accent 1"/> <w:lsdException w:name="Dark List Accent 1"/> <w:lsdException w:name="Colorful Shading Accent 1"/> <w:lsdException w:name="Colorful List Accent 1"/> <w:lsdException w:name="Colorful Grid Accent 1"/> <w:lsdException w:name="Light Shading Accent 2"/> <w:lsdException w:name="Light List Accent 2"/> <w:lsdException w:name="Light Grid Accent 2"/> <w:lsdException w:name="Medium Shading 1 Accent 2"/> <w:lsdException w:name="Medium Shading 2 Accent 2"/> <w:lsdException w:name="Medium List 1 Accent 2"/> <w:lsdException w:name="Medium List 2 Accent 2"/> <w:lsdException w:name="Medium Grid 1 Accent 2"/> <w:lsdException w:name="Medium Grid 2 Accent 2"/> <w:lsdException w:name="Medium Grid 3 Accent 2"/> <w:lsdException w:name="Dark List Accent 2"/> <w:lsdException w:name="Colorful Shading Accent 2"/> <w:lsdException w:name="Colorful List Accent 2"/> <w:lsdException w:name="Colorful Grid Accent 2"/> <w:lsdException w:name="Light Shading Accent 3"/> <w:lsdException w:name="Light List Accent 3"/> <w:lsdException w:name="Light Grid Accent 3"/> <w:lsdException w:name="Medium Shading 1 Accent 3"/> <w:lsdException w:name="Medium Shading 2 Accent 3"/> <w:lsdException w:name="Medium List 1 Accent 3"/> <w:lsdException w:name="Medium List 2 Accent 3"/> <w:lsdException w:name="Medium Grid 1 Accent 3"/> <w:lsdException w:name="Medium Grid 2 Accent 3"/> <w:lsdException w:name="Medium Grid 3 Accent 3"/> <w:lsdException w:name="Dark List Accent 3"/> <w:lsdException w:name="Colorful Shading Accent 3"/> <w:lsdException w:name="Colorful List Accent 3"/> <w:lsdException w:name="Colorful Grid Accent 3"/> <w:lsdException w:name="Light Shading Accent 4"/> <w:lsdException w:name="Light List Accent 4"/> <w:lsdException w:name="Light Grid Accent 4"/> <w:lsdException w:name="Medium Shading 1 Accent 4"/> <w:lsdException w:name="Medium Shading 2 Accent 4"/> <w:lsdException w:name="Medium List 1 Accent 4"/> <w:lsdException w:name="Medium List 2 Accent 4"/> <w:lsdException w:name="Medium Grid 1 Accent 4"/> <w:lsdException w:name="Medium Grid 2 Accent 4"/> <w:lsdException w:name="Medium Grid 3 Accent 4"/> <w:lsdException w:name="Dark List Accent 4"/> <w:lsdException w:name="Colorful Shading Accent 4"/> <w:lsdException w:name="Colorful List Accent 4"/> <w:lsdException w:name="Colorful Grid Accent 4"/> <w:lsdException w:name="Light Shading Accent 5"/> <w:lsdException w:name="Light List Accent 5"/> <w:lsdException w:name="Light Grid Accent 5"/> <w:lsdException w:name="Medium Shading 1 Accent 5"/> <w:lsdException w:name="Medium Shading 2 Accent 5"/> <w:lsdException w:name="Medium List 1 Accent 5"/> <w:lsdException w:name="Medium List 2 Accent 5"/> <w:lsdException w:name="Medium Grid 1 Accent 5"/> <w:lsdException w:name="Medium Grid 2 Accent 5"/> <w:lsdException w:name="Medium Grid 3 Accent 5"/> <w:lsdException w:name="Dark List Accent 5"/> <w:lsdException w:name="Colorful Shading Accent 5"/> <w:lsdException w:name="Colorful List Accent 5"/> <w:lsdException w:name="Colorful Grid Accent 5"/> <w:lsdException w:name="Light Shading Accent 6"/> <w:lsdException w:name="Light List Accent 6"/> <w:lsdException w:name="Light Grid Accent 6"/> <w:lsdException w:name="Medium Shading 1 Accent 6"/> <w:lsdException w:name="Medium Shading 2 Accent 6"/> <w:lsdException w:name="Medium List 1 Accent 6"/> <w:lsdException w:name="Medium List 2 Accent 6"/> <w:lsdException w:name="Medium Grid 1 Accent 6"/> <w:lsdException w:name="Medium Grid 2 Accent 6"/> <w:lsdException w:name="Medium Grid 3 Accent 6"/> <w:lsdException w:name="Dark List Accent 6"/> <w:lsdException w:name="Colorful Shading Accent 6"/> <w:lsdException w:name="Colorful List Accent 6"/> <w:lsdException w:name="Colorful Grid Accent 6"/> <w:lsdException w:name="Subtle Emphasis"/> <w:lsdException w:name="Intense Emphasis"/> <w:lsdException w:name="Subtle Reference"/> <w:lsdException w:name="Intense Reference"/> <w:lsdException w:name="Book Title"/> <w:lsdException w:name="Bibliography"/> <w:lsdException w:name="TOC Heading"/> </w:latentStyles> <w:style w:type="paragraph" w:default="on" w:styleId="a"> <w:name w:val="Normal"/> <wx:uiName wx:val="正文"/> <w:rsid w:val="00061BCE"/> <w:pPr> <w:widowControl w:val="off"/> <w:jc w:val="both"/> </w:pPr> <w:rPr> <wx:font wx:val="Calibri"/> <w:kern w:val="2"/> <w:sz w:val="21"/> <w:sz-cs w:val="22"/> <w:lang w:val="EN-US" w:fareast="ZH-CN" w:bidi="AR-SA"/> </w:rPr> </w:style> <w:style w:type="character" w:default="on" w:styleId="a0"> <w:name w:val="Default Paragraph Font"/> <wx:uiName wx:val="默认段落字体"/> </w:style> <w:style w:type="table" w:default="on" w:styleId="a1"> <w:name w:val="Normal Table"/> <wx:uiName wx:val="普通表格"/> <w:rPr> <wx:font wx:val="Calibri"/> <w:lang w:val="EN-US" w:fareast="ZH-CN" w:bidi="AR-SA"/> </w:rPr> <w:tblPr> <w:tblInd w:w="0" w:type="dxa"/> <w:tblCellMar> <w:top w:w="0" w:type="dxa"/> <w:left w:w="108" w:type="dxa"/> <w:bottom w:w="0" w:type="dxa"/> <w:right w:w="108" w:type="dxa"/> </w:tblCellMar> </w:tblPr> </w:style> <w:style w:type="list" w:default="on" w:styleId="a2"> <w:name w:val="No List"/> <wx:uiName wx:val="无列表"/> </w:style> <w:style w:type="paragraph" w:styleId="a3"> <w:name w:val="header"/> <wx:uiName wx:val="页眉"/> <w:basedOn w:val="a"/> <w:link w:val="Char"/> <w:rsid w:val="00BA541E"/> <w:pPr> <w:pBdr> <w:bottom w:val="single" w:sz="6" wx:bdrwidth="15" w:space="1" w:color="auto"/> </w:pBdr> <w:tabs> <w:tab w:val="center" w:pos="4153"/> <w:tab w:val="right" w:pos="8306"/> </w:tabs> <w:snapToGrid w:val="off"/> <w:jc w:val="center"/> </w:pPr> <w:rPr> <wx:font wx:val="Calibri"/> <w:sz w:val="18"/> <w:sz-cs w:val="18"/> </w:rPr> </w:style> <w:style w:type="character" w:styleId="Char"> <w:name w:val="页眉 Char"/> <w:basedOn w:val="a0"/> <w:link w:val="a3"/> <w:rsid w:val="00BA541E"/> <w:rPr> <w:sz w:val="18"/> <w:sz-cs w:val="18"/> </w:rPr> </w:style> <w:style w:type="paragraph" w:styleId="a4"> <w:name w:val="footer"/> <wx:uiName wx:val="页脚"/> <w:basedOn w:val="a"/> <w:link w:val="Char0"/> <w:rsid w:val="00BA541E"/> <w:pPr> <w:tabs> <w:tab w:val="center" w:pos="4153"/> <w:tab w:val="right" w:pos="8306"/> </w:tabs> <w:snapToGrid w:val="off"/> <w:jc w:val="left"/> </w:pPr> <w:rPr> <wx:font wx:val="Calibri"/> <w:sz w:val="18"/> <w:sz-cs w:val="18"/> </w:rPr> </w:style> <w:style w:type="character" w:styleId="Char0"> <w:name w:val="页脚 Char"/> <w:basedOn w:val="a0"/> <w:link w:val="a4"/> <w:rsid w:val="00BA541E"/> <w:rPr> <w:sz w:val="18"/> <w:sz-cs w:val="18"/> </w:rPr> </w:style> <w:style w:type="table" w:styleId="a5"> <w:name w:val="Table Grid"/> <wx:uiName wx:val="网格型"/> <w:basedOn w:val="a1"/> <w:rsid w:val="00BA541E"/> <w:rPr> <wx:font wx:val="Calibri"/> </w:rPr> <w:tblPr> <w:tblInd w:w="0" w:type="dxa"/> <w:tblBorders> <w:top w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:left w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:bottom w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:right w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> </w:tblBorders> <w:tblCellMar> <w:top w:w="0" w:type="dxa"/> <w:left w:w="108" w:type="dxa"/> <w:bottom w:w="0" w:type="dxa"/> <w:right w:w="108" w:type="dxa"/> </w:tblCellMar> </w:tblPr> </w:style> </w:styles> <w:shapeDefaults> <o:shapedefaults v:ext="edit" spidmax="5122"/> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="2"/> </o:shapelayout> </w:shapeDefaults> <w:docPr> <w:view w:val="print"/> <w:zoom w:percent="100"/> <w:doNotEmbedSystemFonts/> <w:bordersDontSurroundHeader/> <w:bordersDontSurroundFooter/> <w:defaultTabStop w:val="420"/> <w:drawingGridVerticalSpacing w:val="156"/> <w:displayHorizontalDrawingGridEvery w:val="0"/> <w:displayVerticalDrawingGridEvery w:val="2"/> <w:punctuationKerning/> <w:characterSpacingControl w:val="CompressPunctuation"/> <w:optimizeForBrowser/> <w:validateAgainstSchema/> <w:saveInvalidXML w:val="off"/> <w:ignoreMixedContent w:val="off"/> <w:alwaysShowPlaceholderText w:val="off"/> <w:hdrShapeDefaults> <o:shapedefaults v:ext="edit" spidmax="5122"/> </w:hdrShapeDefaults> <w:footnotePr> <w:footnote w:type="separator"> <w:p wsp:rsidR="00F26BE9" wsp:rsidRDefault="00F26BE9" wsp:rsidP="00BA541E"> <w:r> <w:separator/> </w:r> </w:p> </w:footnote> <w:footnote w:type="continuation-separator"> <w:p wsp:rsidR="00F26BE9" wsp:rsidRDefault="00F26BE9" wsp:rsidP="00BA541E"> <w:r> <w:continuationSeparator/> </w:r> </w:p> </w:footnote> </w:footnotePr> <w:endnotePr> <w:endnote w:type="separator"> <w:p wsp:rsidR="00F26BE9" wsp:rsidRDefault="00F26BE9" wsp:rsidP="00BA541E"> <w:r> <w:separator/> </w:r> </w:p> </w:endnote> <w:endnote w:type="continuation-separator"> <w:p wsp:rsidR="00F26BE9" wsp:rsidRDefault="00F26BE9" wsp:rsidP="00BA541E"> <w:r> <w:continuationSeparator/> </w:r> </w:p> </w:endnote> </w:endnotePr> <w:compat> <w:spaceForUL/> <w:balanceSingleByteDoubleByteWidth/> <w:doNotLeaveBackslashAlone/> <w:ulTrailSpace/> <w:doNotExpandShiftReturn/> <w:adjustLineHeightInTable/> <w:breakWrappedTables/> <w:snapToGridInCell/> <w:wrapTextWithPunct/> <w:useAsianBreakRules/> <w:dontGrowAutofit/> <w:useFELayout/> </w:compat> <wsp:rsids> <wsp:rsidRoot wsp:val="00BA541E"/> <wsp:rsid wsp:val="00061BCE"/> <wsp:rsid wsp:val="007560D8"/> <wsp:rsid wsp:val="00A46D99"/> <wsp:rsid wsp:val="00BA28D3"/> <wsp:rsid wsp:val="00BA541E"/> <wsp:rsid wsp:val="00E31877"/> <wsp:rsid wsp:val="00F26BE9"/> </wsp:rsids> </w:docPr> <w:body> <w:p wsp:rsidR="00061BCE" wsp:rsidRDefault="00BA541E"> <w:r> <w:rPr> <wx:font wx:val="宋体"/> </w:rPr> <w:t>中国银行新一代印鉴管理系统</w:t> </w:r> </w:p> <w:p wsp:rsidR="00BA541E" wsp:rsidRDefault="00BA541E"/> <w:p wsp:rsidR="00BA541E" wsp:rsidRDefault="00BA541E"> <w:r> <w:rPr> <w:rFonts w:hint="fareast"/> </w:rPr> <w:t>java</w:t> </w:r> <w:r> <w:rPr> <w:rFonts w:hint="fareast"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>生成</w:t> </w:r> <w:r> <w:rPr> <w:rFonts w:hint="fareast"/> </w:rPr> <w:t>word</w:t> </w:r> <w:r> <w:rPr> <w:rFonts w:hint="fareast"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>文件测试</w:t> </w:r> </w:p> <w:p wsp:rsidR="00BA541E" wsp:rsidRDefault="00BA541E"/> <w:tbl> <w:tblPr> <w:tblW w:w="0" w:type="auto"/> <w:tblBorders> <w:top w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:left w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:bottom w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:right w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> <w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="000000"/> </w:tblBorders> <w:tblLook w:val="04A0"/> </w:tblPr> <w:tblGrid> <w:gridCol w:w="4261"/> <w:gridCol w:w="4261"/> </w:tblGrid> <w:tr wsp:rsidR="00BA541E" wsp:rsidRPr="007560D8" wsp:rsidTr="007560D8"> <w:tc> <w:tcPr> <w:tcW w:w="4261" w:type="dxa"/> </w:tcPr> <w:p wsp:rsidR="00BA541E" wsp:rsidRPr="007560D8" wsp:rsidRDefault="00BA541E"> <w:pPr> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> </w:rPr> </w:pPr> <w:r wsp:rsidRPr="007560D8"> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>姓名</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w="4261" w:type="dxa"/> </w:tcPr> <w:p wsp:rsidR="00BA541E" wsp:rsidRPr="007560D8" wsp:rsidRDefault="00BA541E"> <w:pPr> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> </w:rPr> </w:pPr> <w:r wsp:rsidRPr="007560D8"> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>星座</w:t> </w:r> </w:p> </w:tc> </w:tr> <#list table as person> <w:tr wsp:rsidR="00BA541E" wsp:rsidRPr="007560D8" wsp:rsidTr="007560D8"> <w:tc> <w:tcPr> <w:tcW w:w="4261" w:type="dxa"/> </w:tcPr> <w:p wsp:rsidR="00BA541E" wsp:rsidRPr="007560D8" wsp:rsidRDefault="00E31877"> <w:pPr> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> </w:rPr> </w:pPr> <w:r wsp:rsidRPr="007560D8"> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman" w:hint="fareast"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>${person.name}</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:tcW w:w="4261" w:type="dxa"/> </w:tcPr> <w:p wsp:rsidR="00BA541E" wsp:rsidRPr="007560D8" wsp:rsidRDefault="00E31877"> <w:pPr> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> </w:rPr> </w:pPr> <w:r wsp:rsidRPr="007560D8"> <w:rPr> <w:rFonts w:ascii="Calibri" w:fareast="宋体" w:h-ansi="Calibri" w:cs="Times New Roman"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>${person.xingzuo}</w:t> </w:r> </w:p> </w:tc> </w:tr> </#list> </w:tbl> <w:p wsp:rsidR="00BA541E" wsp:rsidRDefault="00BA541E"/> <w:p wsp:rsidR="00A46D99" wsp:rsidRDefault="00A46D99"> <w:r> <w:rPr> <w:rFonts w:hint="fareast"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>备注:</w:t> </w:r> <w:r wsp:rsidR="00E31877"> <w:rPr> <w:rFonts w:hint="fareast"/> <wx:font wx:val="宋体"/> </w:rPr> <w:t>${remark}</w:t> </w:r> <w:r wsp:rsidR="00E31877"> <w:rPr> <w:rFonts w:hint="fareast"/> </w:rPr> <w:t>1</w:t> </w:r> </w:p> <w:sectPr wsp:rsidR="00A46D99" wsp:rsidSect="00061BCE"> <w:pgSz w:w="11906" w:h="16838"/> <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="851" w:footer="992" w:gutter="0"/> <w:cols w:space="425"/> <w:docGrid w:type="lines" w:line-pitch="312"/> </w:sectPr> </w:body> </w:wordDocument>[/code]
微信小程序提交POST请求后端无法获取请求参数
微信小程序提交POST请求后端无法获取请求参数。 js代码 Page({ data:{ }, formSubmit : function(e){ var that = this console.log(e.detail.value) wx.request({ url: 'http://localhost/wx/form', data: e.detail.value, method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT header: { "Content-Type": "application/x-www-form-urlencoded" }, // 设置请求的 header success: function(res){ // success // res.data返回来的就是response返回的json对象 console.log(res.data.msg) var msg = res.data.msg that.setData({msg,msg }) }, fail: function() { // fail }, complete: function() { // complete } }) }, formReset : function(e){ console.log("reset") } }) 控制台打印的e.detail.value是有值得,传到后台全都是null。求解。 还有一个问题,我是提交POST请求,但是后端不提供GET,只提供POST会出现405.
geoserver如何使用rest上传shp数据
RT。 使用XML失败了。 ```curl -v -u admin:geoserver -X PUT -H "accept: application/xml" -d @C:/Users/111111/Desktop/geoserver/test2.xml http://localhost:8888/geoserver/rest/workspaces/P/datastores/datastores/Export_Output.shp ```
s2sh整合问题 tomcat启动没异常 访问.jsp 和action失败 单独测试struts2成功 hibernate+spring成功
<p>web.xml:</p> <p> </p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p> <p>&lt;web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"</p> <p><span style="white-space: pre;"> </span>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</p> <p><span style="white-space: pre;"> </span>xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;</p> <p> </p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;listener&gt;</p> <p><span style="white-space: pre;"> </span>&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/listener&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;context-param&gt;</p> <p><span style="white-space: pre;"> </span>&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;</p> <p><span style="white-space: pre;"> </span>&lt;param-value&gt;classpath:beans.xml&lt;/param-value&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/context-param&gt;</p> <p><span style="white-space: pre;"> </span>&lt;!--</p> <p><span style="white-space: pre;"> </span>&lt;filter&gt; &lt;filter-name&gt;struts2&lt;/filter-name&gt;</p> <p><span style="white-space: pre;"> </span>&lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;struts2&lt;/filter-name&gt;</p> <p><span style="white-space: pre;"> </span>&lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt;</p> <p><span style="white-space: pre;"> </span>--&gt;</p> <p><span style="white-space: pre;"> </span>&lt;filter&gt;</p> <p><span style="white-space: pre;"> </span>&lt;filter-name&gt;struts2&lt;/filter-name&gt;</p> <p><span style="white-space: pre;"> </span>&lt;filter-class&gt;org.apache.struts2.dispatcher.FilterDispatcher&lt;/filter-class&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/filter&gt;</p> <p><span style="white-space: pre;"> </span>&lt;filter-mapping&gt;</p> <p><span style="white-space: pre;"> </span>&lt;filter-name&gt;struts2&lt;/filter-name&gt;</p> <p><span style="white-space: pre;"> </span>&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/filter-mapping&gt;</p> <p>&lt;/web-app&gt;</p> <p> </p> <p>struts2.xml</p> <p> </p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;</p> <p>&lt;!DOCTYPE struts PUBLIC</p> <p>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"</p> <p>    "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;</p> <p> </p> <p>&lt;struts&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;constant name="struts.enable.DynamicMethodInvocation" value="true" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;constant name="struts.devMode" value="true" /&gt;</p> <p><span style="white-space: pre;"> </span></p> <p><span style="white-space: pre;"> </span>&lt;package name="useraction" namespace="/user" extends="struts-default"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;action name="userAction" class="userAction"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;result name="success"&gt;/index.jsp&lt;/result&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/action&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/package&gt;</p> <p><span style="white-space: pre;"> </span>&lt;!-- Add packages here --&gt;</p> <p> </p> <p>&lt;/struts&gt;</p> <p> </p> <p>beans.xml</p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p> <p>&lt;beans xmlns="http://www.springframework.org/schema/beans"</p> <p><span style="white-space: pre;"> </span>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</p> <p><span style="white-space: pre;"> </span>xmlns:context="http://www.springframework.org/schema/context"</p> <p><span style="white-space: pre;"> </span>xmlns:aop="http://www.springframework.org/schema/aop"</p> <p><span style="white-space: pre;"> </span>xmlns:tx="http://www.springframework.org/schema/tx"</p> <p><span style="white-space: pre;"> </span>xsi:schemaLocation="http://www.springframework.org/schema/beans </p> <p>           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</p> <p>           http://www.springframework.org/schema/context</p> <p>           http://www.springframework.org/schema/context/spring-context-2.5.xsd</p> <p>           http://www.springframework.org/schema/aop</p> <p>           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</p> <p>           http://www.springframework.org/schema/tx </p> <p>           http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;context:annotation-config /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;context:component-scan base-package="com.kettas"&gt;&lt;/context:component-scan&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;!-- datasource --&gt;</p> <p><span style="white-space: pre;"> </span>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"</p> <p><span style="white-space: pre;"> </span>destroy-method="close"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;!-- results in a setDriverClassName(String) call --&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="url" value="jdbc:oracle:thin:@localhost:1521:xe" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="username" value="spc" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="password" value="spc" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/bean&gt;</p> <p><span style="white-space: pre;"> </span>&lt;!-- sessionfactory --&gt;</p> <p><span style="white-space: pre;"> </span>&lt;bean id="sessionFactory"</p> <p><span style="white-space: pre;"> </span>class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="dataSource" ref="dataSource" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="annotatedClasses"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;list&gt;</p> <p><span style="white-space: pre;"> </span>&lt;value&gt;com.kettas.entity.Product&lt;/value&gt;</p> <p><span style="white-space: pre;"> </span>&lt;value&gt;com.kettas.entity.User&lt;/value&gt;</p> <p><span style="white-space: pre;"> </span>&lt;value&gt;com.kettas.entity.Order&lt;/value&gt;</p> <p><span style="white-space: pre;"> </span>&lt;value&gt;com.kettas.entity.Item&lt;/value&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/list&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/property&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;property name="hibernateProperties"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;props&gt;</p> <p><span style="white-space: pre;"> </span>&lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle9Dialect&lt;/prop&gt;</p> <p><span style="white-space: pre;"> </span>&lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;</p> <p><span style="white-space: pre;"> </span>&lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;</p> <p><span style="white-space: pre;"> </span>&lt;prop key="current_session_context_class"&gt;thread&lt;/prop&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/props&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/property&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/bean&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="sessionFactory" ref="sessionFactory" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/bean&gt;</p> <p><span style="white-space: pre;"> </span>&lt;bean id="txManager"</p> <p><span style="white-space: pre;"> </span>class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;property name="sessionFactory" ref="sessionFactory" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/bean&gt;</p> <p><span style="white-space: pre;"> </span>&lt;aop:config&gt;</p> <p><span style="white-space: pre;"> </span>&lt;aop:pointcut id="bussinessService"</p> <p><span style="white-space: pre;"> </span>expression="execution(public * com.biz..*.*(..))" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;aop:advisor pointcut-ref="bussinessService"</p> <p><span style="white-space: pre;"> </span>advice-ref="txAdvice" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/aop:config&gt;</p> <p> </p> <p><span style="white-space: pre;"> </span>&lt;tx:advice id="txAdvice" transaction-manager="txManager"&gt;</p> <p><span style="white-space: pre;"> </span>&lt;tx:attributes&gt;</p> <p><span style="white-space: pre;"> </span>&lt;tx:method name="login" read-only="true" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;tx:method name="select*" read-only="true" /&gt;</p> <p><span style="white-space: pre;"> </span>&lt;tx:method name="insert" propagation="REQUIRED"/&gt;</p> <p><span style="white-space: pre;"> </span>&lt;tx:method name="update" propagation="REQUIRED"/&gt;</p> <p><span style="white-space: pre;"> </span>&lt;tx:method name="delete" propagation="REQUIRED"/&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/tx:attributes&gt;</p> <p><span style="white-space: pre;"> </span>&lt;/tx:advice&gt;</p> <p>&lt;/beans&gt;</p> <p> </p> <p>action:</p> <p> </p> <p>@Controller("userAction")</p> <p>@Scope("prototype")</p> <p>public class UserAction extends ActionSupport {</p> <p><span style="white-space: pre;"> </span>private User user;</p> <p><span style="white-space: pre;"> </span> private UserBiz userBiz;</p> <p><span style="white-space: pre;"> </span>private Map&lt;String, Object&gt; session;</p> <p> </p> <p><span style="white-space: pre;"> </span>public Map&lt;String, Object&gt; getSession() {</p> <p><span style="white-space: pre;"> </span>return session;</p> <p><span style="white-space: pre;"> </span>}</p> <p> </p> <p><span style="white-space: pre;"> </span>public void setSession(Map&lt;String, Object&gt; session) {</p> <p><span style="white-space: pre;"> </span>this.session = session;</p> <p><span style="white-space: pre;"> </span>}</p> <p> </p> <p><span style="white-space: pre;"> </span>public User getUser() {</p> <p><span style="white-space: pre;"> </span>return user;</p> <p><span style="white-space: pre;"> </span>}</p> <p> </p> <p><span style="white-space: pre;"> </span>public void setUser(User user) {</p> <p><span style="white-space: pre;"> </span>this.user = user;</p> <p><span style="white-space: pre;"> </span>}</p> <p> </p> <p><span style="white-space: pre;"> </span> public UserBiz getUserBiz() {</p> <p><span style="white-space: pre;"> </span> return userBiz;</p> <p><span style="white-space: pre;"> </span> }</p> <p><span style="white-space: pre;"> </span></p> <p><span style="white-space: pre;"> </span> @Resource(name = "userBiz")</p> <p><span style="white-space: pre;"> </span> public void setUserBiz(UserBiz userBiz) {</p> <p><span style="white-space: pre;"> </span> this.userBiz = userBiz;</p> <p><span style="white-space: pre;"> </span> }</p> <p> </p> <p><span style="white-space: pre;"> </span>public String login() {</p> <p><span style="white-space: pre;"> </span> User userLogin = userBiz.login(user.getName(), user.getPassword());</p> <p><span style="white-space: pre;"> </span> if (userLogin != null) {</p> <p><span style="white-space: pre;"> </span> session.put("login", userLogin);</p> <p><span style="white-space: pre;"> </span>System.out.println("aaaaaaa");</p> <p><span style="white-space: pre;"> </span> return "success";</p> <p><span style="white-space: pre;"> </span> } else {</p> <p><span style="white-space: pre;"> </span> addActionError("用户名密码错误");</p> <p><span style="white-space: pre;"> </span> return "error";</p> <p><span style="white-space: pre;"> </span> }</p> <p><span style="white-space: pre;"> </span>}</p> <p>}</p> <p> </p>
Rail 2.0 Ruby generate 嵌套 controller 报错
[b]环境版本:[/b] D:\learns\rails_learn\blog>ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] D:\learns\rails_learn\blog>gem -v 1.2.0 D:\learns\rails_learn\blog>rails -v Rails 2.1.0 [b]执行 D:\learns\rails_learn\blog>ruby -d script/generate controller Admin::Posts 1> 1.log 2> 2.log 报错[/b] [b]1.log:[/b] The name 'Admin::PostsHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again. [b]2.log:[/b] Exception `LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:772 - no such file to load -- rubygems/defaults/operating_system d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:241: warning: `&' interpreted as argument prefix d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails/gem_dependency.rb:32: warning: `*' interpreted as argument prefix D:/learns/rails_learn/blog/config/boot.rb:8: warning: method redefined; discarding old boot! D:/learns/rails_learn/blog/config/boot.rb:15: warning: method redefined; discarding old booted? D:/learns/rails_learn/blog/config/boot.rb:19: warning: method redefined; discarding old pick_boot D:/learns/rails_learn/blog/config/boot.rb:23: warning: method redefined; discarding old vendor_rails? D:/learns/rails_learn/blog/config/boot.rb:27: warning: method redefined; discarding old preinitialize D:/learns/rails_learn/blog/config/boot.rb:31: warning: method redefined; discarding old preinitializer_path D:/learns/rails_learn/blog/config/boot.rb:37: warning: method redefined; discarding old run D:/learns/rails_learn/blog/config/boot.rb:44: warning: method redefined; discarding old load_initializer D:/learns/rails_learn/blog/config/boot.rb:51: warning: method redefined; discarding old load_initializer D:/learns/rails_learn/blog/config/boot.rb:57: warning: method redefined; discarding old load_rails_gem D:/learns/rails_learn/blog/config/boot.rb:69: warning: method redefined; discarding old rubygems_version D:/learns/rails_learn/blog/config/boot.rb:73: warning: method redefined; discarding old gem_version D:/learns/rails_learn/blog/config/boot.rb:83: warning: method redefined; discarding old load_rubygems D:/learns/rails_learn/blog/config/boot.rb:96: warning: method redefined; discarding old parse_gem_version D:/learns/rails_learn/blog/config/boot.rb:101: warning: method redefined; discarding old read_environment_rb Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem builder (~> 2.1.2) Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem xml-simple (~> 1.0.11) Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem memcache-client (~> 1.5.0) Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem tzinfo (~> 0.3.8) Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- fast_xs Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- fast_xs Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- utf8proc_native Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- utf8proc_native Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- utf8proc_native d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations.rb:284: warning: `*' interpreted as argument prefix d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:187: warning: `*' interpreted as argument prefix d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:41: warning: method redefined; discarding old allow_concurrency= d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/routing_ext.rb:3: warning: method redefined; discarding old to_param d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/recognition_optimisation.rb:56: warning: method redefined; discarding old recognize_path d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_finder.rb:94: warning: method redefined; discarding old view_paths= d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/helpers/sanitize_helper.rb:108: warning: ambiguous first argument; put parentheses or even spaces Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/requires.rb:19 - no such file to load -- redcloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/requires.rb:19 - no such file to load -- bluecloth Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- securerandom Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- securerandom Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- securerandom d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_ext/session.rb:44: warning: method redefined; discarding old create_new_id d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_ext/session.rb:51: warning: method redefined; discarding old initialize Exception `DRb::DRbServerNotFound' at d:/ruby/lib/ruby/1.8/drb/drb.rb:1650 - DRb::DRbServerNotFound d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session/active_record_store.rb:186: warning: method redefined; discarding old connection Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem tmail (~> 1.2.3) Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem text-format (>= 0.6.3) Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27 - no such file to load -- tmail/tmailscanner Exception `MissingSourceFile' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34 - no such file to load -- tmail/tmailscanner Exception `MissingSourceFile' at d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:512 - no such file to load -- tmail/tmailscanner d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:428: warning: method redefined; discarding old template_root= Exception `Gem::LoadError' at d:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - Could not find RubyGem activerecord-mysql-adapter (>= 0) d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:427: warning: instance variable @view_paths not initialized d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:35: warning: instance variable @observers not initialized d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:241: warning: instance variable @routes_last_modified not initialized d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:35: warning: instance variable @observers not initialized d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:6: warning: redefine included d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:22: warning: method redefined; discarding old mandatory_options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:30: warning: method redefined; discarding old default_options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:42: warning: method redefined; discarding old full_options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:49: warning: method redefined; discarding old options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:56: warning: method redefined; discarding old mandatory_options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:61: warning: method redefined; discarding old default_options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:70: warning: method redefined; discarding old full_options d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:81: warning: method redefined; discarding old parse! d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:98: warning: method redefined; discarding old usage d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:102: warning: method redefined; discarding old usage_message d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:107: warning: method redefined; discarding old banner d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:115: warning: method redefined; discarding old add_options! d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/scripts/../options.rb:119: warning: method redefined; discarding old add_general_options! d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/spec.rb:16: warning: instance variable @klass not initialized Exception `Rails::Generator::UsageError' at d:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails_generator/commands.rb:392 - The name 'Admin::PostsHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again. 我刚刚开始Rails on Ruby,在做  Rolling with Rails 2.0 - The First Full Tutorial - Part 1 练习,碰到这个问题,有人碰到类似问题吗?可以帮助解决下吗?谢谢 :D
异步加载时不能返回Json数据
后台代码: /** * 返回数据用于zTree控件树状图显示 * @return */ @ResponseBody @RequestMapping("getMenuJson") public List<Map<Object,Object>> getJson(){ List<Menu> list=menuService.findList(); List<Map<Object,Object>>mapList= new ArrayList<>(); for(int i=0;i<list.size();i++){ Map <Object,Object> map= new HashMap<Object,Object>(); map.put("id", list.get(i).getId()); map.put("name", list.get(i).getName()); map.put("pId", list.get(i).getParentId()); map.put("url", list.get(i).getUrl()); map.put("target", "_blank"); mapList.add(map); } System.out.println("异步加载数据成功"); return mapList; } 前台代码: /**************异步加载数据************/ var setting4 = { async: { enable: true, contentType: "application/json", url:"${ctx}/a/menu/getMenuJson", /* autoParam:["id", "name=", "level=lv"], */ otherParam:{"otherParam":"zTreeAsyncTest"}, dataFilter: filter } }; function filter(treeId, parentNode, childNodes) { if (!childNodes) return null; for (var i=0, l=childNodes.length; i<l; i++) { childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');/* 把回车换成. */ } console.log(childNodes); return childNodes; } $(document).ready(function(){ zTreeObj = $.fn.zTree.init($("#treeDemo1"), setting4); }); 使用了SpringMVC框架,此处使用zTree插件来异步加载Menu树状菜单,但是获取到的数据为数组格式,如下: Array(9) 0 : {name: "新建菜单", pId: 5, id: 3, url: "/a/menu/add", target: "_blank"} 1 : {name: "菜单列表", pId: 5, id: 4, url: "/a/menu/list", target: "_blank"} 2 : {name: "菜单管理", pId: 0, id: 5, url: "/a/menu/", target: "_blank"} 3 : {name: "人员管理", pId: 0, id: 6, url: "/a/user/", target: "_blank"} 4 : {name: "人员添加", pId: 6, id: 7, url: "/a/user/add", target: "_blank"} 5 : {name: "人员列表", pId: 6, id: 8, url: "/a/user/list", target: "_blank"} 6 : {name: "修改密码", pId: 6, id: 9, url: "/a/user/changePW", target: "_blank"} 7 : {name: "人员添加1", pId: 7, id: 10, url: "#", target: "_blank"} 8 : {name: "人员添加2", pId: 7, id: 11, url: "#", target: "_blank"} 请问如何解决 解决
TFS系统PUT上传文件报错,result:-5001。
错误信息如下 ERROR get_block_info_ex (tfs_session.cpp:585) [140070975862624] get block 5207 info fail, ret: -1002, error: got error, when get block: 5207 mode: 6, result: -5001 information, 127.0.0.1:48571, status: -5001 ERROR open_ex (tfs_file.cpp:113) [140070975862624] tfs open fail: get block info fail, blockid: 5207, fileid: 11, mode: 2, ret: -5001 ERROR open (tfs_client_impl.cpp:302) [140070975862624] open tfsfile fail, filename: T10zZTBybT1RCvBVdK, suffix: (null), flags: 2, ret: -5001 ERROR save_file_ex (tfs_client_impl.cpp:1132) [140070975862624] open tfs file to write fail. tfsname: T10zZTBybT1RCvBVdK, suffix: (null), flag: 0, ret: -5001 put /data/T10zZTBybT1RCvBVdK => T10zZTBybT1RCvBVdK fail. 应该怎么处理?
微信jsapi怎么调用,我总是支付签名验证失败
js部分代码: WeixinJSBridge.invoke( 'getBrandWCPayRequest', { appId: message.appid, //公众号名称,由商户传入 nonceStr:message.noncestr, //随机串 package:message.package, paySign:message.sign, //微信签名 signType:message.signType, //微信签名方式: timeStamp:message.timestamp, //时间戳,自1970年以来的秒数 }, function(res){ alert(JSON.stringify(res)); if(res.err_msg == "get_brand_wcpay_request:ok" ) { } // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。 } ); 请求代码: String timeStamp = Long.toString((long) ((new Date().getTime())*0.001)); String nonceStr = WXPayUtil.generateUUID(); //構造參數,生成sign值 Map<String,String> params = new TreeMap<String, String>(); params.put("appid", config.getAppID()); params.put("timestamp", timeStamp); params.put("noncestr", nonceStr); params.put("package", "prepay_id="+resultMap.get("prepay_id")); params.put("sign", WXPayUtil.generateSignature(params, config.getKey(), WXPayConstants.SignType.MD5)); params.put("signType", WXPayConstants.MD5); 我使用微信官网验证过支付签名,签名是对的。
安卓,gridview和simpleadapter,为什么显示的都是同一张图?
代码如下: activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" android:orientation="vertical"> <GridView android:id="@+id/gridview" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> 然后下面是imageview.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".activity" android:orientation="vertical"> <ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> 下面是java代码: package com.example.test5; import android.os.Bundle; import android.widget.*; import java.util.*; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { SimpleAdapter s=null; GridView grid=null; List<Map<String,Object>> list=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); grid=(GridView)super.findViewById(R.id.gridview); initAdapter(); grid.setAdapter(s); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void initAdapter() { Map<String,Object> map=new HashMap<String,Object>(); list=new ArrayList<Map<String,Object>>(); map.put("图片", R.drawable.a1); list.add(map); map.put("图片", R.drawable.a2); list.add(map); map.put("图片", R.drawable.a3); list.add(map); s=new SimpleAdapter(MainActivity.this,list,R.layout.imageview,new String[]{"图片"},new int[]{R.id.image}); } } 要显示三张图片,可是显示的都是同一张,是最后一张图。 请问这里哪里出了错,怎么解决?
求解用php做一个web service的相关程序??不知道哪里出问题了?谢谢!!!
<?php class soap { private $tel; private $num; public function Book($tel,$num) { file_put_contents("d:/mylog.log",$tel,FILE_APPEND); $this->tel=$tel; $this->num=$num;//???? $conn=mysql_connect("localhost","root",""); if(!$conn) { die("连接数据库失败".mysql_error()); } mysql_query("set names utf8",$conn)or die(mysql_errno()); mysql_select_db("myorder",$conn) or die(mysql_errno()); $sql="insert into mytable (tel,num) values('$tel','$num')"; $res=mysql_query($sql,$conn)or die(mysql_error()); if(!$res) { //die("操作失败".mysql_error()); return false; } return TRUE; mysql_close($conn); } } ?> 服务端: <?php ini_set("soap.wsdl_cache_enabled", "0"); require_once 'order.php'; $ser=new SoapServer('soap.wsdl',array('soap_version' => SOAP_1_2)); //创建SoapServer对象 $ser->setClass("soap"); $ser->handle(); ?> 客户端: <?php try{ ini_set("soap.wsdl_cache_enabled", "0"); $tel=$_POST['tel']; $num=$_POST['num']; $client=new SoapClient("soap.wsdl"); //echo $tel; //$tel="13245678900"; //$num="22"; echo $tel; $result=$client->Book("$tel","$num");//这句有问题 if($result) { echo "注册成功!"; } else echo "注册失败!"; }catch (SoapFault $e) { echo $e->getMessage(); }catch (Exception $e) { echo $e->getMessage(); } ?> 以及WSDL文件: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost/1102/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="soap" targetNamespace="http://localhost/1102/"> <wsdl:types> <xsd:schema targetNamespace="http://localhost/1102/"> <xsd:element name="NewOperation"> <xsd:complexType> <xsd:sequence> <xsd:element name="in" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="NewOperationResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="out" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="BookRequest"> <wsdl:part name="tel" type="xsd:string"/> <wsdl:part name="num" type="xsd:int"></wsdl:part> </wsdl:message> <wsdl:message name="BookResponse"> <wsdl:part name="BookReturn" type="xsd:boolean"/> </wsdl:message> <wsdl:portType name="soap"> <wsdl:operation name="Book"> <wsdl:input message="tns:BookRequest"/> <wsdl:output message="tns:BookResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="soapSOAP" type="tns:soap"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="Book"> <soap:operation soapAction="http://localhost/1102/Book" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="soap"> <wsdl:port binding="tns:soapSOAP" name="soapSOAP"> <soap:address location="http://localhost/1102/server.php"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
开源一个功能完整的SpringBoot项目框架
福利来了,给大家带来一个福利。 最近想了解一下有关Spring Boot的开源项目,看了很多开源的框架,大多是一些demo或者是一个未成形的项目,基本功能都不完整,尤其是用户权限和菜单方面几乎没有完整的。 想到我之前做的框架,里面通用模块有:用户模块,权限模块,菜单模块,功能模块也齐全了,每一个功能都是完整的。 打算把这个框架分享出来,供大家使用和学习。 为什么用框架? 框架可以学习整体
源码阅读(19):Java中主要的Map结构——HashMap容器(下1)
(接上文《源码阅读(18):Java中主要的Map结构——HashMap容器(中)》) 3.4.4、HashMap添加K-V键值对(红黑树方式) 上文我们介绍了在HashMap中table数组的某个索引位上,基于单向链表添加新的K-V键值对对象(HashMap.Node&lt;K, V&gt;类的实例),但是我们同时知道在某些的场景下,HashMap中table数据的某个索引位上,数据是按照红黑树
c++制作的植物大战僵尸,开源,一代二代结合游戏
    此游戏全部由本人自己制作完成。游戏大部分的素材来源于原版游戏素材,少部分搜集于网络,以及自己制作。 此游戏为同人游戏而且仅供学习交流使用,任何人未经授权,不得对本游戏进行更改、盗用等,否则后果自负。 目前有六种僵尸和六种植物,植物和僵尸的动画都是本人做的。qq:2117610943 开源代码下载 提取码:3vzm 点击下载--&gt; 11月28日 新增四种植物 统一植物画风,全部修
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
深度学习图像算法在内容安全领域的应用
互联网给人们生活带来便利的同时也隐含了大量不良信息,防范互联网平台有害内容传播引起了多方面的高度关注。本次演讲从技术层面分享网易易盾在内容安全领域的算法实践经验,包括深度学习图
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程实用技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法,并会持续更新。
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
"狗屁不通文章生成器"登顶GitHub热榜,分分钟写出万字形式主义大作
前言 GitHub 被誉为全球最大的同性交友网站,……,陪伴我们已经走过 10+ 年时间,它托管了大量的软件代码,同时也承载了程序员无尽的欢乐。 上周给大家分享了一篇10个让你笑的合不拢嘴的Github项目,而且还拿了7万+个Star哦,有兴趣的朋友,可以看看, 印象最深刻的是 “ 呼吸不止,码字不停 ”: 老实交代,你是不是经常准备写个技术博客,打开word后瞬间灵感便秘,码不出字? 有什么
推荐几款比较实用的工具,网站
1.盘百度PanDownload 这个云盘工具是免费的,可以进行资源搜索,提速(偶尔会抽风????) 不要去某站买付费的???? PanDownload下载地址 2.BeJSON 这是一款拥有各种在线工具的网站,推荐它的主要原因是网站简洁,功能齐全,广告相比其他广告好太多了 bejson网站 3.二维码美化 这个网站的二维码美化很好看,网站界面也很...
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
相关热词 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件 c#注册dll文件 c#安装.net
立即提问