Hi,
I created my web page according to this site (https://docs.lansa.com/14/en/lansa017/i ... 1_0205.htm).
Can I want to add an arbitrary parameter (for example: employeenumber=A0000) to the page?
If it possible, please let me know it.
Best regards,
Taku
Can I add an arbitrary parameter into LANSA Web plugin page? (RESOLVED)
-
- Posts: 19
- Joined: Thu Dec 15, 2016 2:03 pm
Re: Can I add an arbitrary parameter into LANSA Web plugin page?
Are you referring to QueryString Parameters?
If so, then check out https://docs.lansa.com/14/en/lansa017/i ... 1_0290.htm
Joe
If so, then check out https://docs.lansa.com/14/en/lansa017/i ... 1_0290.htm
Joe
-
- Posts: 66
- Joined: Thu Nov 26, 2015 1:43 pm
Re: Can I add an arbitrary parameter into LANSA Web plugin page?
Hi Taku,
To add the parameters onto the url you will want to use the PRIM_WEB.history.add method. This allows you to add name value pairs to the url.
https://docs.lansa.com/14/en/lansa016/p ... ry_add.htm
For example:
Then to access the parameters you can access the instance of the parameter name that you want from a PRIM_WEB.URLChangedEvent
https://docs.lansa.com/14/en/lansa016/p ... meters.htm
https://docs.lansa.com/14/en/lansa016/p ... hanged.htm
For example:
Regards,
James
To add the parameters onto the url you will want to use the PRIM_WEB.history.add method. This allows you to add name value pairs to the url.
https://docs.lansa.com/14/en/lansa016/p ... ry_add.htm
For example:
Code: Select all
Evtroutine Handling(#EmpList.ItemGotSelection)
#SYS_WEB.History.Add( ("EMPID=&1").Substitute( #xEmployeeIdentification ) )
Endroutine
https://docs.lansa.com/14/en/lansa016/p ... meters.htm
https://docs.lansa.com/14/en/lansa016/p ... hanged.htm
For example:
Code: Select all
Evtroutine Handling(#SYS_WEB.URLChanged)
If (#SYS_WEB.URLParameters<EMPID> *IsNot *NULL)
#Empdetail.ShowEmployee( #SYS_WEB.URLParameters<EMPID>.value )
Endif
Endroutine
James
-
- Posts: 19
- Joined: Thu Dec 15, 2016 2:03 pm
Re: Can I add an arbitrary parameter into LANSA Web plugin page?
Hi,
Thank you for the tips.
I explain what I want to do again.
I would like to add a parameter to below HTML source.
For example, instead of the following URL, I want to use a HTML file.
http:// webserver /dcxpgmlib /dem /mylogin.html ?employeenumber=a0000
Best regards,
Taku
Thank you for the tips.
I explain what I want to do again.
I would like to add a parameter to below HTML source.
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<script>
(function(){ window["LANSA"] = {nonce: ""}; })();
</script>
<script src="/dcxpgmlib/lansa_14_2_4_1/lansa.js"></script>
<script>
(function(LANSA){
if(!LANSA){document.write("Failed to load /dcxpgmlib/lansa_14_2_4_1/lansa.js");return}
LANSA.init({part:"dem",sys:"dcxpgmlib",ver:"631280881",lang:{def:"JPN",code:{"JPN":"ja-JP","ENG":"en-US"}},slz:0,md:1,splash:{limg:"spin",mtxt:{"JPN":"ロード中...","ENG":"ロード中..."}}});
LANSA.showPage("MYLOGIN");
}(window["LANSA"]))
</script>
<noscript>This page requires JavaScript.</noscript>
</body>
</html>
http:// webserver /dcxpgmlib /dem /mylogin.html ?employeenumber=a0000
Best regards,
Taku
-
- Posts: 169
- Joined: Mon Jan 04, 2016 9:50 am
- Location: Australia
Re: Can I add an arbitrary parameter into LANSA Web plugin page?
Hi Taku,
When you say:
"I would like to add a parameter to below HTML source."
What does that even mean?
Can you try to explain what you're trying to achieve?
Cheers,
Danny
When you say:
"I would like to add a parameter to below HTML source."
What does that even mean?
Can you try to explain what you're trying to achieve?
Cheers,
Danny
Re: Can I add an arbitrary parameter into LANSA Web plugin page?
I just spoke to Taku about this; he is attempting to call LANSA.Init() and LANSA.showPage() internal functions manually, rather than using the generated HTML page that LANSA creates (he took that documentation page to indicate that its fine to do this yourself).
He was hoping that if he passed parameters into the Init function or showPage function, they would be accessible in his web page.
I explained to him that he cannot pass parameters into those functions; and that if he wants to retrieve an employee number for example he should take it from the browser storage, or supplied from a server module (session data), or from the URL as indicated from a previous response.
However it should be noted that when taking the value from a URL parameter, or even browser storage, a hacker could just edit the value passed in to potentially bypass security (i.e. dont use it to pass in the currently logged in emplyee)
He was hoping that if he passed parameters into the Init function or showPage function, they would be accessible in his web page.
I explained to him that he cannot pass parameters into those functions; and that if he wants to retrieve an employee number for example he should take it from the browser storage, or supplied from a server module (session data), or from the URL as indicated from a previous response.
However it should be noted that when taking the value from a URL parameter, or even browser storage, a hacker could just edit the value passed in to potentially bypass security (i.e. dont use it to pass in the currently logged in emplyee)