×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

There is a trick,

You have two misunderstandings:
1. JSP file will be complied not only when you restart JBoss, but every time it is accessed.
2. The class file under work/ directory is temporary servlet, which, theoratically, is ellegible for cleaning after the session is invalidated.

That's why JSP is little slow.

To solve the timing issue, the way is to use servlet. Because it is compiled component, JBoss only needs to create an object the first time it is accessed, for every restarting. After that, servlet accessing is fast.

The trick is that:
create a servlet, by copying your temporary servlet from the work directory, and then deploy this servlet.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 在JBoss中写一个web application,放在deploy/myweb.war下.
    从IE中run这个jsp,线编译成servlet class文件到work/myweb.war下,重起jboss,work 下所有的文件都被delete 了,jsp还需要重新编译,很费时间.能否保留编译好的class文件?另外,如果有大量jsp,如何能一次编译好而不需要从IE中调用时再编译?
    • 应该不行吧,我决得问题不大,只不过是第一次运行时需要编译慢些,以后就好了。另外,Jboss是hot-deploy,为什么要老重启呢?
      • 应用交给client后,一旦用户重新启动,就必须将所有的page 都run一遍,几百个jsp,很麻烦
        • 这个好像大伙儿都这样,等一次而已。不过如果你实在想搞得人性化点,可以写个测试的class,里面模拟http request把所有的页面都request一边,等几分钟再让用户用。不过.............
          有个问题我不知道怎么解决:怎么在模拟的http request里面加入session信息,否则如果设置了error page,所有没有权限的request全给转到那儿去了,你的jsp还是没办法run。

          关于模拟request怎么处理session的问题,可以考虑另起一贴讨论
          • 不知道JBoss是用什么名令编译JSP的,否则可以在重起server之后,用这个命令进行编译
          • 使用websphere, weblogic的大侠有没有这个问题?
          • 做websphere,weblogic的大侠,你们有没有类似问题?
    • There is a trick,
      You have two misunderstandings:
      1. JSP file will be complied not only when you restart JBoss, but every time it is accessed.
      2. The class file under work/ directory is temporary servlet, which, theoratically, is ellegible for cleaning after the session is invalidated.

      That's why JSP is little slow.

      To solve the timing issue, the way is to use servlet. Because it is compiled component, JBoss only needs to create an object the first time it is accessed, for every restarting. After that, servlet accessing is fast.

      The trick is that:
      create a servlet, by copying your temporary servlet from the work directory, and then deploy this servlet.