如何从源码中找出具体的jsp技术?

发布于 2024-10-13 04:51:13 字数 1984 浏览 1 评论 0原文

我目前正在“评估”一个 JSP 应用程序。我不是jsp专家,我只有一些jsp和jsf开发经验。我怀疑这个应用程序的技术是在非常古老的j2ee中。有没有办法从源代码中找出详细版本、技术或平台?或者这个应用程序的 jsp 版本大约有多旧?以下是一些 ui 代码。请看一下,我发现它与当前的jsp和jsf平台相比复杂得离谱。

<jsp:include page='header.jsp'></jsp:include>
<%
  StringBuffer htmlBuffer = new StringBuffer();
 // get viewbean interface and cast it to view bean object accordingly
 com.nihb.mtrd.bean.AdminVB vb = 
 (com.nihb.mtrd.bean.AdminVB)session.getAttribute(com.nihb.mtrd.bean.AbstractBean.VIEW_BEAN);
 //display message if there is any
 String message = vb.getMessage();
 if(message == null){ 
  message = new String("");
 } 
 htmlBuffer.append("<p><b><font face='Verdana' size='1' color='#cc0000'>");
 htmlBuffer.append( message );
 htmlBuffer.append("</font></b></p>");
 htmlBuffer.append("<div align='center'>");
 htmlBuffer.append("<center>");
 htmlBuffer.append("<table border='3' cellspacing='0' style='border-collapse: collapse' width='800 ' cellpadding='0' id='AutoNumber7' height='9' bgcolor='#E8F3FF' bordercolor='#E8F3FF'>");
 htmlBuffer.append("<TR><td width='800' height='7' colspan='8'>");
 htmlBuffer.append("<br>");
 if( vb.getIndicator() != 0){
  htmlBuffer.append("<a href='MtrdHome.jsp?mysubmit=");
  htmlBuffer.append(com.nihb.mtrd.bean.AbstractBean.ACTION_HYPERLINK_CHANGE_PASSWORD); 
  htmlBuffer.append("' >");
 }
 htmlBuffer.append("<b><font face='Verdana' size='2'>Change Password</font></b>");
 if( vb.getIndicator() != 0){
  htmlBuffer.append("</a>");
 } 

 htmlBuffer.append("</td></TR>"); 

谢谢大家!

更新:这是我的web.xml的顶行:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp">
    <!-- snip -->
</web-app>

I am currently "assessing" a JSP application. I am no jsp expert, i have some experience in jsp with jsf development only. I suspected that the technology of this application was in very old j2ee. Is there anyway to find out the detail version, technology, or platform from source code? Or roughly how old of the jsp version is this application? For following is some the ui code. Please take a look, i find it that it's ridiculously complicated compared with current jsp and jsf platform.

<jsp:include page='header.jsp'></jsp:include>
<%
  StringBuffer htmlBuffer = new StringBuffer();
 // get viewbean interface and cast it to view bean object accordingly
 com.nihb.mtrd.bean.AdminVB vb = 
 (com.nihb.mtrd.bean.AdminVB)session.getAttribute(com.nihb.mtrd.bean.AbstractBean.VIEW_BEAN);
 //display message if there is any
 String message = vb.getMessage();
 if(message == null){ 
  message = new String("");
 } 
 htmlBuffer.append("<p><b><font face='Verdana' size='1' color='#cc0000'>");
 htmlBuffer.append( message );
 htmlBuffer.append("</font></b></p>");
 htmlBuffer.append("<div align='center'>");
 htmlBuffer.append("<center>");
 htmlBuffer.append("<table border='3' cellspacing='0' style='border-collapse: collapse' width='800 ' cellpadding='0' id='AutoNumber7' height='9' bgcolor='#E8F3FF' bordercolor='#E8F3FF'>");
 htmlBuffer.append("<TR><td width='800' height='7' colspan='8'>");
 htmlBuffer.append("<br>");
 if( vb.getIndicator() != 0){
  htmlBuffer.append("<a href='MtrdHome.jsp?mysubmit=");
  htmlBuffer.append(com.nihb.mtrd.bean.AbstractBean.ACTION_HYPERLINK_CHANGE_PASSWORD); 
  htmlBuffer.append("' >");
 }
 htmlBuffer.append("<b><font face='Verdana' size='2'>Change Password</font></b>");
 if( vb.getIndicator() != 0){
  htmlBuffer.append("</a>");
 } 

 htmlBuffer.append("</td></TR>"); 

thanks all!

Update: here are the top lines of my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp">
    <!-- snip -->
</web-app>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ま柒月 2024-10-20 04:51:13

您面临的确实是一个糟糕的设计。所有 HTML 都必须纯文本放置在 JSP 文件中。这些 bean 只需由 servlet 或最终 准备并由 EL 访问(那些 ${} 事物)。流程控制必须由 JSTL taglib 来完成。

至于具体问题,JSP版本基本上是在web.xml的根声明中定义的,它必须指示Servlet版本。 JSP 版本与Servlet 版本耦合。以下是概述:

Servlet  JSP  J2EE/Java EE (releasedate)
3.0      2.2  Java EE 6 (Dec 2009)
2.5      2.1  Java EE 5 (May 2006)
2.4      2.0  J2EE 1.4 (Nov 2003)
2.3      1.2  J2EE 1.3 (Sep 2001)

更新:根据您的编辑,这显然是 Servlet 2.3。不过,很高兴知道只要相关 servlet 容器支持它,您就可以将其重新声明为 Servlet 2.4 或更高版本。例如,如果是 Tomcat 5.5,那么您可以将其重新声明为 Servlet 2.4 并使用 JSP 2.0。或者,如果是 Tomcat 6.0,则为 Servlet 2.5/JSP 2.1。或者带有 Servlet 3.0/JSP 2.2 的 Tomcat 7.0。

What you're facing is indeed a bad design. All that HTML has got to be placed plain in the JSP file. Those beans has just to be prepared by a servlet or eventually <jsp:useBean> and accessed by EL (those ${} things). The flow control has got to be done by JSTL taglib.

As to the concrete question, the JSP version is basically definied in root declaration of web.xml which must indicate the Servlet version. The JSP version is coupled to the Servlet version. Here's an overview:

Servlet  JSP  J2EE/Java EE (releasedate)
3.0      2.2  Java EE 6 (Dec 2009)
2.5      2.1  Java EE 5 (May 2006)
2.4      2.0  J2EE 1.4 (Nov 2003)
2.3      1.2  J2EE 1.3 (Sep 2001)

Update: as per your edit, that's clearly Servlet 2.3. It's however good to know that you can redeclare it as Servlet 2.4 or higher whenever the servletcontainer in question supports it. If it is for example Tomcat 5.5, then you can redeclare it as Servlet 2.4 and utilize JSP 2.0. Or if it is for example Tomcat 6.0, then Servlet 2.5/JSP 2.1. Or Tomcat 7.0 with Servlet 3.0/JSP 2.2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文