aspose file tools*
The moose likes JSF and the fly likes Command button within iframe doesn't work on first click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Command button within iframe doesn Watch "Command button within iframe doesn New topic
Author

Command button within iframe doesn't work on first click

moran za
Greenhorn

Joined: Oct 15, 2012
Posts: 2
I have jsf within an iframe, to be more precise, within c:import of another jsf,
I have a button inside the iframe jsf, that activates a simple method within a bean, System.out.println("foo");
When i click the button inside the iframe, first click the link changes to the iframe address and the method is not invoked at all, and the second click works but only when i am inside the other address.

this is an example of the code :
test1.jspx
<jsp:root ....>
... <f:view>
<html>
<head>
</head>
<body>
first page
<c:import url="...../test2.jspx"/>
</body>
</html>
</f:view>
</jsp:root>

test2.jspx
<jsp:root ..>
<f:view>
<h:form>
second page
<h:commandButton id="submit" value="submit" action="#{foo.foo}"/>
</f:form>
</f:view>
</jsp:root>

first click on the button will change the link from test1.jspx to test2.jspx, second click will work.
I tried - changing the bean method foo return type from void to String and returned "".
- doing onclick javascript, trying js redirect, form onsubmit redirect, doing javascript click method
- changing to a4j:commandButton, and change h:form to a4j:form, this dosen't change the link from test1.jspx to test2.jspx but still, first click does nothing, second click works.

I am using jdeveloper as ide, and jsf 1.2

Thanks for the help,
Moran
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

Welcome to the JavaRanch, Moran!

JSF does not work well with iframes.

It also doesn't work well with JSTL, and especially not JSF 1.x. But JSF version 1 has been obsolete for quite a while now.


Customer surveys are for companies who didn't pay proper attention to begin with.
moran za
Greenhorn

Joined: Oct 15, 2012
Posts: 2
Thank you for the post,
Unfortunately I am not able to upgrade jsf, have you got any suggestions for a workaround maybe ?

Thank you,
Moran.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

Consider upgrading your CV, instead. JSF2.0 has been out long enough that migration from JSF 1 should be part of any new development project. Moving from JSF1 to JSF2 is relatively painless - at least if you followed good practices in JSF1. If working conditions don't permit keeping up with technology, you're better off going elsewhere before things get worse, as someone is being penny-wise and pound-foolish.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Command button within iframe doesn't work on first click