调试exam工程心得
来源:互联网 发布:衬衣 网络品牌排行榜 编辑:程序博客网 时间:2024/06/03 20:09
1、超过一定的时间之后会发现点击一些页面,自动跳转到manage/lonin.jsp,通过查看可以看到如下代码:
manage/top.jsp
<%
//验证用户是否登录
if (session.getAttribute("manager")==null || "".equals(session.getAttribute("manager"))){
response.sendRedirect("login.jsp");
return;
}
%>
2、使用管理员登陆, 点击增加课程
原有代码manage/lession.jsp页面中:
<td width="10%"><a href="#" onClick="window.open('lesson_add.jsp','','width=292,height=175',)">添加课程</a> </td>
要在屏幕中间显示:
修改后代码如下:
<td width="10%"><a href="#" onClick="window.open('lesson_add.jsp','','width=292,height=175,top='+(window.screen.height-175)/2+',left='+(window.screen.width-292)/2+')')">添加课程</a> </td>
3、manage/questions_add.jsp页面如何实现 所属课程 所属套题 的二级联动的?
所属课程
<html:select property="lessonId" onchange="F_getTaoTi(this.value)">
<html:options collection="lessonList" property="ID" labelProperty="name"/>
</html:select>
利用Ajax来实现的,具体是:
(1)<script language="javascript" src="../JS/AjaxRequest.js">
</script>
里面代码分析:
了解一下面向对象的Javascript就能看懂了
实际上就是定义了一个类:net.AjaxRequest
初始参数有:url,onload,onerror,method,params
包含方法:loadDate,onReadyState,defaultError
(2)分别写
function F_getTaoTi(val){
var loader=new net.AjaxRequest("questions.do?action=queryTaoTi&id="+val+"&nocache="+new Date().getTime(),deal,onerror,"GET");
}
function onerror(){
alert("出错了");
}
function deal(h){
whichTaoTi.innerHTML=this.req.responseText;
}
(3)需要注意的是:整个流程是这样实现的:在questions_add.jsp,当所属课程做出选择后,触发 onchange="F_getTaoTi(this.value)",-—————》questions.java-----(设置属性taoTiList)--->selTaoti.jsp
deal进行处理,这时更新:所属套题。
(4)为了能够实时更新,需要更改body 的属性
<body onLoad="F_getTaoTi(questionsForm.lessonId.value)">
至此实现了二级联动功能。
4、<html:select property="lessonId" onchange="F_getTaoTi(this.value)">
<html:options collection="lessonList" property="ID" labelProperty="name"/>
</html:select>
collection 显示的集合:property值 (用于提交服务器) lableProperty 显示的值(仅显示)
5、selTaoti.jsp 中,
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
通过 taglib指令引用HTML标签库
6、
<action name="questionsForm" path="/manage/questions" scope="request" type="com.wgh.action.Questions" validate="true">
<forward name="questionsQuery" path="/manage/questions.jsp" />
<forward name="questionsAddQuery" path="/manage/questions_Add.jsp"/>
<forward name="questionsAdd" path="/manage/questions_ok.jsp?para=1" />
<forward name="questionsDel" path="/manage/questions_ok.jsp?para=3" />
<forward name="questionsModifyQuery" path="/manage/questions_Modify.jsp"/>
<forward name="questionsModify" path="/manage/questions_ok.jsp?para=2" />
<forward name="queryTaoTi" path="/manage/selTaoTi.jsp"/>
<forward name="setSMOption" path="/manage/setSMOption.jsp"/>
<forward name="error" path="/manage/error.jsp" />
</action>
其中的 <action>
name 代表: 指定表单Bean(ActionForm)的名称。;
path :指定此Action所响应的用户请求的路径,这个属性是与模块相关的,并且以“/”为起始字符。另外,需要注意的是在这里不需要增加扩展名,如:.do
scope:
用于指定保存ActionForm的上下文范围。其取值为request或session。
type:
用于指定处理用户请求的Action(org.apache.struts.action)之类的全路径名。如果指定了forward或者include属性,那么这个属性将不起作用
validate:
用于设置是否调用ActionForm中的validate()方法来进行数据合法性的校验。
--------------------------------------------------------------------------------
<forward name= path=>分别代表转发标识,转发路径
7、SelfRequestProcessor,来处理中文,同 ElectricShopping项目处理方法相同。oa项目使用的是 myfilter类来处理中文乱码问题
只是声明的地方在web.xml中
<filter>
<filter-name>myfilter</filter-name>
<filter-class>com.struts.filter.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>myfilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
exam中的SelfRequestProcessor在 struts.config.xml中来声明:
<controller processorClass="com.wgh.action.SelfRequestProcessor" />
- 调试exam工程心得
- 调试exam工程续2
- 调试luntan工程心得
- java工程调试心得
- 调试exam续一
- 工程心得
- 调试心得
- 调试心得
- 调试心得
- exam
- Exam
- 工程实施负责人心得
- ASP.NET调试心得.......
- VC6 调试心得
- 调试的一点心得
- VS 调试心得
- OV7670调试心得
- 调试论坛系统心得
- ATM Business Consolidation is Running Rampant_1718
- 换一种态度看程序员
- sql server 2008中的备份压缩特性
- 数据库DBA复习日志-系统全局区
- php中对象的unset。
- 调试exam工程心得
- 浅谈 JavaScript 编程语言的编码规范
- 获得java项目路径的方法
- web打包相关
- hell0 people
- 表主键排序和离散数据查询的速度测试
- 学习 ExtendedWebBrowser2 (1) 源资料
- 忙并快乐着!充实其实也是一种快乐!
- 直接路径插入表/*+append*/ 直接插入数据的速度测试