Run IntelliJ JSP code in Chrome rather than display source code - java

When developing a web page, IntelliJ has browser icons which appear in the top right corner of the editor when you mouse over the area. It used to be for me that if the active file in the editor was a JSP, I could click on my IntelliJ-Chrome icon. This would launch Chrome and what would be displayed would be what the JSP would look like in a browser. I imagine that it was a preview of sorts. This way, I didn't need to run my entire program when all I wanted was to see what my JSP looked like.
I recently reinstalled all my software and lost all my previous settings. Now, when I click on my IntelliJ-Chrome icon, Chrome just displays the JSP source code that is in the editor. How do I get Chrome to run the JSP instead of just display the code?
Everything works fine when I run the entire project through Tomcat.
Additional information 01:
I noticed that when Chrome is displaying these JSP's, the address bar shows the location of the file on my hard drive rather than through localhost. I do of course have a Tomcat Run Configuration set for the project, so I wonder if there is a setting in IntelliJ that is causing the JSP to not get sent through my Tomcat configuration. I have looked this up in the IntelliJ forums and found this post which addresses a similar issue. The answer given is:
You have to configure and mark as default a deployment entry at
"Settings | Deployment
Additional Information 02:
When using these icons, I believe what is launched is not necessarily any run configuration, but the path configuration of the browser. This is located in IntelliJ at Settings -> Tools -> Web Browser.
I can modify the path to go to http:\localhost:8080\, but what this does is launch the OS default browser, not Chrome, at the project welcome page, not the active page in the editor.

You need to have an active Tomcat run/debug configuration. Once you start it and the app is deployed on the server, clicking the browser icon in the editor will open the URL corresponding to the the .jsp file in the browser.
IDE needs to know the deployment context and the server URL for this feature to work which is not possible without Tomcat run configuration.
Clicking the icon for index.jsp in this example will open http://localhost:8080/index.jsp in the browser.

Your Tomcat server is responsible for rendering of the JSP code. Browser just parces HTML (potentially with CSS/JS). JSP is serverside technology. You should run server first, than your favorite icon should work.

Related

How do I deploy a JavaFX application in an HTML page?

I have a JavaFx application. I tried several times to deploy it in an HTML page, but I got nothing. I use jre 9. I also tried to do it with Java web start, but when I open the HTML page, I get the following error: Java security settings have blocked your local application to run.
I changed my Java security settings in the Java control panel, but it's still not working. Please help me, how can I do this?

Java Applet is not working in IE8

Java Applet is not working in Internet explorer 8. It just shown blank screen.
Maybe because of security restriction in IE8.
Is there any fix to this problem?
Did you try reinstalling Java? After reinstalling Java if Internet Explorer asks if you want to enable the Java addon, be sure to click the Enable button.
If you go to Internet Explorer->Tools->Options->Programs->Manage Addons (then Select in the combobox Show All Addons) is the "Java Plug-In SSV Helper" and "Java Plug-In 2 SSV Helper" set to "Enabled"?
Is the site hosting the applet an Internet site or an Intranet site? Check the IE security options for Internet/Intranet Tools->Security->(Internet/Intranet)->Custom Level-> check to make sure "ActiveX Controls and Plugins" is set to "enabled".
Please post the HTML code (tags) that defines the applet.
We are using 1.6_33 with Kronos and we have a pc now and then that gets a blank page after logging in. We installed 7_25 and run the app until we get the prompt it is requesting to use the older version, 6_33. Click on run and after the app worked we uninstalled 7_25 and we were able to open the app with 6_33. We also believe it is a security setting but not sure if it is java related or something to do with IE8 or a combination of both.

Google App Engine/GWT/Eclipse Plugin Newbie Question- how to autobuild client side resources?

I'm tinkering with the default GWT application generated by the Google Eclipse plugin when I click the Google "New Web Application Project" button in Eclipse 3.5. This will no doubt be familiar to many of you.. basically there is an h1 title stating "Web Application Starter Project," a text field, and a Send button.
What I've found is that whenever I make changes to the client side resources, e.g. change the text on the Send button to "Submit" in the .java file, Eclipse does not appear to autobuild these resources. In fact I have to rebuild the entire project in order for these changes to be reflected in my browser. I do have "build automatically" selected in eclipse.
I should state that this is my second GWT project, the first was almost entirely server side (restlet on GAE) and everything built automatically nicely.
When I first tried this new project with updated client resources, on refreshing my browser, the browser stated "you may need to (re)compile your project." I'm not sure if this is relevant but I thought I'd mention it all the same.
So what's going on? How do I get Eclipse/GWT to autobuild these client side resources? Cheers for any help you can offer! :-)
I just installed Eclipse + the GWT SDK/plugins. When I run the default project, install the browser plugin, it shows me a send button. When I change the text "Send" in the .java file to "Submit" and I refresh the browser, it shows me "Submit", in other words: the .java file has been recompiled to javascript, while the server was still running.
It prints the following info, fyi:
I am running Google App Engine Development/1.3.3.1.
It looks like you are using:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
Furthermore, I use Eclipse 3.5 Galileo. So it looks to me that it pretty much does what you want by default. I also tested this in my Windows environment, works the same there.

How do i view the log/console for the J2EE Preview server/container in Eclipse?

I'm working on a struts2 web app in Eclipse, and am using the built-in J2EE Preview server.
How can i view the logs / console for it?
I'm having some problems and now my previously working site is showing Error 404 everywhere, and the console tab at the bottom window of eclipse isn't showing anything.
Cheers all
edit: Here's some screenshots of my console and servers tabs in eclipse:
Console http://img693.imageshack.us/img693/2522/console.gif
Servers http://img693.imageshack.us/img693/3302/servers.gif
There are two buttons on the right side of the Console in Eclipse:
Display Selected Console (a picture of a monitor)
Open Console - a picture of an application window
Try changing their drop-down values to find your needed console.
That's of course if your setup is correct.
In the end, i gave up and downloaded and installed tomcat and used it as my preview server. The console has much more informative stack traces with tomcat.

GWT's hosted mode not working

I've been stumped for a while trying to figure out why my GWT demo app isn't working in hosted mode so I went back and downloaded the Google Web Toolkit again, unzipped it and simply went to the samples directory and ran "ant hosted". The hosted browser launches and only shows the static html content but none of the dynamically generated js widgets, etc. However when I click "Compile/Browse" the examples launch correctly in Firefox. What could be wrong with my setup/environment?
I followed the link you provided to download gwt. Extracted and ran "ant hosted" under samples/Hello, samples/DynaTable, and samples/Showcase and they all worked successfully. I'm also running Windows XP and java 1.6.0_11.
I think that running "ant hosted" starts an embedded Jetty server that listens on port 8888. Hosted Mode Browser makes requests to that embedded server, for example: http://localhost:8888/Showcase.html.
Also, when you click "Compile/Browse", it opens your default Browser (in my case it's firefox) and it tries to make a request to the same embedded jetty server that the hosted mode browser uses.
So, if it works in your browser, then the browser is connecting to the embedded jetty server. It's very strange that hosted mode doesn't work properly but you're able to view in a browser.
I believe the difference here is that hosted mode runs pure java (some sort of javascript emulator, I'm not sure I understand 100%), while the browser is running javascript.
So, I suggest troubleshooting the jvm that is started when "ant hosted" is run. Maybe the jvm is running out of memory or something when you load it up in hosted mode browser? Maybe you can pass some jvm args to the ant script to fix the problem?
Sorry I can't be more specific, that's a strange one!
#Chris: I suspect this question may have something to do with your earlier question if it is on the same computer that you were using. The solution may be to clear your IE cache because it tends to cache the 'script' tag contents and when it got messed up earlier while you were importing other stuff, it may still be sitting around in IE. Found the potential answer at this link.
I created a new workspace, re-imported everything and used GWT 1.6.x instead (because Ext GWT 2.X, which I need for this project requires GWT 1.6.x). This did the trick... everything works ok now.
The main difference I can think of is that in the Compile/Browser you are opening the html host page like a regular file, while in the hosted mode (even in a client sample) it has to be provided by the http server via localhost:8080. Check if the server is beeing started.

Categories

Resources