写在前面
今天学习了一些“软硬件相互通信”的内容,我参考一个博主的教程,他的教程写的很详细,让我感受到学习有人带的那种快乐。我在很多时候学习一个新的东西都是没有人给一个大致学习的方向的,因此自己要主动去找、去问。百度、知乎、学长学姐等等。也很感谢那些分享学习经验的人。
今天有小伙伴评论说在MyEclipse中如何导入一个web项目,那我就在下面写一下吧,不知道和他说的是否有偏差。
MyEclipse导入web项目
以前也用过eclipse,导入方法我感觉都差不多。有需要的小伙伴可以康康。
我先写下如何移除一个项目,比方说,我已经导入了以下的这么多项目,如图1。我要把"SecondTest"移除(注意移除和删除不一样,移除只是不在MyEclipse显示该项目,但是该项目仍然存在于磁盘中)。具体操作如下:

右击"SecondTest",弹出图2,选择"Delete",弹出图3,在图3中不勾选红框中的部分,即为移除而不是删除。


如图3所示,点击"OK"后,就将"SecondTest"移除了,如图4所示。

那如何再将"SecondTest"项目导入呢,如图5,点击"File"-->"Import",然后弹出图6。

如图6红框所示,点击然后展开"General",看到第二个红框里的内容,然后双击。跳转到图7。

如图7所示,再点击图7中的"Browse" ,选择电脑中的web项目。如图8所示。

如图8所示,选择"SecondTest" ,再点击确定。确定后如图9所示。

如图9所示,最后点击"Finish"即可。

最后成功导入啦。 诺,图10。

编写代码时积累的一些细节
①调试代码时可以往往出现一大堆错误,可以复制其中一些错误,然后百度解决,也可以参考给出的错误的所在行数,如图11。

如图11所示,像在大方框里的"java:2073" "java:2073"等的一般写的是java内部的代码,而我们可以看代码数小的比如我用圈圈框出来的,它一般就指出了我们的错误出现在具体的哪个java文件的哪一行。
②我们使用sql语句时它的字段要和数据库里的表的字段一一对应相同。一定要再仔细。

如图12,当时程序在在这里报错,这里是往lyTable里插入数据。我愣是看不出来错误,结果和图13,我在数据库里的表一对比,就知道了表里的是"comment"而不是"content"。把"content"改成"comment"即可。

同时,因为我设置id字段是自动递增的,因此在插入数据时只需要考虑后面4个字段。
③如何快速产生重载方法。因为在java中某些类已经有一些方法了,继承它后,如何快速得到这些方法,而不需要一个一个敲出来呢,方法如下:
鼠标放在你需要写代码的地方,然后键盘"shift+alt+s",弹出图14.点击红框内容。然后图15。

如下,我需要的是红框内的两函数,勾选即可。

如下,快速产生了doGet,doPost函数的框架,就不必自己一个个敲了。

同样地,若选择如图17红框内容,即可快速产生作者,如图18。


④记得要在input结尾的地方加一个斜杠/。

累了,晚安~~
转载:https://blog.csdn.net/qq_41904864/article/details/104888207