关于struts的简单问题!请高手指教!!

fireskyye 2003-03-31 03:49:34
以下是我的注册页代码:
可无论怎么改,都出错,但只要把<form>块去掉就好用!请问<html:form>有什么特殊的么!
<%@ page contentType="text/html; charset=gb2312"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<HEAD>
<TITLE> New Document </TITLE>
<html:base/>
</HEAD>
<BODY>
<html:errors/>
<html:form action="/saveRegAction">
<html:text property="logname" size="16" maxlength="16"/>
</html:form>
</BODY>
</html:html>

以下是我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 Bean Definitions =================================== -->
<form-beans>

<!-- Logon form bean -->
<form-bean name="regForm"
type="com.hongye.qianjia.webapp.RegForm"/>

</form-beans>


<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>

<!-- Edit user registration -->
<action path="/saveRegAction"
type="com.hongye.qianjia.webapp.SaveRegAction"
name="regForm"
scope="request"
input="/index.jsp">
</action>



</action-mappings>

</struts-config>

请高手指点啊!!!
...全文
50 点赞 收藏 34
写回复
34 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
fireskyye 2003-04-01
谢谢!!
回复
AllError 2003-03-31
对了,你可以自己去网上找
回复
AllError 2003-03-31
我有struts in action 不过太大4.8M不知道怎么给你
回复
carrysilence 2003-03-31
struts看看英文资料吧,没有什么东西.
这里有struts学习园地,里面有不好资料.

去找本servlet的书才是重要的事情.推荐清华的 精通servlet
我本人学习中.

入门级的好书呀.
回复
fireskyye 2003-03-31
可惜,我给不了!她不让我给!!
再次谢谢两位!!
回复
fireskyye 2003-03-31
多谢两位了!
给你们一人100分!
我豁出去0分了!
另外,struts也没有相关的书啊!!我昨天去书店没买到!!
回复
AllError 2003-03-31
同意carrysilence(jafler)
input 的name 只需和formbean的变量名相同即可
回复
carrysilence 2003-03-31
你写的from class是可以不要的.
那是临时用来存放和校验页面变量的.

要有一个action,和一个与之对应的jsp页面,在config文件里面注册你的这个action,web.xml不属于struts范畴,属于servlet范畴,在那里面调用到struts-config.xml

其他的,说不清楚,晚上回去熬夜看书吧.

光做永远不能做个理性出来.

回复
AllError 2003-03-31
SaveRegAction就是所谓的Actionservlet
回复
carrysilence 2003-03-31
property 对应的永远是你的方法名,而不是你的内部变量名,否则怎么体现封装性?

property="testRee"

那么from里面的get set方法就应该写成 getTestRee() setTestRee()

property="testree"
get set方法就应该写成 getTestree() setTestree()
回复
fireskyye 2003-03-31
请问显示form表单,都需要哪些文件!!
我写的有web.xml,struts-config.xml,struts*.tld,RegForm.java,SaveRegAction.java,
以上是我写的所有文件,还需要其他别的文件么!!
回复
carrysilence 2003-03-31
******************已经找到错误了**************************
html--><html:text property="logname" size="16" maxlength="16"/>
class--> public String getLogName()

logname getLogName
两者要一致

要么都logname,要么都logName
注意两者大小写一致.
第一个字母除外
回复
fireskyye 2003-03-31
出错信息:
HTTP Status 500 - Internal Server Error

--------------------------------------------------------------------------------

type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot retrieve definition for form bean null
at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
at org.apache.jsp.index$jsp._jspService(index$jsp.java:193)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Unknown Source)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source)
at org.apache.jasper.servlet.JspServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.CertificatesValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContext.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source)
at java.lang.Thread.run(Thread.java:536)


root cause

javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:795)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:481)
at org.apache.jsp.index$jsp._jspService(index$jsp.java:133)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Unknown Source)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source)
at org.apache.jasper.servlet.JspServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.CertificatesValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContext.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source)
at java.lang.Thread.run(Thread.java:536)



--------------------------------------------------------------------------------
回复
fireskyye 2003-03-31
我没有写Actionservlet呀!!
一定要写么,我看struts例子里也没有写呀!!
回复
AllError 2003-03-31
出错信息也要
回复
carrysilence 2003-03-31
1.检查打包名是否正确.
2.检查xml是否正确 .
3.直接在struts的例子上改写你的程序.
有这些就不可能弄不出来.
我的第一次就是改例子改出来的.
回复
AllError 2003-03-31
编程需要耐心.
成功需要仔细.

再把Actionservlet 贴出来看看!
回复
AllError 2003-03-31
struts1.1
回复
carrysilence 2003-03-31
不知道你看得例子是什么版本的,我做了一个项目都是用name
回复
fireskyye 2003-03-31
还是不行!!急死人了!!
但不过非常谢谢你!!
回复
加载更多回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2003-03-31 03:49
社区公告
暂无公告