当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: Velocity 是一个基于 Java 的通用模板工具,来自于 jakarta.apache.org 。
 

 

    摘要:;本程序求n的平方根stack segment stack dw 20 dup(?)stack ends data segmentn db 20hm db 01hi db 01hdata ends codes segment assume cs:codes,ds:data,es:nothing,ss:stackmain: mov ax,data mov ds,ax again:mov al,......
 ·一个简单的将bmp图片转换成tif    »显示摘要«
    摘要:1: go to http://java.sun.com/products/java-media/jai/current.html download java advanced imaging 1.1.2 2: put the lib in your jdk 3: following is the sample i convert my tif to bmp file: import ja......


Velocity实例

 

【程序编程相关:文章管理系统 V1.0.35

【推荐阅读:CASSINI源代码分析(5)——总结

velocity 的介绍请参考 velocity -- java web 开发新技术.这里是它的一个应用示例. 【扩展信息:JBoss和Apache因共享代码问题硝

 velocity 是一个基于 java 的通用模板工具,来自于 jakarta.apache.org .

这个例子参照了 php-nuke 的结构, 即所有 http 请求都以 http://www.some.com/xxx/modules?name=xxx&arg1=xxx&bbb=xxx 的形式进行处理.例子中所有文件都是 .java 与 .html , 没有其他特殊的文件格式.除了 modules.java 是 java servlet, 其余的 .java 文件都是普通的 java class.

所有 http 请求都通过 modules.java 处理.modules.java 通过 velocity 加载 modules.htm. modules.htm 有页头,页脚,页左导航链接,页中内容几个部分.其中页头广告.页中内容是变化部分.页头广告由 modules.java 处理,页中内容部分由 modules.java dispatch 到子页面类处理.

1) modules.java

        import javax.servlet.*;

import javax.servlet.http.*;

import org.apache.velocity.*;

import org.apache.velocity.context.*;

import org.apache.velocity.exception.*;

import org.apache.velocity.servlet.*;

import commontools.*;

public class modules

  extends velocityservlet {

  public template handlerequest(httpservletrequest request,

                 httpservletresponse response,

                 context context) {

    //init

    response.setcontenttype("text/html; charset=utf-8");

    response.setcharacterencoding("utf-8");

    //prepare function page

    processsubpage page = null;

    processsubpage mainpage = new homesubpage();

    string requestfunctionname = (string) request.getparameter("name");

    boolean logined = false;

    string loginaccount = (string) request.getsession(true).getattribute(

      "loginaccount");

    if (loginaccount != null) {

      logined = true;

    }

    //default page is mainpage

    page = mainpage;

    if (requestfunctionname == null||requestfunctionname.equalsignorecase("home")) {

      page = mainpage;

    }

    //no login , can use these page

    else if (requestfunctionname.equalsignorecase("login")) {


...   下一页
 ·c#读写注册表    »显示摘要«
    摘要: c#编程打造自己的ie浏览器 选择自 yudehui 的 blog 关键字 c#编程打造自己的ie浏览器 出处 声明:本文已经放到了天极网站上,这里只是收藏而已。未经许可,不得转载 ie是现在windows平台下用的最多的浏览器,那么如何用程序来修改ie,打造有自己的特色的ie呢? 我在这里向介绍怎么c#用通过注册表来修改ie。......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE