Unable to add Servlet in eclipse - java

I am setting up a simple server project in eclipse (using a Glassfish as a server if it's relevant). I cannot seem to add a Servlet though. Unlike another question I've seen where a project cannot be selected I can select the project, but the finish or next buttons remain disabled. I tried manually creating a class that extends HttpServlet ahead of time and selecting but it the finish and next buttons are still disabled:
I am running Eclipse 4.3, and I have tried starting it with -clean. Beyond that I'm not sure what to try.
EDIT:
As I said I orginally tried to create a new class using the dialog and only when that did not work did I create my WebService class. Here is what I orignally tried (using NewWebService as the name since WebService now already exists)

Although the question is already marked as answered. There could be other reason to have "next" or "finish" buttons grayed out in "Create Servlet" Dialog.
This could happen, if the PROJECTNAME/WebContent/WEB-INF/web.xml file is corrupt by i.e. misspelled tags or attributes.

#Fr33dan: Check if dynamic web Module is checked in in your project facets.Also is this a maven project?
In the screen shot you provided it seems like you are checking the box Use an existing Servlet class or JSP. Just uncheck it and it should work fine, you will be able to create new class.

Related

Creating a wizard using NetBeans 14

I want to create a wizard from NetBeans 14. I have been searching related materials… I followed the NetBeans tutorial for creating the assistant… Everything was fine until I tried to integrate the wizard into my project. The problem is that in the tutorial the wizard is created as a standalone module and is executed through a dynamic submenu at the NetBeans IDE, the idea is to execute the wizard when the user clicks on a button of the application. Here I found two questions (1 and 2) related, but in the end I haven’t been able to achieve my goal, resulting in an error importing: org.openide.util.HelpCtx. However, in the wizard module everything is working fine and no error is rising. My final questions are:
How can I integrate the previously created module into my application without losing the dependencies and everything works fine? Is there a way of doing so without copying the files into my application?
Am I using the right approach for creating a wizard or is there another way of doing this, an easy one?
Thanks in advance.

If I'm using NBMS to update my application, can I make it deactivate a module that was previously installed?

I built our application using the Netbeans Framework. It's working great, we have a bundle of modules that we update using NBM (NetBeans module files).
When we ship out our product, our customers install it, and it comes default pointed to our update center web server. There it pulls the current updates.xml, containing the version number etc and downloads the relevant NBM file to update a module. It works well.
However, we have a module that's out, and I would like to push an update that would deactivate it, or even uninstall it.
I accomplished a quick fix by closing it immediately with this.close(). It's a top component so it opens by default, and it's basically a useless module right not. It causes clutter initially.
That to me is a total hack, there must be a graceful way to accomplish this in the Netbeans NBM delivery system.
I can provide some code, but I'm unsure what is helpful. This is OOB Netbeans framework functionality, so there's not a lot to show.
Thank you
Some ideas:
Post to one of NetBeans mailing lists where you can get answer from developers (https://netbeans.org/community/lists/index.html)
Add a ModuleInstall class to another module that will run a code as a part of startup procedure. Search lookup for ModuleInfo representing module that should be disabled and call ModuleManager.disable() (likely requires dependency on some internals / non-public API)
Keep the module as it is but add another one depending on it and override the top component there (make it non-vosible by default, hide action to show it, ...)

RCP Start the product with Clear Workspace

So I've come across this weird bug in RCP Apps.
I've created a new RCP App with the Mail Template. I've added a new org.eclipse.ui.menus extension with a menuContribution with locationURI:toolbar:org.eclipse.ui.main.toolbar. To that, I've added a command with a little icon.
Now, if I start the app without Clear Workspace in the Debug Configurations, my action appears AFTER the Quick Access text widget. Not only that, but a few other bugs come along (e.g. views aren't closing, too many views are opening at once). This is not a one-time thing, i.e. I have to start the app with Clear Workspace each time.
This method of adding actions on the coolBar is non-deprecated. Why does it behave like a spoiled brat?
Without Clear Workspace:
With Clear Workspace:
There is a long discussion on the Eclipse forums about this here with a bug filed as a result here.
The bug is not scheduled to be fixed until Eclipse 4.4M5 but using one of the workarounds to remove the Quick Access control discussed here should help.

wicket: changes does not appear after page reload

I have created java Project with wicket in eclipse. the application works fine. The problem is, when I change the java code in the project and reload the page to see these changes, the changes do not appear.
The changes appear only when I run the project again (right mouse click on the project -> run as -> java application). Is there a way to see the changes after reloading the page without needing to run the project again every time?
Use debug-as instead. This will instruct eclipse to use hotswap and update your running application. Note that you'll still need to restart your application often since hotswap doesn't support all class file changes. For that you'll probably need to use a class-reloading solution, such as JRebel, or use the redeploy feature of a container.
Are you using Wicket >= 1.5? You might also be stumbling over the page version parameter that Wicket appends to every URL of a stateful page, e.g. ?5
If you simply reload the page with this parameter, the page will be rendered again, but not constructed new from the scratch, which might also lead to your changes being ignored.
It's quite annoying, but to get a proper reload of the page, you need to remove the parameter and hit enter.

Play! framework. create a new view

I created a new project using the play console
now, by default I got in my views directory two files:
main.scala.html
index.scala.html
I want to add a new view file. I call it "forums.scala.html"
now, I know that in order to render a view you need to do this:
views.html.forums.render("Forums");
the problem is that the intellisense doesn't recognize "forums"
but index and main it does recognize.
I've noticed those files:
class_managed/views.html/index.class
class_managed/views.html/main.class
but there is no forums.class so I suspect this is the problem.
I tried to build the project, but it didn't help.
so, what is the solution?
thanks
Your new views are compiled to managed sources after next browser hit if you are using play run for starting Play in dev mode.
If you'll use play ~run it will try to compile it as soon at it will recognize change in the file.
Finally if you started your app in production mode ie. via play start you have to stop it with ctrl+c and run again. Anyway, developing application in production mode is just a bad idea :)
Depending on your IDE most probably you'll need to refresh file structure to allow it find freshly created managed sources.
right click on ther project and click refresh, that worked for me - found it in another thread.
Found the solution.
running "compile" command did the work.
I understood that intelliJ do it auto, so I will probably use it instead of eclipse.
cheers!
If you want to program in scala, my recommendation is to forget about intellisense. Eclipses scala-ide is quite buggy, dont know about netbeans. And because of nonstandard layout of play2 application, non std development tools (play console), it becames even more handy to use simple text redactor (like sublime or textmate) with good old open-folder-as-project feature.

Categories

Resources