Java Web项目维护

又一次要搞一下JAVA,每次都要装下JDK,设置下环境变量,编译一个HelloWorld来运行一下。下面再记录一次:

1.设置JAVA_HOME为JDK的根目录

2.把%JAVA_HOME%bin添加进path

3.设置classpath为 “.;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar”

至此编译HelloWorld应该不成问题了。

 

由于这是一个关于Web【struts2+Hibernate+Spring】的项目

首先我通读了 CoreJsp一书。最简单的JSP程序:




A simple date example


The time on the server is
<%= new java.util.Date() %>

之后该书用了大量的篇幅讲解了JSP的标签用法及与ServerLet相关的一些概念。作为标准,JAVA Web程序的根目录下要有一个WEB-INF文件夹,The WEB-INF directory contains the web.xml file as well as two different directories: classes and lib. classes contains Servlet and utility classes needed by the application. lib contains JAR files that might contain Servlets, JavaBeans, and utility classes that might be useful to the application. The web.xml file, commonly known as the deployment descriptor, contains configuration and deployment information about the Web application. It can contain information about the application in general, such as MIME type mappings, error pages, session configuration, and security. It can contain information about definitions and mappings to both JSP pages and Servlets. Another type of information that can be contained within the deployment descriptor is Servlet context initialization parameters.

 

然后就是研究一下struts2

Your browser sends to the web server a request for the URL http://localhost:8080/tutorial/HelloWorld.action.

  1. The container receives from the web server a request for the resource HelloWorld.action. According to the settings loaded from the web.xml, the container finds that all requests are being routed toorg.apache.struts2.dispatcher.FilterDispatcher, including the *.action requests. The FilterDispatcher is the entry point into the framework.
  2. The framework looks for an action mapping named "HelloWorld", and it finds that this mapping corresponds to the class "HelloWorld". The framework instantiates the Action and calls the Action's executemethod.
  3. The execute method sets the message and returns SUCCESS. The framework checks the action mapping to see what page to load if SUCCESS is returned. The framework tells the container to render as the response to the request, the resource HelloWorld.jsp.
  4. As the page HelloWorld.jsp is being processed, the tag calls the getter getMessage of the HelloWorld Action, and the tag merges into the response the value of the message.
  5. A pure HMTL response is sent back to the browser.

For detailed information on Struts 2 architecture see Big Picture.

最后又看了Hibernate,和Spring的tutorial,对这些技术有了一些了解。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值