problem passing javascript var

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

problem passing javascript var

c.harder
Hi,
I know, this is maybe not the right place for that question. Anyway I hope someone can help.
I have a portlet, which is running a jsp. In that I use iframe for integration of my ops-application.

Problem:
I have to pass the userid form jsp to ops-app and I don't know how.

My try:
jsp:

<script type="text/javascript">
        var c="<%= request.getUserPrincipal()  %>"
</script>
<iframe src="http://localhost:8080/ois/dvz2" name="testframe" frameborder="0" width="100%"></iframe>


view.xhtml (ops-app)
<xhtml:p>          
<xhtml:script type="text/javascript">document.write(parent.c)</xhtml:script>
</xhtml:p>

But thats not working.
Where I am wrong?

Thanks
Clemens



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: problem passing javascript var

Stephen Bayliss
Take a look at http://www.orbeon.com/ops/doc/reference-authentication

The oxf:request-security should do what you need (I think)

Steve

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: 15 December 2005 11:04
To: [hidden email]
Subject: [ops-users] problem passing javascript var

Hi,
I know, this is maybe not the right place for that question. Anyway I
hope someone can help.
I have a portlet, which is running a jsp. In that I use iframe for
integration of my ops-application.

Problem:
I have to pass the userid form jsp to ops-app and I don't know how.

My try:
jsp:

<script type="text/javascript">
        var c="<%= request.getUserPrincipal()  %>"
</script>
<iframe src="http://localhost:8080/ois/dvz2" name="testframe"
frameborder="0" width="100%"></iframe>


view.xhtml (ops-app)
<xhtml:p>          
<xhtml:script
type="text/javascript">document.write(parent.c)</xhtml:script>
</xhtml:p>

But thats not working.
Where I am wrong?

Thanks
Clemens





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: problem passing javascript var

c.harder
Hi Steve,
thanks for reply.

I am not sure, how to use this processor for my problem.
I have two tomcats running (portal and ops). Currently I am not using j2ee security. So there is only one user (portal) for the ops-app for now. Request-Security Processor could only help, if I want to know, which portal is using my ops-app, but not which user is using portal (I think).
Thats the reason why I want to pass the userid through javascript.
If I am wrong, correct me!

Regards
Clemens



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: problem passing javascript var

c.harder
In reply to this post by Stephen Bayliss
Mmh,
passing the userid with hidden fields is maybe the way to go. But there I have still the problem, I don't know how to read it with my ops-app.
Any ideas?
Thanks
Clemens



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: problem passing javascript var

c.harder
In reply to this post by c.harder
Hi all,
I have an solution, but its not very clean. ;-)

ops-app: view.xhtml

<SCRIPT type="text/javascript">
document.writeln(parent.frames[0].name);
</SCRIPT>

portal: test.jsp

<iframe name="<%=request.getUserPrincipal()%>" src="http://localhost:8080/ois/dvz3"></iframe>

I know, its an abuse, but for some reason I can only read the name of iframe from out ops-app. Better would be using hidden fields, but I cant read them. I tried:

document.writeln(parent.document.getElementById("testid").firstChild.nodeValue);

That was working in test, using 2 html pages, but not with jsp (portal) and html (ops-app).

Please tell me, if there are other ways for passing data for that case.

thanks
Clemens



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem passing javascript var

Alessandro  Vernet
Administrator
Hi Clemens,

Using a hidden field in the parent window and accessing it with
JavaScript in the iframe should just work, assuming both the parent
window and iframe are loaded from the same server. In this case you
would have:

portal: test.jsp

<input type="hidden" id="user-principal" name="user-principal"
value="<%=request.getUserPrincipal()%>">

ops-app: view.xhtml

<SCRIPT type="text/javascript">
document.writeln(parent.getElementById("user-principal").value);
</SCRIPT>

Alex

On 12/15/05, [hidden email] <[hidden email]> wrote:

> Hi all,
> I have an solution, but its not very clean. ;-)
>
> ops-app: view.xhtml
>
> <SCRIPT type="text/javascript">
> document.writeln(parent.frames[0].name);
> </SCRIPT>
>
> portal: test.jsp
>
> <iframe name="<%=request.getUserPrincipal()%>" src="http://localhost:8080/ois/dvz3"></iframe>
>
> I know, its an abuse, but for some reason I can only read the name of iframe from out ops-app. Better would be using hidden fields, but I cant read them. I tried:
>
> document.writeln(parent.document.getElementById("testid").firstChild.nodeValue);
>
> That was working in test, using 2 html pages, but not with jsp (portal) and html (ops-app).
>
> Please tell me, if there are other ways for passing data for that case.
>
> thanks
> Clemens
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet