小编Huy*_*Huy的帖子

将 JSON 对象从 Express 服务器发送到 React 时未定义对象?

我是 React 和 Express 的新手。我在端口 8080 上使用localhost:8080/site3路由创建了客户端:

import React, { Component } from 'react';

export default class Site3 extends Component {
  componentDidMount() {
    console.log('FETCHING');
    fetch('http://localhost:3000/site3', {
      method: "GET"
    })
      .then(res => {
        res.json();
      })
      .then(result => {
        console.log(result);
        console.log('Finished fetching');
      });
  }

  render() {
    return content;
  }
}
Run Code Online (Sandbox Code Playgroud)

服务器端端口 3000:

const express = require("express");
require("dotenv").config();

const app = express();

const data = [
  { id: "tt0110357", name: "The Lion King", genre: "animation" },
  { id: "tt0068646", name: "The …
Run Code Online (Sandbox Code Playgroud)

node.js express reactjs

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

线程“main”中的异常java.lang.IllegalArgumentException:PWC6309:非法compilerSourceVM:12

我尝试运行下面的代码:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

但 IDE 向我显示错误:

Exception in thread "main" java.lang.IllegalArgumentException: PWC6309: Illegal compilerSourceVM: 12
    at org.apache.jasper.JspC.setCompilerSourceVM(JspC.java:724)
    at org.netbeans.modules.web.project.ant.JspC.main(JspC.java:80)
    at org.netbeans.modules.web.project.ant.JspCSingle.main(JspCSingle.java:119)
F:\Code\Netbean project\Smartphone Shop\nbproject\build-impl.xml:936: Java returned: 1
BUILD FAILED (total time: 0 seconds)
Run Code Online (Sandbox Code Playgroud)

如何修复这个错误?我使用 Netbeans 11.0 和 Tomcat 9.0。

java jsp tomcat netbeans

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

标签 统计

express ×1

java ×1

jsp ×1

netbeans ×1

node.js ×1

reactjs ×1

tomcat ×1