Я поступил на весенний курс по удемии. Я следовал за каждым шагом, который показал мне мой инструктор. Поэтому, если вы используете Spring mvc и hibernate, вы можете столкнуться с этой ошибкой. Не удалось прочитать документ схемы « http://www.springframework.org/schema/tx/spring-tx.xsd » и т. Д. Для:
and elements
в моем конфигурационном файле с пружиной у меня были эти два URL
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
в xsi: schemaLocation, которые я заменил на
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
Фактически посетите эти два сайта http://www.springframework.org/schema/mvc/ и http://www.springframework.org/schema/tx/ и просто добавили последняя версия spring-mvc и spring-tx ie, spring-mvc-4.2.xsd и spring-tx-4.2.xsd, как показано выше.
По моему мнению, спецификация версии явно не является хорошей практикой , Это сработало для меня, надеюсь, это сработает и для вас. Спасибо.
Создайте третий массив (возможно, activeList
.) Затем просто нажмите кнопку, нажав кнопку, которая копирует items
или items2
в activeList
. Наконец, замените все ссылки на items
в методе рендеринга на activeList
. Вот сокращенный код:
class ItemList extends React.Component {
state = {
...
items: [],
items2: [],
activelist: [],
};
componentDidMount() {
dataPromise.then(
result => {
this.setState({
isLoaded: true,
items: result,
activelist: result
});
},
...
);
dataPromise2.then(
result2 => {
this.setState({
isLoaded: true,
items2: result2
});
},
...
);
}
constructor(props) {
super(props);
...
this.Active1 = this.Active1.bind(this); // ADDED
this.Active2 = this.Active2.bind(this); // ADDED
}
...
Active1() {
this.setState({ activelist: Object.assign({}, this.state.items) }); //CHANGED
}
Active2() {
this.setState({ activelist: Object.assign({}, this.state.items2) }); //CHANGED
}
render() {
...
return (
<div>
<button className="changebutton" onClick={this.Active1}>
Menu 1
</button>
<button className="changebutton" onClick={this.Active2}>
Menu2
</button>
...
);
}
}
}
Вот код и окно: https://codesandbox.io/s/jn6vp0qx4y?fontsize=14