structs 的学习笔记
Structs 学习心得
Hibernate是一种新的ORM映射工具
还有一些表示持久数据的框架,比如JDO和OJB
在%TOMCAT_HOME%\conf\server.xml中Web应用和数据源。在server.xml中加入以下的配置描述。
例程1 配置web应用
servlet 的错误
java.lang.ExceptionInInitializerError
net.beecool.db.ibatis.domain.ShowItemBar.doPost(Unknown Source)
net.beecool.db.ibatis.domain.ShowItemBar.doGet(Unknown Source)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
struts 错误
No action instance for path
当用户提交了HTML表单,Struts框架自动把表单数据组装到ActionForm Bean中。接下来Struts框架会自动调用ActionForm Bean的validate()方法进行表单验证。如果validate()方法返回的ActionErrors 对象为null,或者不包含任何ActionMessage对象,就表示没有错误,数据验证通过。如果ActionErrors中包含ActionMessage对象,就表示发生了验证错误,Struts框架会把ActionErrors对象保存到request范围内,然后把请求转发到恰当的视图组件,视图组件通过<html:errors> 标签把request范围内的ActionErrors对象中包含的错误消息显示出来,提示用户修改错误。
<text>标签
<text>标签用于生成一个文本的输入区域。它必须包含和相关form bean中的相同属性对应的“property”属性。该标签只有在嵌入到一个<form>标签中时才有效。
例如: <html:text property=\"userName\"/>
会被转换成: <input type=\"text\" name=\"userName\" value=\"\">
<password>标签
<password>标签用于生成一个口令字(type password)的输入区域。它必须包含和相关form bean中的相同属性对应的“property”属性。该标签只有在嵌入到一个<form>标签中时才有效。该标签中的一个很重要的属性是“redisplay”,它用于重新显示以前输入到这个区域中的值。该属性的缺省值为true。然而,为了使password不能被重新显示,你或许希望将该属性的值设为false。
例如: <html:password property=\"password\"
redisplay=\"false\"/>
会被转换成: <input type=\"password\" name=\"password\"
value=\"\">
<hidden>标签
<hidden>标签用于生成一个隐藏文本的输入区域。它必须包含和相关form bean中的相同属性对应的“property”属性。该标签只有在嵌入到一个<form>标签中时才有效:
例如: <html:hidden property=\"userName\"/>
会被转换成: <input type=\"hidden\" name=\"userName\" value=\"\">
<textarea>标签
<textarea>标签用于生成一个文本区元素(text area element)。它必须包含和相关form bean中的相同属性对应的“property”属性。
比如: <html:textarea property=\"details\"
cols=\"80\"
rows=\"20\"
value=\"Enter details here\"/>
会被转换成: <textarea name=\"details\" cols=\"80\"
rows=\"20\">Enter details here</textarea>
<radio>标签
<radio>标签用于显示一个单选按钮(radio button)。它必须包含“value”属性。比如这段代码: <html:radio property=\"title\" value=\"1\"/>Mr.
<html:radio property=\"title\" value=\"2\"/>Ms.
<html:radio property=\"title\" value=\"3\"/>Dr.
会被转换成这样的HTML: <input type=\"radio\" name=\"title\"
value=\"1\">Mr.
<input type=\"radio\" name=\"title\"
value=\"2\">Ms.
<input type=\"radio\" name=\"title\"
value=\"3\">Dr.
<checkbox>标签
<checkbox>标签用于显示checkbox类型的输入区域。比如: <html:checkbox property=
\"notify\"/>Please send me notification
会被转换成: <input type=\"checkbox\" name=\"notify\"
value=\"on\">Please send me notification
<submit>标签
<submit>标签用于生成提交类型(type submit)的输入区域。比如: <html:submit value=\"Login\"/>
会被转换成: <input type=\"submit\" value=\"Login\">
<reset>标签
<reset>标签用于生成重置类型(type reset)的输入区域。比如: <html:reset/>
会被转换成: <input type=\"reset\" value=\"Reset\">
<option>标签
<option>标签用于显示select box中的一个选项。参照下面的<select>标签。
<select>标签
<select>标签用于显示一个包含零个或更多选项的HTML选择元素。它必须被嵌入一个<form>标签中才有效。下面这个例子将说明如何使用该标签: <html:select property=\"color\" size=\"3\">
<html:option value=
\"r\">red</html:option>
<html:option value=
\"g\">green</html:option>
<html:option value=
\"b\">blue</html:option>
</html:select>
摘自 http://blog.csdn.net/chensheng913/archive/2004/11/08/172664.aspx
No input attribute for mapping path
Structs 标签的用法
<logic:present name="greet" scope="request">
<bean:write name="greet" scope="request"/>
</logic:present>
<bean:write name="name" scope="request"/>
</logic:present>
先是错误信息
if (!errors.empty()) {
saveErrors(request, errors);
// 返回到初始表单
return (new ActionForward(mapping.getInput()));
}
返回当前页面。
Javascript 什么alert(window.dialogArguments.arr.returnValue);