使用JB9中的Tomcat4.0开发的一个Struts小程序,遇到了问题,不知道问题在哪里。 我的目录结构是: WEB-INF ---web.xml ---struts-config.xml ---class ---wiley ---LookupAction.class ---LookForm.class ---tld ---struts-html.tld jsp ---index.jsp ---quote.jsp images ---hp_logo_wiley.gif 其中,struts-config.xml内容为: <?xml version="1.0" encoding="ISO.8859.1" ?> <!DOCTYPE Struts.config PUBLIC ".//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts.config_1_0.dtd"> <struts-config> <form-beans> <form-bean name="lookupForm" type="wiley.LookupForm"/> </form-beans> <action-mappings> <action path="/Lookup" type="wiley.LookupAction" name="lookupForm" input="/jsp/index.jsp"> <forward name="success" path="/jsp/quote.jsp"/> <forward name="failure" path="/jsp/index.jsp"/> </action> </action-mappings> </struts-config>
web.xml文件的格式为: <?xml version="1.0" encoding="ISO-8859-1"?> <!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> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <taglib> <taglib-uri>/WEB-INF/tld/struts-html.tld</taglib-uri> <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location> </taglib> </web-app>
并且,index.jsp的内容是: <%@ page language="java" %> <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %> <html> <head> <title>Wiley Struts Application</title> </head> <body> <table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> <tr bgcolor="#36566E"> <td height="68" width="48%"> <div align="left"> <img src="images/hp_logo_wiley.gif" width="220" height="74"> </div> </td> </tr> <tr> <td> </td> </tr> </table> <html:form action="/Lookup" name="lookupForm" type="wiley.LookupForm" > <table width="45%" border="0"> <tr> <td>Symbol:</td> <td><html:text property="symbol" /></td> </tr> <tr> <td colspan="2" align="center"><html:submit /></td> </tr> </table> </html:form> </body> </html>
在IE中输入后,问题好像除在index.jsp中的标签库html上,出现了异常。还有各疑问就是关于相对路径的问题: web.xml中,<param-value>>/WEB-INF/struts-config.xml</param-value>中,使用了/是不是因为基于ContextPath的。 但是如果在index.jsp中使用hp_logo_wiley.gif文件的话,就需要使用images/hp_logo_wiley.gif呀? 我的这个程序该怎么改,才是对的?谢谢大家了
|
|