学习点滴

1.hibernate的配置文件的放置位置。位置放错了会导致报错,说找不到配置文件。

hibernate.cfg.xml一般放在src根目录下

2. hibernate.cfg.xml配置文件中的mapping标签中的resource属性的值一般对应的是domain对象的映射文件*.hbm.xml,注意前面的包名直接用‘/’分隔开,否则会报错。之前用‘.’进行分隔时报错:resource: org.hibernate.tutorial.domain.Event.hbm.xml not found

3. 为什么需要实现序列化?

当你需要将对象的状态保存到文件中或通过网络进行传输时,需要将对象转换成字节序列,这就是序列化。因为网络设施和硬盘等硬件只能识别位、字节形式的数据,不能识别Java对象,通过序列化可以把Java对象转换成字节数据在网络上传输和存储。

4.Explain Struts work Flow?

1) A request comes in from a Java Server Page into the ActionServlet.
2) The ActionServlet having already read the struts-config.xml file, knows which form bean relates to this JSP, and delegates work to the validate method of that form bean.

3) The form bean performs the validate method to determine if all required fields have been entered, and performs whatever other types of field validations that need to be performed.

4) If any required field has not been entered, or any field does not pass validation, the form bean generates ActionErrors, and after checking all fields returns back to the ActionServlet.

5) The ActionServlet checks the ActionErrors that were returned from the form beans validate method to determine if any errors have occurred. If errors have occurred, it returns to the originating JSP displaying the appropriate errors.

6) If no errors occurred in the validate method of the form bean, the ActionServlet passes control to the appropriate Action class.

7) The Action class performs any necessary business logic, and then forwards to the next appropriate action (probably another JSP).


5.If you want to actually read the Struts 2 tag TLD file, you'll find it in the META-INF folder of the Struts 2 core jar.


6. Struts2中包级属性文件(package level properties)放在WEB-INF -> classes文件下,在myeclipse中要在navigator视图下才能看到,或者直接到项目文件夹下的classes目录中添加包级属性文件。


7. MyEclipse中给引用的JAR包添加源码。右击JAR包,选择Properties,在弹出的对话框中点击Java Source Attarchment,然后选定源文件的路径加载源码。

MyEclipse中给引用的JAR包添加API文档。右击JAR包,选择Properties,在弹出的对话框中点击Javadoc Location,然后选定源文件的路径加载API文档。


8. 让MyEclipse在编辑xml文件时提供提示功能。Window -> Properties -> MyEclipse -> Files and Editors -> XML -> XML Catalog,点击Add 按钮,把对应key和location填上,

Key Type选择URI。




9. Struts2中进行单元测试时,需引入如下几个JAR包


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值