Passing a PLL Package Public Variable to an .mmb
I have a PLL that contains, amongst other things, 2 packages. The first package has a publicly declared boolean variable. The second package is called when the user chooses an item from the menu.
This second package then sets this boolean variable to false, resets it to True and then calls a key trigger in the form (simplified). Immediately on arriving at this key trigger in the form, the variable has a value of False, when it should be True.
This does not occur when calling the second package from an icon within the form, as opposed to calling it from a menu.
Any ideas why? I have tried endlessly to debug this and cannot get anywhere. Any help would be much appreciated.
Richard
I believe you should have the option "Share library with form" for the menu set to "Yes".
As for me, when it comes to code triggered by menu choices, I usally have a run_product or execute_trigger, thus avoiding to refer items, blocks &c. in the form from within the menu code.
If the first suggestion won't give the desired results, the second has to.
Regards,
BD
Similar Messages
-
Referencing package public variables remotely
According to Oracle 8i documentation, its not possible to reference - directly or indirectly - package global public variables remotely. This implies the construct <package_name>.<public_variable_name>@<remote_database> doesn't work. The only way possible is to create public functions in the remote package to return the value of the variable. (e.g. function return_variable return <public_variable_name>%type is begin return <public_variable_name>; end;)
Can anyone please confirm this, otherwise suggest any other simpler way of accessing remote package variables?
Thanks.Rahul,
No unfortunately you can't get at them, nor can you get any constants. It sure would be a good thing if you could, but I use the following to get around this problem as getting global variables and constants is a very important thing. This method I've shown below actually works pretty slick and it uses a remote function and a view to get the job done.
I actually like how this works better than calling a variable/constant directly. The example below I just did up, but it shows the basic idea. Basically you put a number beside your var/const as a comment marker. I usually use a sequence to keep track of the numbers I've assigned. A test package was made that has 1 variable and 1 constant. A function is made that gets these values. A view is made that calls this function and returns ALL of the variable and constant values. You can take this even further and have it return the actual variable/constant name itself as well.
I like doing it this way as you now only have ONE entry point (the view) to get as many variables/constants as you like, even if spread across multiple packages. I have my own code that does all of this, but the example below gives you an idea of how to make one yourself. Remember this is just a simple example, you can make it so you don't have to do the union in the view, and you can make the function return more things if you like, but I'm kinda short on time so my example is pretty simple, but it works quite well.
The following is from the Oracle docs telling you about trying to get remote values ...
--[START]
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/appdev.901/a88876/adg10pck.htm#2501
Remote Procedure Calls and Parameter Values
You must explicitly pass values to all remote procedure parameters, even if there are defaults. You cannot access remote package variables and constants.
--[END]
Ok here's the code and some output ...
--[START]
CREATE OR REPLACE PACKAGE PKG_TEST
AS
--[NOTE] : see the comment number markers below, these stay fixed even though they are just comments
GI_VAR_ONE NUMBER := -100; --[1]
GI_CONST_ONE CONSTANT NUMBER := -200; --[2]
END;
Package created.
CREATE OR REPLACE FUNCTION FN_TEST(VAR_POSITION NUMBER)
RETURN NUMBER
AS
LI_RETURN NUMBER := 0;
BEGIN
IF VAR_POSITION = 1 THEN
LI_RETURN := PKG_TEST.GI_VAR_ONE;
ELSIF VAR_POSITION = 2 THEN
LI_RETURN := PKG_TEST.GI_CONST_ONE;
END IF;
RETURN LI_RETURN;
END;
Function created.
CREATE OR REPLACE VIEW V_TEST
VAR_POSITION,
VAR_VALUE
AS
SELECT 1,FN_TEST(1) FROM DUAL
UNION
SELECT 2,FN_TEST(2) FROM DUAL;
View created.
SELECT * FROM V_TEST;
VAR_POSITION VAR_VALUE
1 -100
2 -200
begin
PKG_TEST.GI_VAR_ONE := -123;
end;
PL/SQL procedure successfully completed.
Commit complete.
select * from v_test;
VAR_POSITION VAR_VALUE
1 -123
2 -200
--[END]
Enjoy :)
Tyler D. -
Avoid Global Public variables...
Hello Experts,
I have declared few variables in package specification (l_test , l_test_2)and i'm using across the API procedures.
But when i run the TOAD expert it says "Avoid defining global public variables in the package specification."
So i thought of moving the code from package specification to package body...
Is this a good approach and will my code work as it was working before if i declare in the body...
Plz suggest ...
Thanks...
Earlier
Package Specification Part
CREATE OR REPLACE PACKAGE PKG_TEST
AS
l_test NUMBER(1);
l_test_2 NUMBER(2);
END;New
CREATE OR REPLACE PACKAGE BODY PKG_TEST
AS
l_test NUMBER(1);
l_test_2 NUMBER(2);
PROCEDURE process
IS
END process ;
PROCEDURE process_2
IS
END process_2 ;
END PKG_TEST;Linus,
Just so you are aware, the scope of those variables are different depending on if they are defined in the PACKAGE (SPEC) or PACKAGE BODY.
Declared in the PACKAGE (Spec): Globally accessible to everything on the Schema.
Declared in the PACKAGE (Body): Globally accessible to everything with that particular Package.
So as you can see, this quite a big difference. TOAD is warning you because putting globals in the PACKAGE is a pretty sloppy coding practice that can easily lead to difficult to maintain code. While you can ignore it, I'd suggest not doing that. ;)
In fact, I'd suggest avoiding globals altogether when possible. Passing parameters may be more time consuming, but it makes it very clear what each procedure/function should be doing, and future programmers will thank you. Time you'll save on initial programming will be made up when doing maintenance. But admittedly globals are useful, just be careful when using them. Getting your code to work isn't enough; you should aim to make it clear and understandable too. -
About package global variable.
Hi All,
Could you please anyone tell me from which Data Dictionary tables we can find to definiton of Package global variables which is declared in specification part.
I tried in ALL_ARGUMENTS but I failed to get it.
Thanks in advance.Thanks James for you reply.
We written an application using utPLSQL framework, which is used to write unit test cases for Oralce server side programs.
In one of our Oracle package we have been using global variable and is been referred by all the public members.
To initailize the package global variable based on our test case we need to know the package global variables. -
Change public variables that are used in another class to private variables
Hi
I have public variables in one class and I am also using them in another class the only thing is all my variables are supposed to be private. When I change then to private then I cannot use them in the other class. Please someone help me.
Thanks
DFirst way - make variables protected an you can access them from any class within package or from any class that extends class with variables.
Second - make variables private and create public get/set methods for that variables for accessing they from any other class/package.(That's preferable way).
I have public variables in one class and I am also
using them in another class the only thing is all my
variables are supposed to be private. When I change
then to private then I cannot use them in the other
class. Please someone help me. -
Accessing a public variable between classes
Hi there,
I've got two classes running...one is a document class (EgoGame.as) and another is a class linked to several similar movie clips (Ball.as).
I'm trying to access a public variable from Ball.as which has been declared in the doucment class EgoGame.as.
When I run the test the outputs states the following...
1120: Access of undefined property _ballPlaced.
Here's my code. What I'm trying to do is remove the event listeners from the Ball.as when the _ballPlaced variable is true, so that the user can't drag and drop the balls after they've been placed in a zone....any pointers greatly appreciated!
Document Class
EgoGame.as
package
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import Ball;
public class EgoGame extends MovieClip
public var __zoneFull:Array = new Array(false, false, false);
public var __ballPlaced:Array = new Array(false, false, false);
public function EgoGame()
ball0_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
ball1_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
ball2_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
ball0_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
ball2_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
ball1_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
ball0_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
ball1_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
ball2_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
private function zoneEmpty(event:MouseEvent):void
if(event.target.hitTestObject(zone0_mc) && _zoneFull[0] == true)
_zoneFull[0] = false;
_ballPlaced[event.target.name.substring(4,5)] = false;
else if(event.target.hitTestObject(zone1_mc) && _zoneFull[1] == true)
_zoneFull[1] = false;
_ballPlaced[event.target.name.substring(4,5)] = false;
else if(event.target.hitTestObject(zone2_mc) && _zoneFull[2] == true)
_zoneFull[2] = false;
_ballPlaced[event.target.name.substring(4,5)] = false;
else
event.target.x = event.target._startX;
event.target.y = event.target._startY;
_ballPlaced[event.target.name.substring(4,5)] = false;
private function zoneFill(event:MouseEvent):void
if(event.target.hitTestObject(zone0_mc) && _zoneFull[0] == false)
event.target.x = zone0_mc.x;
event.target.y = zone0_mc.y;
_zoneFull[0] = true;
_ballPlaced[event.target.name.substring(4,5)] = true;
else if(event.target.hitTestObject(zone1_mc) && _zoneFull[1] == false)
event.target.x = zone1_mc.x;
event.target.y = zone1_mc.y;
_zoneFull[1] = true;
_ballPlaced[event.target.name.substring(4,5)] = true;
else if(event.target.hitTestObject(zone2_mc) && _zoneFull[2] == false)
event.target.x = zone2_mc.x;
event.target.y = zone2_mc.y;
_zoneFull[2] = true;
_ballPlaced[event.target.name.substring(4,5)] = true;
else
event.target.x = event.target._startX;
event.target.y = event.target._startY;
_ballPlaced[event.target.name.substring(4,5)] =false;
private function playMovie(event:MouseEvent):void
if (_ballPlaced[0] == true)
ball0_mc.gotoAndPlay(2);
else
ball0_mc.gotoAndStop(1);
if (_ballPlaced[1] == true)
ball1_mc.gotoAndPlay(2);
else
ball1_mc.gotoAndStop(1);
if (_ballPlaced[2] == true)
ball2_mc.gotoAndPlay(2);
else
ball2_mc.gotoAndStop(1);
Ball.as
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
import EgoGame;
public class Ball extends MovieClip
// public var _hitTarget:MovieClip;
public var _startX:Number;
public var _startY:Number;
public function Ball()
_startX = this.x;
_startY = this.y;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);
this.addEventListener(MouseEvent.MOUSE_UP, dropIt);
private function dragIt(event:MouseEvent):void
this.startDrag();
public function dropIt(event:MouseEvent):void
this.stopDrag();
public function lockBall(event:MouseEvent):void
if(_ballPlaced[this.name.substring(4,5)] == true)
this.removeEventListener(MouseEvent.MOUSE_DOWN, dragIt);
this.removeEventListener(MouseEvent.MOUSE_UP, dropIt);every place you have a ball reference you can access the lockBall() method. so, if ball0_mc is a Ball class member, you can use:
ball0_mc.lockBall(); -
How to pass a list as bind variable?
How can I pass a list as bind variable in Oracle?
The following query work well in SQL Developer if I set ":prmRegionID=2".
SELECT COUNTRY_ID,
COUNTRY_NAME
FROM HR.COUNTRIES
WHERE REGION_ID IN (:prmRegionID);
The problem is that I can't find how to set ":prmRegionID=2,3".
I know that I can replace ":prmRegionID" by a substitution variable "&prmRegionID". The above query work well with"&prmRegionID=2" and with "&prmRegionID=2,3".
But with this solution, I lost all advantage of using binds variables (hard parse vs soft parse, SQL injection possibility, etc.).
Can some one tell me what is the approach suggest by Oracle on that subject? My developer have work a long time too find how but didn't found any answer yet.
Thank you in advance,
MBBlais wrote:
The problem is that I can't find how to set ":prmRegionID=2,3".Wrong problem. Setting the string bind variable to that means creating a single string that contains the text "+2,3+". THE STRING DOES NOT CONTAIN TWO VALUES.
So the actual problem is that you are using the WRONG data type - you want a data type that can have more than a single string (or numeric) value. Which means that using the string (varchar2) data type is the wrong type - as this only contains a single value.
You need to understand the problem first. If you do not understand the problem, you will not realise or understand the solution too.
What do you want to compare? What does the IN clause do? It deals with, and compares with, a set of values. So it needs a set data type for the bind variable. A set data type enables you to assign multiple values to the bind variable. And use this bind variable for set operations and comparisons in SQL.
Simple example:
SQL> --// create a set data type
SQL> create or replace type TStringSet is table of varchar2(4000);
2 /
Type created.
SQL>
SQL>
SQL> var c refcursor
SQL>
SQL> --// use set as bind variable
SQL> declare
2 names TStringSet;
3 begin
4 --// assign values to set
5 names := new TStringSet('BLAKE','SCOTT','SMITH','KING');
6
7 --// use set as a bind variable for creating ref cursor
8 open :c for
9 'select * from emp where ename in (select column_value from TABLE(:bindvar))'
10 using names;
11 end;
12 /
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 1981/05/01 00:00:00 2850 30
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7369 SMITH CLERK 7902 1980/12/17 00:00:00 800 20
7839 KING PRESIDENT 1981/11/17 00:00:00 5000 10
SQL>
SQL> --// alternative set comparison
SQL> declare
2 names TStringSet;
3 begin
4 --// assign values to set
5 names := new TStringSet('BLAKE','SCOTT','SMITH','KING');
6
7 --// use set as a bind variable for creating ref cursor
8 open :c for
9 'select * from emp where TStringSet(ename) submultiset of (:bindvar)'
10 using names;
11 end;
12 /
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 1980/12/17 00:00:00 800 20
7698 BLAKE MANAGER 7839 1981/05/01 00:00:00 2850 30
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7839 KING PRESIDENT 1981/11/17 00:00:00 5000 10
SQL> -
How do I set a public variable in a native ActiveX DLL using Java?
Hello,
I have run into an issue that I cannot seem to find any documentation on, and all of my efforts with search engines have returned no useful results.
Here is my situation:
I have an Active X DLL that has a very simple configuration, but it is a third party DLL which I cannot modify. To interface with the DLL I have to set a series of public variables and then call a method with no parameters that will use the current values of the variables to perform a calculation. There are no "set" or "get" methods.
At this point I have a very good idea about how to use JNI to create the class in java, and call the method. However, this does me no good at all if I cannot set the variables.
Everything I have found so far defaults to an assumption of no direct access to variables, and that getter and setter methods would be available for that purpose. Anyone know of a way that this might be handled? I would provide source code, but it seems useless unless I know how to actually do this.
Thanks in advance for any input.OK. Those are OLE/ActiveX/COM/WhateverTheyCallIt getters and setters, that VB makes look like object 'properties'.
If you are familiar a bit with C#, they also have 'properties', which are getters and setters hidden behind a syntax that makes them look like member variables.
I am affraid my help has to stop here, as I don't remember COM anymore.
But, unless you find someone who really knows COM, you will have to investigate by yourself.
One suggestion though: open a C++ project in VisualStudio 2005 or 2008 (not Express, it seems not to support what I describe).
Go to something like References or Add Reference and you will see a tabbed dialog box with a COM tab (I describe all this from memory).
Add your DLL. After this do View->Object Browser or alike. It should show your COM object. You will be able to examine its methods and properties.
I think Visual Studio canl generate code for invoking them. This is the C code that somehow you should take from there and place in your JNI code.
Edited by: baftos on May 9, 2010 11:22 AM
Correction: VS2008 Express also supports this, but to get there, you do View->Object Browser->Click the "..." button->COM tab.
VS2008 Express is free.
Edited by: baftos on May 9, 2010 11:25 AM -
Public variables in javascript
how i can use public variables in javascript along with ADF. I am declaring a variable at the top of list but when an event is generated by ADF and i tries to access that variable, it gives me an error of undefined.
Kindly help meNot directly, but you can with this:
http://java.sun.com/products/plugin/1.3/docs/jsobject.html
See also:
http://www.codeproject.com/jscript/javatojs.asp?df=100&forumid=736&exp=0&select=700857 -
Pass value of Java script variable to ABAP variable (in BSP)
Hi,
I have a Javascript variable declared in the SCRIPT tag of BSP layout page.
I want to pass its value to ABAP variable, so that later I can do some computations using the ABAP variable.
(ABAP variable is also declared in the same SCRIPT tag of BSP page)
Would request to post a sample code, if possible.
Would appreciate quick replies.
Thanks & Regards,
Nisha Vengal.just check this
https://forums.sdn.sap.com/click.jspa?searchID=16240444&messageID=1191305 -
Problem with merge using package (row)variable
We're doing an ETL project, where we have to validate data coming from staging tables before inserting / updating them in our data tables.
We use a validate function for this, in which we 'test' our mappings and business logic, and returns 'OK' if no errors were occured.This function is called in the WHERE clause, and populates a package row variable. From this variable, values are read in the insert / update statement, using a get function.
The problem is that sometimes, with a data set with NO duplicate keys, we get an ORA-00001 error, and sometimes not.
Does anyone have any idea why this error could occur ? We're on Oracle 9.2.0.5.0.
For the demo mentioned below, the following statement fails , while it succeeds if we add 'and rownum < 11' to the where clause :
merge into target_tab t
using (select st.* from source_tab st where demo_pack.assign_var(st.attrib_1, st.attrib_2, st.attrib_3) = 'OK') s
on (t.attrib_1 = s.attrib_1 and
t.attrib_2 = s.attrib_2)
when matched then update
set t.attrib_3 = demo_pack.get_attrib('ATTRIB_3')
when not matched then
insert(attrib_1, attrib_2, attrib_3)
values (demo_pack.get_attrib('ATTRIB_1'), demo_pack.get_attrib('ATTRIB_2'), demo_pack.get_attrib('ATTRIB_3'));
Can anyone explain to me why this statement sometimes fails, and other times not ?
Thanks in advance .
demo tables / packages :
create table source_tab
attrib_1 varchar2(30),
attrib_2 varchar2(30),
attrib_3 varchar2(200)
create table target_tab
attrib_1 varchar2(30) not null,
attrib_2 varchar2(30) not null,
attrib_3 varchar2(200),
constraint pk_target_tab primary key(attrib_1, attrib_2)
insert into source_tab
select table_name, column_name, data_type
from user_tab_columns;
commit;
create or replace package demo_pack as
function assign_var(p_attrib_1 in target_tab.attrib_1%type,
p_attrib_2 in target_tab.attrib_2%type,
p_attrib_3 in target_tab.attrib_3%type) return varchar2;
function get_attrib(p_name in varchar2) return varchar2;
end;
create or replace package body demo_pack as
g_rec target_tab%rowtype;
function assign_var(p_attrib_1 in target_tab.attrib_1%type,
p_attrib_2 in target_tab.attrib_2%type,
p_attrib_3 in target_tab.attrib_3%type) return varchar2 is
begin
g_rec.attrib_1 := p_attrib_1;
g_rec.attrib_2 := p_attrib_2;
g_rec.attrib_3 := p_attrib_3;
return 'OK';
end;
function get_attrib(p_name in varchar2) return varchar2 is
l_return varchar2(200);
begin
if p_name = 'ATTRIB_1' then
l_return := g_rec.attrib_1;
elsif p_name = 'ATTRIB_2' then
l_return := g_rec.attrib_2;
elsif p_name = 'ATTRIB_3' then
l_return := g_rec.attrib_3;
end if;
return l_return;
end;
end;
/It's not necessarily that the problem is within your package code. As long as UNIQUE constraint exists on DEST table, any MERGE statement may fail with ORA-00001 due to concurrent updates and inserts taking place.
Of course, it's just my guess but consider the following scenario (three sessions modify DEST table in parallel – and to keep this example clear, I put their commands in chronological order):
S#1> create table dest(x primary key, y) as
2 select rownum, rownum
3 from dual
4 connect by level <= 5;
Table created.
S#1> create table src(x, y) as
2 select rownum + 1, rownum + 1
3 from dual
4 connect by level <= 5;
Table created.
S#1> select * from src;
X Y
2 2
3 3
4 4
5 5
6 6
S#1> select * from dest;
X Y
1 1
2 2
3 3
4 4
5 5
S#2> -- Now, session #2 will update one row in DEST table
S#2> update dest
2 set y = 40
3 where x = 4;
1 row updated.
S#2> select * from dest;
X Y
1 1
2 2
3 3
4 40
5 5
S#1> -- Session #1 issues the following MERGE:
S#1> merge into dest d
2 using (select * from src) s
3 on (s.x = d.x)
4 when matched then update set d.y = s.y
5 when not matched then insert (d.x, d.y)
6 values (s.x, s.y);
-- At this point, session #1 becomes blocked as it can not modify row locked by session #2
S#3> -- Now, session #3 inserts new row into DEST and commits.
S#3> -- MERGE in session #1 is still blocked.
S#3> insert into dest values (6, 6);
1 row created.
S#3> select * from dest;
X Y
1 1
2 2
3 3
4 4
5 5
6 6
6 rows selected.
S#3> commit;
Commit complete.
S#2> -- Session #2 rolls back its UPDATE.
S#2> rollback;
Rollback complete.
-- Finally, session #1 is getting unblocked, but...
merge into dest d
ERROR at line 1:
ORA-00001: unique constraint (MAX.SYS_C0032125) violated
S#1>Hope this helps,
Andrew. -
Using public variables in a servlet
Hi, I have a public variable "CustID" in my servlet. Note that is a public member variable and not a static variable.
In the doPost() method, I am trying to use the custId field.
Pls. look at the code below. I want to know that in a multi-user environment since the custId field is defined at Servlet level as a member variable, is there a chance for this variable to be corrupted and I fire a wrong query ???
Awaiting your answers
public class QWCustomerServlet extends HttpServlet
public boolean debug = false;
public QWFieldList fieldList = new QWFieldList();
public String custID = null;
public doPost(HttpServletRequest req, HttpServletResponse res)
HttpSession session = null;
if ( (session = request.getSession(false))!= null){
custId = session.getAttribute("cid");
String query = "select * from customer where cust_id=" + custId;
Statement stmt = conn.createStatement();
stmt.executeQuery(query);
}Yes. There is only one instance of a servlet and all requests thread through it. Don't use instance variables unless you want all threads to share (usually in a read-only manner such as a reference to a resource). In your example, move the custId declaration inside doPost and it will be thread-safe.
-
SQL Queries dont recognize Package member variables.
Hi,
I have a package defined like this:
CREATE OR REPLACE PACKAGE PROD.PKG_BSYS_COMMON
AS
MAX_RETURN_ROWS NUMBER(6) :=1000;
END PKG_BSYS_COMMON;
The problem is that I cannot use MAX_RETURN_ROWS in my SQL queries:
SELECT
FROM
CLIENT
WHERE
ROWNUM < PROD.PKG_BSYS_COMMON.MAX_RETURN_ROWS
Is there any way to use that package member variable in my queries?
This is a simplified explanation of our problem and it is very important for our business to avoid hardcoding constants in queries and define all of them in a central location. Is there a better way doing this?
Any help would be appreciated,
AlanCREATE OR REPLACE PACKAGE PKG_BSYS_COMMON
AS
function max_return_rows return number ;
END PKG_BSYS_COMMON;
CREATE OR REPLACE PACKAGE body PKG_BSYS_COMMON as
function max_return_rows return number is
begin
return(1000);
end;
end PKG_BSYS_COMMON;
select pkg_bsys_common.max_return_rows from dual;
MAX_RETURN_ROWS
1000 -
Passing JavaScript values to JSP variables
Can any body correct the follwing code
<Script language="JavaScript">
function test( x )
<%
int num = x;
num = num * 2;
%>
v.value = "<%out.print(num);%>";
<input type="button" name="b" value="test" onClick="test(5)">
<input type="text" name="v" value="0">
In short, I am trying to pass JavaScript value to JSP variable. I hope that it is possible to do that. If it is possible then how can I do it. I want to assing the variable x passed to the JavaScript function called test to the JSP variable called num.
Regards,
AgeelThank you for your reply,,,
I think then the only way to do it is to post the
value on the server and then use request.getParameter
method in jsp code
but the question now how can I post values to the
server using JavaScript without reloading the pageyes... you can to it by create a new popup window which will submit the value to server after page was loaded... then, server return a value to the same window in html/jsp page which then using javascript to set it back to the opener and close up the window... however, this is not a good choice unless you have no other alternative...
>
There is other possible solution
if I can get the text field value from the same page
without reloading it that would work fine and will
solve my problem, is it possible?yes... you can get the value from the textfield...
for example :
function showValueInTextField()
alert(document.forms[0].elements["mytextfieldname"].value);
>
My final question> can jsp change things on the same
page without reloading it. I mean can it work like
JavaScript so that I can use it's internal functions
instead of using java script :S
not really know what you trying to say here... -
I have the code below. What I am trying to do is to print out
the value of a public variable. I am trying to change that public
variable in the function that handles the result of the remote
object call. The problem is the value only seems to change in the
function and no where else. Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="load_list()">
<mx:script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
public var material1_ID: int;
public function load_list():void{
material1_ID = 0;
public function addRec():void{
Alert.show('value before' + material1_ID.toString());
insertService.addMaterial('123'); // THis calls my webservice
and returns a query
Alert.show('value after' + material1_ID.toString());
public function addMaterial(event:ResultEvent):void{
material1_ID = 9;
]]>
</mx:Script>
<mx:RemoteObject
id ="insertService"
destination="ColdFusion"
source ="insert"
>
<mx:method name="addMaterial" result="addMaterial(event)"
>
</mx:RemoteObject>
</mx:Application>This function in your code:
public function addRec():void{
Alert.show('value before' + material1_ID.toString());
insertService.addMaterial('123'); // THis calls my webservice
and returns a query
Alert.show('value after' + material1_ID.toString());
Looks to me like you are making the remote call and then
expecting the next line to access the result. Flex doesn't work
that way. Remote calls (including HTTPService and WebService) are
asynchronous. When you make the addMaterial call, the request goes
out and the response comes back "later". So right after that
request the value won't be changed.
If you print the value in the result handler, you'll see that
it will be changed.
Maybe you are looking for
-
SQL Server Import and Export Wizard Issue
i am trying to export SQL data into excel to send out weekly reports. I have created a view and a SQL account has access to this view; however, I am unable to successfully export the data. In preview I see all of the data yet it fails on the Pre-ex
-
Drop-down in JSP using a bean as back-end
Hi everyone, I like to create a dynamic drop-down (reading from a database) using JSP but accessing a bean. My code on the bean is: public void DepartmentName() { try stmt1 = tConnection.createStatement(); rs1 = stmt1.executeQuery ("select DEPT_NAME
-
Socket creation errror in adaprer engine
Hi Experts, I am getting below error message in sxmb_moni. Here my sceanrio is proxy to Soap synchronous. <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <!-- Inbound Message --> - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30"
-
2line items in accounting after billing
hi, after releasing billing to accounting. 2 line items generating for sales revenue account. eg: Sales revenue a/c,- 101010 - 5000.00 Tax a/c-------198.50 Sales revenue a/c,- 101010 - 0.50 here the price difference is 0.50 paise , for this differenc
-
Dear All, Our client is on SAP2007A PL45. They don't want to upgrade to SAP882 now. When I open their SAP, I cannot see any license file. When I open server tool >> license service, I can see hardware key but no installation number and other informat