才开始学,代码中有几句不是很理解,还请各位GG,JJ指教。

zhoulf 2003-04-03 11:33:02
才开始学,代码中有几句不是很理解,还请各位大哥指教。
1、HashMap parameterMap = new HashMap( request.getParameterMap() ) ;
2、HttpSession session = request.getSession( true ) ;
3、ServletContext sc ;
RequestDispatcher rd ;
sc = getServletContext( ) ;
rd = sc.getRequestDispatcher( pageName ) ;
rd.forward( newRequest, newResponse ) ;
...全文
94 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
tingod 2003-04-03
  • 打赏
  • 举报
回复
1、getParameterMap
public java.util.Map getParameterMap()
Returns a java.util.Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
Returns:
an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.

2、public HttpSession getSession(boolean create)
Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session.
If create is false and the request has no valid HttpSession, this method returns null.

To make sure the session is properly maintained, you must call this method before the response is committed. If the container is using cookies to maintain session integrity and is asked to create a new session when the response is committed, an IllegalStateException is thrown.

Parameters:
true - to create a new session for this request if necessary; false to return null if there's no current session
Returns:
the HttpSession associated with this request or null if create is false and the request has no valid session

3、这时一段转向语句,可以用来传递request值。例:
/** 重定向 */
public void redirect(HttpServletRequest request, HttpServletResponse response, String directory) throws ServletException, IOException {
RequestDispatcher redirectory = getServletContext().getRequestDispatcher(directory);
redirectory.forward(request,response);
}
zhoulf 2003-04-03
  • 打赏
  • 举报
回复
你还看懂一句嘛,说来听听社
DemonLeo 2003-04-03
  • 打赏
  • 举报
回复
看到现在没人跟贴,我来顶一下,你起点好高,3句只看懂了1句,脸特红,我还是跟你学得了。:)
kobeli 2003-04-03
  • 打赏
  • 举报
回复
我认为你的编程手法不可取!
foolbirds 2003-04-03
  • 打赏
  • 举报
回复
session对象存在于一个会话当中,如果有必要某个对象在会话中经常用到,当然这个方法是最好的
,也正是由于它存在于整个会话,所以会耗费资源。
cjt0226 2003-04-03
  • 打赏
  • 举报
回复
2、得到当前session对象,用这种方法,如果session不存在,会新建一个session对象,这种方法会耗费服务器资源,不可取;
那么应该用什么方法呢?
zhxx 2003-04-03
  • 打赏
  • 举报
回复
2.得到一个会话,如果不存在则创建

3 ServletContext 用于写日志或者分支处理请求时同servlet容器进行通信
RequestDispatcher 把请求导向服务器上的某个资源
sc = getServletContext( ) ; 从ServletConfig接口得到ServletContext对象
rd = sc.getRequestDispatcher( pageName ) ;返回指定资源的RequestDispatcher,参数
必须以"/" 开始,它相对于servlet根目录
rd.forward( newRequest, newResponse ) ;从一个servlet到另一个servlet或jsp,htm传递请求
shaopin 2003-04-03
  • 打赏
  • 举报
回复
1、返回一个哈希映射集合;
2、得到当前session对象,用这种方法,如果session不存在,会新建一个session对象,这种方法会耗费服务器资源,不可取;
3、转向语句,类同response.redirect()
zhoulf 2003-04-03
  • 打赏
  • 举报
回复
那位能帮我翻译一下吗,E文有点差。
内容概要:本文针对无刷直流电机驱动的电子机械制动(EMB)执行器,建立了考虑Stribeck摩擦特性的非线性耦合动力模型,并在Simulink环境中完成了系统级仿真分析。研究综合集成了电机动力、齿轮传动机构与制动执行机构的动力特性,构建了高保真的机电一体化系统模型。重点引入Stribeck摩擦模型以精确描述低速工况下执行器内部存在的静摩擦、粘滞摩擦与库仑摩擦之间的过渡行为,有效提升了系统在启停、反向运动等瞬态过程中的动态响应仿真精度。通过多工况仿真验证了模型的有效性,能够准确反映摩擦引起的爬行、滞后与定位误差等非线性现象,为EMB系统的高性能控制算法设计(如摩擦补偿、滑模控制)与结构优化提供了高可信度的仿真平台。; 适合人群:从事汽车电子制动系统、电机驱动控制、机电系统建模与仿真研究的研究生、科研人员及工程技术人员,需具备扎实的机械动力、自动控制理论基础和MATLAB/Simulink仿真能力。; 使用场景及目标:①用于高精度电子机械制动系统的设计验证与性能预测;②为消除摩擦非线性影响的先进控制策略(如自适应控制、智能控制)提供精确的被控对象模型;③深入探究Stribeck摩擦等非线性因素对系统动态性能(如响应延迟、稳态误差)的作用机理; 阅读建议:读者应结合提供的Simulink模型文件,深入剖析Stribeck摩擦模块的数实现与参数辨识方法,建议通过改变输入指令(如阶跃、正弦)和负载条件进行对比仿真,以直观理解非线性摩擦对系统动态特性的影响。

81,111

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧