当前位置:文档之家› WebDypro两个页面之间传值

WebDypro两个页面之间传值

WebDypro两个页面之间传值
WebDypro两个页面之间传值

WebDypro两个页面之间传值

WebDynpro for ABAP TM

Scenario: To create and run a simple WebDynpro Application. We would accept an input value from the user on first screen and display the value entered on the second screen.

Note:Please refer to the SAP? help for detailed information of the components used in this document.

Procedure:

1.Go to transaction SE80. Please note that there is no separate

transaction for creation of WebDynpro application other than SE80.

2.Select “WebDynpro Comp./Intf” from t he list (as shown below)

3.Create a new WebDynpro component by the name ZSAPTECHNICAL_DEMO.

Assign it to the local object.

4.Right click on the WebDynpro component “ZSAPTECHNICAL_DEMO” and

create a view.

Save the application

5.Double-click on the COMPONENTCONTROLLER.

6.Check if the application is in change mode.

7.Create a node as shown below:

8.Create an attribute for the node as shown below:

Save the application.

9.Double-click on the view, FIRST_VIEW, created earlier.

In this step, we would be designing the first screen of our application with the following elements:

?Label for the input field

?Input field

?Button (for Submit)

Drag and drop the element “Label” onto the layout.

After dragging and dropping onto the layout, change the text of the “Label” to “Username” in the right side bottom of the window.

Now drag and drop the “input field” onto the layout.

Now click on the Label element created earlier and set the property of “LabelFor” to “INPUT_FIELD”.

Finally, drag and drop the element “Button” on to the layout.

In the properties window of the Button, do the following:

Change the text to “Submit”

Click on “Create” for the property “OnAction”.

Enter the Action and the Outbound Plug name.

Press “OK” for the creation prompt of Outbound Plug.

Click on “Context”tab. Drag and drop the Node on the right side to the context on the left side.

Click on ‘YES’ for the prompt for the node to copied and mapped.

Save the application.

Click on Layout tab now.

Double-cl ick on the “Input_field” and in the properties:

a)For the property “Value”, select the attribute “Name” by

clicking on the binding button.

We are done with designing of the first screen.

10.In this step, we would design the second screen of our application.

Right-Click on the WebDynpro component and create another view, SECOND_VIEW.

Create a label, “Entered Name” as mentioned in the earlier step.

We would display the value entered on the first screen in an element called “text view”.

Drag and drop the element “Text View” onto the layout.

Click on “Context” tab and map the nodes as in our earlier step.

Go to Tab “Inbound Plugs” and create an inbound plug as shown below:

Go back to the layout now.

Now double-click on the element “TextView” to open the properti es. For the property “Text”, click on the binding button and select “Name”

11. In this step, we would embed the above created views in the window

created in the first step.

a)Double-click on the window “MAIN_WINDOW”.

b)Right-click on the window name and select “EMBED VIEW”.

c)Embed both the views created earlier. Do not select the view

“EMPTYVIEW” which is created by default.

d)Expand the tree.

e)Now right-click on “SUBMIT” and select “Create Navigation”.

f)Select “SECOND_VIEW” for the des t.view.

g)Now select the FIRST_VIEW and make it as default.

Save and activate the application (When activating, select all the six components related to this webdynpro application. If all six components are activated, only then your application executes)

Now your application is ready to execute. Lets look at the method of testing this application.

Testing your WebDynpro Component

1.Right-click on the WebDynpro Component and create WebDynpro

Application.

2.Without changing any values, press SAVE.

3.Execute your WebDynpro application.

页面之间传递值的几种方式.doc

一.使用QueryString 使用QueryString在页面间传递值是一种非常常见的方法,我们在ASP中就常常用到。 (1)优点和缺点优点: 优点:1.使用简单,对于安全性要求不高时传递数字或是文本值非常有效。 缺点:1.缺乏安全性,由于它的值暴露在浏览器的URL地址中的。 2.不能传递对象。 (2)使用方法 1.在源页面的代码中用需要传递的名称和值构造URL地址。 2.在源页面的代码用Response.Redirect(URL);重定向到上面的 URL地址中。 3.在目的页面的代码使用Request.QueryString["name"];取出 URL地址中传递的值。 (3)应用举例 1.源页面*.aspx的代码: private void Button1_Click(object sender, System.EventArgs e) { String urlAddress; string Name1; string Name2; string Name3; string Name1Value = "HelloName1"; int Name2Value = 1234567; string Name3Value = "你好名称3"; urlAddress="destinationWebForm.aspx?Name1=" + Name1Value + "&" + "Name2=" + Name2Value.ToString() + "&" + "Name3=" + Name3Value; Response.Redirect(urlAddress); } 2.目的页面destinationWebForm.aspx的代码: private void Page_Load(object sender, System.EventArgs e) { String myName1Value; int myName2Value; string myName3Value; myName1Value = Request.QueryString["Name1"]; myName2Value=Convert.ToInt32(Request.QueryString["Name 2"]); myName3Value = Request.QueryString["Name3"]; } (4)可能出现的问题1在处理Resonse.QueryString函数汉字参数传递时,发生不能完整传递参数的具体值的错误,解决有两个方法。

JSP页面间传递参数方法介绍txt

JSP页面间传递参数是经常需要使用到的功能,有时还需要多个JSP页面间传递参数。下面介绍一下实现的方法。 (1)直接在URL请求后添加 如:直接传递参数< /a> 特别的在使用response.sendRedirect做页面转向的时候,也可以用如下代码: response.sendRedirect("thexuan.jsp?action=transparams&detail=directe") ,可用request.getParameter(name)取得参数 (2)jsp:param 它可以实现主页面向包含页面传递参数,如下: 还可以实现在使用jsp:forward动作做页面跳转时传递参数,如下: < jsp:forward page="Relative URL"> < jsp:param name="paramname" value="paramvalue" /> < /jsp:forward> 通过这种方式和一般的表单参数一样的,也可以通过request.getParameter(name)取得参数 (3)设置session和request 通过显示的把参数放置到session和request中,以达到传递参数的目的 session.setAttribute(name,value); request.setAttribute(name,value) 取参数: value=(value className)session.getAttribute(name); value=(value className)request.getAttribute(name); 大家肯定已经注意到了,在取参数的时候,做了类型转换,这是因为放置在session和request 中的对象的属性被看作https://www.doczj.com/doc/4f12524432.html,ng.Object类型的了,如果不转换,在将直付给value时会报classcastexception异常。 在多个JSP页面之间传递参数 1. 怎么在多个JSP页面之间进行参数传递?需要使用JSP的内置作用域对象session。利用它的两个方法setAttribute(),getAttribute() 2. 下面的这个实例实现了把第一个JSP页面的参数传递给第三个页面的功能

C#页面间传值的几种方法

1。使用QueryString 使用QuerySting在页面间传递值已经是一种很老的机制了,这种方法的主要优点是实现起来非常简单,然而它的缺点是传递的值是会显示在浏览器的地址栏上的(不安全),同时又不能传递对象,但是在传递的值少而安全性要求不高的情况下,这个方法还是一个不错的方案。使用这种方法的步骤如下: 1,使用控件创建web表单(form) 2,创建可以返回表单的按钮和链接按钮 3,在按钮或链接按钮的单击事件里创建一个保存URL的字符变量 4,在保存的URL里添加QueryString参数 5,使用Response.Redirect重定向到上面保存的URL 下面的代码片断演示了如何实现这个方法: 源页面WebForm1.aspx.cs中的部分代码: private void Button1_Click(object sender, System.EventArgs e) { string url; url="WebForm2.aspx?name=" + TextBox1.Text + "&email=" + TextBox2.Text; Response.Redirect(url); } 目标页面WebForm2.aspx.cs中的部分代码: private void Page_Load(object sender, System.EventArgs e) { Label1.Text=Request.QueryString["name"]; Label2.Text=Request.QueryString["email"]; } 2。使用Session变量 使用Session变量是可以在页面间传递值的的另一种方式,在本例中我们把控件中的值存在Session变量中,然后在另一个页面中使用它,以不同页面间实现值传递的目的。但是,需要注意的是在Session变量存储过多的数据会消耗比较多的服务器资源,在使用session时应该慎重,当然了,我们也应该使用一些清理动作来去除一些不需要的session来降低资源的无谓消耗。使用Session变量传递值的一般步骤如下: 1,在页面里添加必要的控件 2,创建可以返回表单的按钮和链接按钮 3,在按钮或链接按钮的单击事件里,把控件的值添加到session变量里 4,使用Response.Redirect(或Server.Transfer)方法重定向到另一个页面5,在另一个页面提取session的值,在确定不需要使用该session时,要显式清除它 下面的代码片断演示了如何实现这个方法: 源页面WebForm1.aspx.cs中的部分代码: private void Button1_Click(object sender, System.EventArgs e) {

ASP页面传值

https://www.doczj.com/doc/4f12524432.html,页面之间传递值的几种方式 页面传值是学习https://www.doczj.com/doc/4f12524432.html,初期都会面临的一个问题,总的来说有页面传值、存储对象传值、ajax、类、model、表单等。但是一般来说,常用的较简单有QueryString,Session,Cookies,Application,Server.Transfer。 一、QueryString QueryString是一种非常简单的传值方式,他可以将传送的值显示在浏览器的地址栏中。如果是传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法。但是对于传递数组或对象的话,就不能用这个方法了。 这种方法的优点:1.使用简单,对于安全性要求不高时传递数字或是文本值非常有效。 这种方法的缺点:1.缺乏安全性,由于它的值暴露在浏览器的URL地址中的。 2.不能传递对象。 使用方法:1.在源页面的代码中用需要传递的名称和值构造URL地址。 2.在源页面的代码用Response.Redirect(URL);重定向到上面的URL地址中。 3.在目的页面的代码使用Request.QueryString["name"];取出URL地址中传递的值。 例子:(1)a.aspx private void Button1_Click(object sender, System.EventArgs e) { string s_url; s_url = "b.aspx?name=" + Label1.Text; Response.Redirect(s_url); } (2)b.aspx private void Page_Load(object sender, EventArgs e) { Label2.Text = Request.QueryString["name"]; } 二、Session 想必这个肯定是大家使用中最常见的用法了,其操作与Application类似,作用于用户个人,所以,过量的存储会导致服务器内存资源的耗尽。 优点:1.使用简单,不仅能传递简单数据类型,还能传递对象。 2.数据量大小是不限制的。 缺点:1.在Session变量存储大量的数据会消耗较多的服务器资源。 2.容易丢失。 使用方法:1.在源页面的代码中创建你需要传递的名称和值构造Session变 量:Session["Name"]="Value(Or Object)"; 2.在目的页面的代码使用Session变量取出传递的值。Result = Session["Nmae"]

几种JSP页面传值方式 八

几种JSP页面传值方式八 2010-01-25 几种JSP页面传值方式: 文章分类:Web前端 几种JSP页面传值方式: 1. 隐藏域传值: <form method="post" action="client_crud.jsp" > <input type="hidden" name="id" value="<%=id %>"> 2. URL传值: 用button a. <input name="btnModify" type="button" class="button1" onClick="self.location='client_modify.jsp?id=<%=id %>'" value="修改分销商" /> b.把input的onClick=”modifyRegion()” function modifyRegion() { window.self.location = client_node_modify.jsp?id=<%=id%>"; } 3. JS方式传值 //取得form对象提交表单 with(document.getElementById("userForm")) { method="post"; action="user_add.jsp?command=add"; submit(); } function searchItem() { with(document.forms[0]) { action="servlet/basedata/SearchItemServlet"; method="post"; submit(); } } ---------------------------------------------------------------------------------------------------------------------------------------

JSP与 servlet之间的传值

这几天做了一个项目,大量用到了JSP与servlet之间的传值,总结了一下 JSP与servlet之间的传值有两种情况:JSP -> servlet, servlet -> JSP. 通过对象request和session (不考虑application)完成传值. 一、JSP -> servlet JSP页面有3种方法向servlet传值:form表单、URL 、其他 ... <%...... session.setAttribute("testSession","Hello session"); reqeust.setAttribute("testRequest","Hello request"); %> click me

... 1、对于该JSP页面form表单的内容,如标签,在servlet可用request.getParameter("username");获取. 2、URL:比如这里的标签的href属性与
标签的action属性的值"JspServlet?action=toServlet",在servlet同样用request.getParameter("action")获取;所要注意的是这里的url 要和servlet在web.xml里的标签的路径所对应.这部分后面会提到. 3、java片段代码,servlet只能接到session.setAttribute("testSession","Hello session")的内容,而接不到request的内容.在servlet里用request.getSession().getAttribute("testSession")获

Jsp页面传参的4种常用方式

Jsp页面传参的4种常用方式 来源:未知更新时间:2010-06-27 点击: 266次 jsp页面之间传递参数的方式有很多种,今天为大家总结常用的4种传参方式。 1.JavaScript传参:这种传参方式用opener关键字, 可以实现跨页传参.其用法就是用opene r关键字调用父窗体的一个组件. 举例: opener.myform.txt.value = document.myform.txt.value; 优点: 简单,对网络传输限制比较底. 缺点: 不灵活,对与大量的传参不现实,也不实际. 2. " ? "传参: 在传递地址的尾部加上? 后面跟参数的名字和其值,在另外一个Jsp页面中就可以用request.getParameter("参数名字");获取到传递的参数. 举例: http://localhost:8080/bbs/tiezi/jishu.jsp?id=1 优点: 灵活,只要把需要传递的参数放到一个变量中传递到传递的也面就可以了. 缺点: 对于批量传参也不现实. 3. session传参:通常把它用来实现状态维持.session中有2个参数,第一个为标识,第二个为值,形式("key","value") 如果你的思维敏捷,就能联想到散列表,对它就是散列表的一种实现. 应用举例: session.setAttribute("login","ok"); session.getAttribute("login"); 优点: 不用关心是什么数据类型,都可以放到session中,它以对象的形式存储于散列表中. 缺点: session中把所有数据当成对象来存取,所以每次我们用它的时候都要把类型强制转换为我们需要的类型. 4. JavaBean传参: 这是最高级的一种传递参数,它把任何数据类型,任何方式封装在JavaB ean中.我们在属性中定义需要传递的参数,然后加入一个get和set方法就可以了,在Jsp 中调用的时候可以设置其生命周期,完成传递参数的过程. 应用举例: package bean; public class sampleBean

Matlab多窗口传值问题(GUI)

Matlab多窗口传值问题(GUI) (上传者说明:此文是转载的) 2009-02-05 13:16 %by dynamic % %For more information,see also % %https://www.doczj.com/doc/4f12524432.html,——中国最大的数学工具软件联盟论坛 % %https://www.doczj.com/doc/4f12524432.html,——专业、优秀和权威的MATLAB技术交流平台 % %Email:matlabsky@https://www.doczj.com/doc/4f12524432.html, 1.直接传递 当要在一个matlab中的.m文件打开一个新窗口时候,可以直接传递例如有两个窗口 A.fig/A.m 和 B.fig/B.m 在 A.m中 B(var1) ; 即可传入参数 那么在B中这样获取即可: if length(varargin)==1 some_var= varargin{1}; end 2.通过output属性传回 在A.m中 some_var=B(var1); 也就是 B还需要返回值。 那么在B中就需要设置handles的output值了 function varargout = B_OutputFcn(hObject, eventdata, handles) varargout{1} = some_var_in_figure_B;

3. 几个重要的函数 1.getappdata(h,'Name'); 获取窗口句柄为h中的'Name'变量 2.setappdata(h,'Name',value);设置窗口句柄为h中的'Name'变量为Value 3.isappdata(h,'Name'); 判断h句柄下面有无‘Name’的变量 4.rmappdata(h,'Name');删除h句柄下面‘Name’的变量 5.guidata(h); 获取窗口句柄为h的 handles结构 6.guidata(h,handles); 设置窗口句柄为h的handles结构为handles 7.guihandles(h) 生成handles结构 说明: 关于appdata的几个函数是最基本的,每个figure都可以有几个很多appdata,setappdata(0,'Name',value) 当设置句柄为0时,表示整个Matlab 共享的数据域,任何figure都可以访问。这也可以成为数据传递的另一种方式。 handles是我们在GUI的m文件经常看到的东西,为什么会有guidata呢?那是因为一个figure对象下面可能有很多其他的对象,例如 edit axes slider 等等,为了将这些东西组织起来供用户方便的访问,matlab特地的添加了这个数据结构,它包括改figure所有的控件。你可以直接访问 使用 guihandles(h) 可以生成 hanles结构,它包含 h 中的所有控件,其中h 可以从fig文件load进来。 guidata(h) 返回 matlab默认给这个 figure生成的 handles结构。 guidata(h,handles) 是修改 h (如果是一个figure) 或者 h 的父figure 的handles值。 它会不停的向上查找 h的parent ,直到为figure,然后便修改其handles值。 4.句柄概念 个人认为,句柄就是相当于指针的意思,在Matlab中,每一个GUI对象都有一个handle,他们都是一些小数或者整数,Matlab能够保证这些数字不重复,因此通过这个句柄就可以访问或者修改你的对象。 通过传递句柄的方式可以修改传递的值的内容,而传递变量就做不到,这点和C语言的指针类似。

Aspnet页面中常用的几种传值方式

1. 使用QueryString变量 QueryString是一种非常简单的传值方式,他可以将传送的值显示在浏览器的地址栏中。如果是传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法。但是对于传递数组或对象的话,就不能用这个方法了。下面是一个例子: a.aspx的C#代码 private void Button1_Click(object sender, System.EventArgs e) { string s_url; s_url = "b.aspx?name=" + Label1.Text; Response.Redirect(s_url); } b.aspx中C#代码 private void Page_Load(object sender, EventArgs e) { Label2.Text = Request.QueryString["name"]; } 2. 使用Application 对象变量 Application对象的作用范围是整个全局,也就是说对所有用户都有效。其常用的方法用Lock和UnLock。 a.aspx的C#代码 private void Button1_Click(object sender, System.EventArgs e) { Application["name"] = Label1.Text; Server.Transfer("b.aspx"); } b.aspx中C#代码 private void Page_Load(object sender, EventArgs e) { string name; Application.Lock(); name = Application["name"].ToString(); Application.UnLock(); } 3. 使用Session变量 想必这个肯定是大家使用中最常见的用法了,其操作与Application类似,作用于用户个人,所以,过量的存储会导致服务器内存资源的耗尽。 a.aspx的C#代码 private void Button1_Click(object sender, System.EventArgs e) { Session["name"] = Label.Text;

前台后台传送和接收值的方法

在web窗体中的处理方法: .aspx 页面代码: <%@page language=”C#” AutoEventWireup=”true” CodeBehind=”_default.aspx.cs” Inherits=”Exercise._default”%>

.aspx.cs 页面代码: Namespce Exercise { Public partical class _default:System.Web.UI.Page { Public string name; Public string id; Public string sex; Protected void Page_Load(Object Sender,EventArgs e) { } } } 1、用post()方法传递过来的值: String name=Request.Form[“name”].ToString()==null?Request.Form[“name”].ToString()+””: Request.Form[“name”].ToString(); 2、用GET()方法传递过来的值: String name= Request.QueryString[“name”] ==null? Request. QueryString [“name”] +””: Request. QueryString [“name”];

winForm两个Form窗口之间的传值

首先定义两个Form,一个为Form1,一个为Form2,其中Form1作为父窗口,Form2作为子窗口 1、父窗口传值给子窗口 Form1中代码: public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 lForm = new Form2();//实例化一个Form2窗口 lForm.String1 = "传值给子窗口Form2成功";//设置Form2中string1的值 lForm.SetValue();//设置Form2中Label1的 lForm.ShowDialog(); } Form2中代码: private string string1; public string String1 { set { string1 = value; } } public void SetValue() { https://www.doczj.com/doc/4f12524432.html,bel1.Text = string1; } public Form2() { InitializeComponent(); } 2、子窗口返回值给父窗口 Form1中代码:

public Form1() { InitializeComponent(); } private string strValue; public string StrValue { set { strValue = value; } } private void btnShowForm2_Click(object sender, EventArgs e) { Form2 lForm = new Form2(); lForm.Owner = this;//重要的一步,主要是使Form2的Owner指针指向Form1 lForm.ShowDialog(); MessageBox.Show(strValue);//显示返回的值 } From2中代码: public Form2() { InitializeComponent(); } private void btnClose_Click(object sender, EventArgs e) { Form1 lForm1 = (Form1)this.Owner;//把Form2的父窗口指针赋给lForm1 lForm1.StrValue = "子窗口Form2返回数值成功";//使用父窗口指针赋值this.Close(); }

https://www.doczj.com/doc/4f12524432.html,页面之间的数据传递与保持7页word

ASP页面之间的数据传递与保持 页面之间数据的传递与保持是实现网站与用户交互的重要手段之一,也是Web应程序的基本功能,它的实现效率对程序性能有直接的影响。ASP 提供了多种方法来实现数据的传递与保持,这些方法各有所长。以下对常用的几种方法做阐述。 一、数据在页面间的传递 在用户访问网站的过程中,页面之间的跳转总是非常频繁。用户通常点击页面上某个超链接而进入网站其它页面,也有可能点击某个按钮提交信息从而打开了目标页面,甚至是网页程序在某个条件达成时自动的页面重定向。无论哪种情况使得用户浏览时换了页面,都不能丢了用户的状态,也就是在用户本次访问网站过程中,其状态应该是连续的,有些数据必须在页面之间传递下去,以供目标页面获取。 目标页面可以通过Request对象来获取源页面传来的数据。 1.Request.QueryString QueryString是最简单最常用的传值方法,它能够获取HTTP查询字符串附在URL后面的参数值: URL?参数名1=参数值&参数名2=参数值...... 而以URL方式进行页面转换有以下几种: 超链接:<a>标记的href属性或控件HyperLink的NavigateURL 设置URL后面可以连接参数; 控件Button的postbackURL属性可以设置目标页面URL,后面可以连接参数;

表单数据以get方法发送给指定的目标URL,会将控件值作为参数连接在URL后面,参数名就是控件名或控件ID,参数值就是控件的值; Response对象的Redirect方法可以设置参数URL,使客户端浏览器立即重定向到指定的URL; Session对象的Transfer方法可以设置参数URL将客户端重定向到新的页面,它终止当前页的执行,保留当前页面的表单(Form)数据和查询字符串(QueryString),并为当前请求开始执行URL指定的目标页面,而源页面已加载的数据依然保存。 Session对象的Execute方法可以设置参数URL将客户端重定向到新的页面,它暂停当前页的执行,并为当前请求开始执行URL指定的新页面,然后再回到源页面继续运行。 当然,用户在浏览器的地址栏输入URL时也可以直接传递参数。 通过查询字符串传递的数据直接在URL中以明文传递,对用户是可见的,虽然可以加密。此方法简单、方便,但是传递的数据量少,且不能传递对象。这种方式传递的数据,在目标页面可以用Request.QueryString 获取: Request.QueryString[“参数名”] 2.Request.Form Request.Form获取客户端传递的表单数据集,即页面表单以post方法发送的数据。该方法可以传递大量数据,访问源页面表单控件中的数据。 使用以上方法都可以实现数据在页面之间的传递,但是这个数据仅能在指定的URL页面才能获取到,也就是说生命周期仅限于当前请求。如果

c# 两个WIN程序窗口间传递参数的方法【转】

方法一: C#中没有了像https://www.doczj.com/doc/4f12524432.html,中的全局变量,那么我们如何实现在不同的页面间传递参数呢? 下面举例说明如何实现这一功能. 1.新建一个项目. 2.在该工程中添加一个窗体Form1. 3.在该窗体中定义静态型字符串变量myTestStr1: public static string myTestStr1=""; 4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类添加属性GetStrValue. public Form_Form1() { InitializeComponent(); myTestStr1="Hello!"; } public string GetStrValue { get { return myTestStr1; } set { myTestStr1=value; } } 5.在该工程中另添加一个窗体Form2. 6.在Form1窗体上添加一个button按钮(name:but_Test); 7.在Form1窗体的but_Test_Click 事件中添加以下代码: private void but_Test_Click(object sender, System.EventArgs e) { Form2 frm1=new Form2(); frm1.ShowDialog(this) ; frm1.Close(); } 8.在Form2窗体上添加一个button按钮(name:but_Yes); 9.在Form1窗体的but_Yes_Click 事件中添加以下代码: private void but_Yes_Click(object sender, System.EventArgs e) { MessageBox.Show (Form_Form1.myTestStr1 ); //直接访问. 显示.结果:" Hello!"

JSP页面跳转大全

JSP页面跳转大全 https://www.doczj.com/doc/4f12524432.html,/yuxiangtong0524@126/blog/static/8008616320103215348290/JSP中的跳转:(1). forward()方法 使用到javax.servlet.RequestDispatcher类 RequestDispatcher rd = getServletContext().getRequestDispatcher("url"); rd.forward(requestVar,requestVar); //传递servlet的入口参数 /*forward函数已经把原页面的request,response对象传入新的页面,因此这新旧页面拥有相同的request,response对象。request.getparameter("var")就可以得到相应的值.*/ /*forward()是直接在server做的,浏览器并不知道,也不和浏览器打交道,浏览器的地址不变化。*/ 即: getServletContext().getRequestDispatcher("url").forward(requestVar,responseVar); 服务器端Servlet进行转向的4种方法: 1.ServletContext的getRequestDispatcher() 2.ServletContext的getNamedDispatcher() 3.ServletRequest的getRequestDispatcher() 4.ServletResponse的sendredirect()进行转向。 forward方法,因为这些这样比较高效。只有在forward方法不能使用时,再使用servletresponse的sendredirect()方法。 (2).response.sendRedirect(url); 其实是向浏览器发送一个特殊的Header,然后由浏览器来做转向,转到指定的页面,所以用sendRedirect时,浏览器的地址栏上可以看到地址的变化。新页面不能处理旧页面的pagecontext (request,response,...)对象. 在response.sendRedirect之后,应该紧跟一句return; (3).HTML语言的自动跳转 0是等待时间,如果设置为5表示等待5s后开始跳转 ………… (4).JavaScript跳转 A: B: 也可以直接给window.location属性赋值,window.location="url",与A不同的是有历史记录 C: 对于document,location不是不是对象,document.location=document.url

WebDypro两个页面之间传值

WebDypro两个页面之间传值 WebDynpro for ABAP TM Scenario: To create and run a simple WebDynpro Application. We would accept an input value from the user on first screen and display the value entered on the second screen. Note:Please refer to the SAP? help for detailed information of the components used in this document. Procedure: 1.Go to transaction SE80. Please note that there is no separate transaction for creation of WebDynpro application other than SE80. 2.Select “WebDynpro Comp./Intf” from t he list (as shown below) 3.Create a new WebDynpro component by the name ZSAPTECHNICAL_DEMO.

Assign it to the local object. 4.Right click on the WebDynpro component “ZSAPTECHNICAL_DEMO” and create a view.

asp传递参数的几种方式

dskhglname 把下列代码分别加入a.asp和b.asp的中,点提交,就可以将a.asp 文本框的内容传给b.asp并显示出来 a.ASP

B.asp <% Response.Write(Trim(Request.QueryString("ABC"))) %> 一种是GET传值就是网页上通常看到的 1.asp?name=2 然后你在第二个页面使用 request.querystring("name")获取到地址栏的值 第二章是POST传值你也可以在表单中添加一个隐藏域或者文本域之类的比如 input type="hidden" value="<%=rs("name")%>" 表单提交到2.asp后在2.asp页面使用request.form("name")获取到表单的name asp传递参数的几种方式 最近又用到ASP,查看了以下以前的学习时记的笔记.然后总结了一下ASP传递参数的一些方法 1.用户端用http信息数据传送到服务器 在表单的action属性设置为提交到的asp文件。
method= get:使用“输入数据= Request.QueryString("字段名")",将附加于URL的数据取出。

页面间数据传递方式

页面间数据传递方式 2008-08-24 14:09:59| 分类:默认分类| 标签:|字号大中小订阅 转自:https://www.doczj.com/doc/4f12524432.html,/plus/view.php?aid=4140&tid=55 在网页编程(如php,asp)中常常涉及到页面之间值的传递接收问题。它是网页编程中一项基本的重要的必须掌握的知识点。它包括页面间值传递方式有哪些,哪些变量会传到目的页面,这些变量的值是什么,以及在目的页面中如何接收这些变量的值这些问题。深刻了解这些知识内容,对灵活地实现编程效果是很重要的。 首先,我来讲一下网页间值传递方式。 在有些书上把页面之间值传递按表单传递分get和post两种方式。我认为这样分不完整,不全面。而我根据自己的一些经验把网页之间值的传递归分为显现式和隐含式两种方式觉得这样更确切。 所谓显现式就是值在传递到目的页面的过程时,在浏览器的地址栏中页面地址后面会显示这些变量参数。隐含式方式参数是不会出现地址栏上的,所以具有安全性。 如果要传如下表(变量表1)的变量传到目的页面。 变量名:first idname password 值:yes baorongabc 12345 ―――――――――――表变量表1―――――――――――――――――――――― 那么如何用显现式和隐含式实现呢?下面就是具体实现方法: 显现式: 1 在程序中写入,如: 文章发表 2.通过表单递交的get方式 此方式当按钮被按下后,表单的数据会附加在网址之后一起送到server。执行效率高,但可传送的数据只有2k左右。 程序如下程序代码(程序1): 标签中代码: 单行文本框first的html代码: 单行文本框idname的html代码: 单行文本框password的html代码: 标准按钮html代码: 隐含式:

相关主题
文本预览
相关文档 最新文档