急问:用JBuilder2005遇到的问题

05-04-05 kevinfield

最近刚刚用JBuilder2005遇到的奇怪问题(而且是JBuilder2005更新过之后的........郁闷)

无意中发现JBuilder2005 有奇怪问题

1.我按照JBuilder2005上面的说明,打开了Struts1.1的示例程序,但是老提示说有一些jsp文件无法编译(我是按照JBuilder help上面一步一步下来的,但是还是有错)

2.我按照JBuilder2005的help中的"Tutorial: Creating a Struts web application"按部就班的建立了一个hello示例程序

具体文件如下:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<form-beans>

<form-bean name="userActionForm" type="strutsexample.UserActionForm" />

</form-beans>

<action-mappings>

<action input="/hello.jsp" name="userActionForm" path="/userAction" scope="session" type="strutsexample.UserAction">

<forward name="goodbye" path="/goodbye.jsp" />

</action>

</action-mappings>

</struts-config>

配置文件定义完全正确,但是在运行的时候发生如下错误:

HTTP Status 500 -

description: The server encountered an internal error () that prevented it from fulfilling this request.exception

Exception:

javax.servlet.ServletException: Cannot retrieve mapping for action /goodbye

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)

org.apache.jsp.goodbye_jsp._jspService(goodbye_jsp.java:90)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)

org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause:

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /goodbye

org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:810)

org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)

org.apache.jsp.goodbye_jsp._jspx_meth_html_form_0(goodbye_jsp.java:187)

org.apache.jsp.goodbye_jsp._jspx_meth_html_html_0(goodbye_jsp.java:128)

org.apache.jsp.goodbye_jsp._jspService(goodbye_jsp.java:81)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)

org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Apache Tomcat/5.0.27

请比较熟悉的JBuilder2005的高手们指点

不胜感激!!!!!!

kevinfield
2005-04-05 17:33

struts-config.xml配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<form-beans>

<form-bean name="userActionForm" type="strutsexample.UserActionForm" />

</form-beans>

<action-mappings>

<action input="/hello.jsp" name="userActionForm" path="/userAction" scope="session" type="strutsexample.UserAction">

<forward name="goodbye" path="/goodbye.jsp" />

</action>

</action-mappings>

</struts-config>

kevinfield
2005-04-05 17:37

struts-config文件配置如下:kevinfieldpja70UX60k.xml

Falcon
2005-04-06 00:27

不是你提交表单页面里action属性写错了,就是这个xml配置文件里的这一段有问题,看看你的action和这里的path是否匹配

<action input="/hello.jsp" name="userActionForm" path="/userAction" scope="session" type="strutsexample.UserAction">

kevinfield
2005-04-06 15:25

hello.jsp文件如下:

<%@ page contentType="text/html; charset=GBK" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<html:html>

<head>

<title>

hello

</title>

</head>

<jsp:useBean id="bean0" scope="session" class="strutstoturial.User" />

<jsp:setProperty name="bean0" property="*" />

<body bgcolor="#ffff00">

<h1>

JBuilder Generated JSP

</h1>

<html:form action="/userAction.do" method="post">

<br><br>

<html:submit value="Submit" property="Submit"/>

<html:reset value="Reset"/>

<hr>bean0<br>

Enter new value for bean0.firstName : <html:text property="firstName"/><br>

Enter new value for bean0.lastName : <html:text property="lastName"/><br>

<hr><br>

</html:form>

</body>

</html:html>

goodbye.jsp如下:

<%@ page contentType="text/html; charset=GBK" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<html:html>

<head>

<title>

goodbye

</title>

</head>

<body bgcolor="#ffff00">

<h1>

JBuilder Generated JSP

</h1>

<p>Goodbye 

<bean:write name = "userActionForm" property="firstName"/>

<bean:write name = "userActionForm" property="lastName"/>

!</p>

<html:form action="goodbye.jsp" method="post">

<br><br>

<html:submit value="Submit" property="Submit"/>

<html:reset value="Reset"/>

</html:form>

</body>

</html:html>

麻烦那位高手帮看一下,到底是我的文件有问题,还是JBuilder2005有问题

不过我爸war文件放到Tomcat下面单独测试,还是出现同样的问题

2Go 1 2 下一页