初始道具更改后,需要更新表单中的值
export default withFormik({
mapPropsToValues: (props: Props) => {
return (
{
id: props.initialData.id,
name: props.initialData.name
}
);
},
handleSubmit: (values, { props: Props, setSubmitting }) => {
Props.submitHandler(values);
},
})(NewDatasourceForm);
Run Code Online (Sandbox Code Playgroud)
在这里,mapPropsToValues我能够得到新的props,但形式的值不会得到更新.
```const NewDatasourceForm =(props)=> {const {values,touching,errors,isSubmitting,setFieldValue,handleSubmit,handleChange,handleBlur} = props;
const NewDatasourceForm = (props) => {
const {
values,
touched,
errors,
isSubmitting,
setFieldValue,
handleSubmit,
handleChange,
handleBlur
} = props;
const _handleSelect = (selectDSChoice) => {
try {
setFieldValue('dataSourceType', selectDSChoice.value);
} catch (error) {
// tslint:disable-next-line:no-console
console.error(error);
} …Run Code Online (Sandbox Code Playgroud) jdbc:derby:myDatabase;create=true
什么create=true意思?是应该所有的连接都有这个create = true还是只有用户和psw?
高级谢谢
以下代码不会打印该值.
function go(x)
{
alert(x.options.selectedIndex.value);
//location=document.menu.student.options[document.menu.student.selectedIndex].value
}
Run Code Online (Sandbox Code Playgroud)
这是html代码
<select name="student" onChange="go(this)">
<option selected> Student </option>
<option value="http://www.cnet.com">Attendence</option>
<option value="http://www.abc.com">Exams</option>
</select>
Run Code Online (Sandbox Code Playgroud) Scanner Class 找不到我使用 NetBeansIDE 的文件,test.txt 在文件夹路径中:D:\netbeans projectworks\ReadFile\src\readfile\test.txt
在同一个文件夹中存在 readfile.java。代码如下。它生成未找到的文件。
package readfile;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
public class ReadFile {
public static void main(String[] args) throws IOException , FileNotFoundException
{
Scanner scanner = new Scanner(new File("test.txt"));
while (scanner.hasNextLine())
System.out.println(scanner.nextLine());
}
}
Run Code Online (Sandbox Code Playgroud)
输出:-
run:
Exception in thread "main" java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.util.Scanner.<init>(Scanner.java:636)
at readfile.ReadFile.main(ReadFile.java:14)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Run Code Online (Sandbox Code Playgroud) 我使用Netbeans,做一个java应用程序.我在netbeans中使用Java DB创建了一个用于db连接的ConnectDB类.我启动了服务器,十个连接到db.当我运行它生成的文件
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver @ 25 line
Run Code Online (Sandbox Code Playgroud)
和
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/Libraryprj;create=true
Run Code Online (Sandbox Code Playgroud)
@ 30行代码
代码如下
package Lms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
/**
*
* @author JOJO
*/
public class ConnectDB {
static Connection conn;
public static void main(String[] args) {
String driver = "org.apache.derby.jdbc.ClientDriver";
String connectionURL = "jdbc:derby://localhost:1527/Libraryprj;create=true";
String createString = "CREATE TABLE Employee (NAME VARCHAR(32) NOT NULL, ADDRESS VARCHAR(50) NOT NULL)";
try {
Class.forName(driver);
} catch (java.lang.ClassNotFoundException e) {
e.printStackTrace(); …Run Code Online (Sandbox Code Playgroud) 
大家好,我正在开发我的大学迷你项目.这是一个图书馆管理系统,我应该使用Net-beans IDE在Java中进行.首先我做了手动编码.这需要时间.
在手动编码中,我使用菜单栏和项目创建单个JFrame,在执行的所有操作中,我为所有Jpanels编写代码.它使文件和代码变得庞大.而且也很困惑.
现在我需要你的帮助.我创建了一个带有菜单A JPanel的主JFrame - 添加另一个Jpanel - 添加书籍成功(演示!,对于ADD书中发生的操作)
我做了动作听众
addBook addbk = new addBook();
this.getContentPane().add(addbk);
Run Code Online (Sandbox Code Playgroud)
写了这段代码.我没有意义.朋友们,作为java的新手,我需要学习的是什么
1.)如何执行cal和显示外部Jpanel执行的操作2.)如果在外部JPanel中发生任何事件,如何向另一个根JFrame显示另一个JPanel.
在排序中,像HTML中的iframe一样谢谢大家.
http://compilr.com/abelkbil/openlib/OpenLibMainGUI.java