How to call gwt servlet from native java? - java

GWT code is a part of UI as an iframe. Now when the page is logged out, It should somehow call the gwt servlet code in the background and to invalidate the session. I have tried syncproxy, gwtrpccommlayer, But it didnt work since objects for the clients cant be created since it doesnt come under the gwt lifecycle.
Please suggest me how to achieve this. Thanks in advance.

Related

HtmlSelect does not trigger event at selection

I am working on a program for this website using the Java module HtmlUnit. I need to select options from the select fields, but when I do so, it doesn't trigger any events. I have tried a few solutions on forums for this same question (fireEvent method, injecting a JS script to trigger the event), but none have worked so far.
I would really appreciate some help with this one
If you like to get some help you have to provide more details; the version of HtmlUnit you use and your code (as simple as possible). Including a description where your expectation differs from the real results. And of course more details why you think the event is not triggered.
If you think this is a HtmlUnit issue please open a issue in the HtmlUnit issue tracker.
Have written a Wetator (www.wetator.org) test for the web site. Was able to work with all the select boxes and got the appropriate changes on the web site. Based on this i'm really sure this is not a problem with HtmlUnit. Post your code and i will have a look.

Best way to call a JavaScript function from an Java Applet

I export a method to javascript window with JSNI, and I want to call this function from a applet in a GWT application..
I think that sometimes I have problems with Window context, so, I do some research and found the JSObject class.
I afraid with the package name (netscape.javascript). Is this class still be used? Is there another better way to do this?
I already tried to get applet context and show a new URl (with javascript:myFunction();), but, in some browsers it redirects the user to a new blank window...
What can I do to make it works best as possible?
Thanks in advance.
The netscape.javascript package is included with every Oracle JRE that I am aware of. Not entirely sure about the others.

How to render a web page with android jdk?

I want to show the web page normally,but still keep the user in my app,
how to make use of the available web render engines programmatically?
UPDATE
I'm now using the webview ,but can't render the page,reporting 404 page not found.
However,when I pack my project and run in another computer,it works like charm!
How to solve this?
Use a webview and implement webkitclient if needed.
More info here
Please explain your question. I cant understand that you want to open the webview with the URL or by the html code. Both of them is totally different. Please explain how do you want to open the webview in application by URL or by HTML
You, as of now, probably let your app open the device web browser to let the user see the content of the URL, via an Intent Action.
Use your activity which uses a WebView and implements its own WebKitClient. Then you can make the user stay in your app and control what and how content is fetched.
#Achie has a nice link for you which explains how Web things work in Android.
To know how to work with WebViews, go to this URL and read the nice article-cum-tutorial

Java Applet: how to simulate an url has been clicked?

Basically I want my Java Applet to simulate an url has been clicked, once a certain event listener has been executed.
Say, before I have a link in html:
<a href='destinationpage.php?pid=1001' target='rightFrame' />
I'd like to keep the same link to php intact, and when Applet actually invoke the click simulation method, the "target" attribute can also be used to control the behavior.
Similar SO thread found at here, but it doesn't have an answer.
I have little experience in this area, but I am okay with Java programming so long as someone can give me the suggestion of where to get started with.
Many thanks in advance.
Edit:
Okay, tried to get JSObject from the netscape.javascript package to work, added plugin.jar into CLASSPATH, unfortunately I finally got an ExceptionInInitializerError, so this approach failed, unless I can know how to debug in such a mess...
You could call the url directly in the applet but if you want to reference the link in the page something like the following should work. I have not tested this though.
getAppletContext().showDocument(new URL("javascript:function() {
document.getElementById('mylink').click();
}"));
}

JSF/ICEFaces takes very long time in rendering response

I have a JSF/ICEFaces application that was working fine but all of the sudden it started taking sinfully long time in rendering response phase! I can tell from the console that the java part completes fine but it takes like 10 minutes to display the web page!
I'm using JBoss as my application server.
Could you please tell me how to go about debugging this problem? I don't even know where to start. Please tell me also if putting some code here will help in knowing the root of the problem. To start with, do you think it's a JBoss problem or application problem?
Thanks,
Tam
Have a read of BalusC: Debug JSF lifecycle
Is your page particularly complex? For example if you have a large dataTable where each row contains logic then the render phase may take ages.
You could try to use tools like Firebug to see if there is some Ajax functionality that blocks the render process. IceFaces as I know it relies heavily on doing everything on the serverside of the application and then send the results to the browser for displaying.
Maybe your use of the components generates a lot of communication to the server or the component can not be updated.
I would look into IceFaces it has proven as unstable and problem prone all the times I worked with it. They have a own forum where you often find an answer to your problems. I think it is on Icefaces.org. But without knowing more I can't really tell where the problem is.

Categories

Resources