Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Java中从JTextField设置Bean属性值?_Java_Xml_Spring_Swing - Fatal编程技术网

如何在Java中从JTextField设置Bean属性值?

如何在Java中从JTextField设置Bean属性值?,java,xml,spring,swing,Java,Xml,Spring,Swing,我在登录窗口(JFrame)中有一个JTextField。在该jtext字段中,用户输入其名称 我有另一个StudentWindow(JFrame),它的构造函数将用户名字符串作为参数 在我的xml文件中,如何注入来自JTextField的输入 <!-- GUI Beans --> <bean id="logInWindow" class="gui.LogInWindow"> <constructor-arg ref="controller"/>

我在登录窗口(JFrame)中有一个JTextField。在该jtext字段中,用户输入其名称

我有另一个StudentWindow(JFrame),它的构造函数将用户名字符串作为参数

在我的xml文件中,如何注入来自JTextField的输入

<!-- GUI Beans -->
<bean id="logInWindow" class="gui.LogInWindow">
    <constructor-arg ref="controller"/>
    <property name="nameJTextField" value="?? Need help here ??"/>
</bean>

<bean id="studentWindow" class="gui.StudentWindow">
<constructor-arg ref="????????"/>
</bean> 


提前谢谢。

你不能。Spring解析XML并在您的
JFrame
出现之前基于它创建bean。除非我完全误解了你的情况…

请参阅“谢谢你的提示”。我刚开始学春天。我可能应该做更多的研究。可能……而且你也应该记住,默认情况下,所有SpringBean都是单例的。