JAVA Class and Dreamweaver integration - java

I am creating jsp application. I have created jsp pages using dreamweaver and some java classes using Netbeans.
what i want to do now and want to know, can i like make my classes methods and variables appear as tags or hints in dreamweaver? like when you type
<p><% out.println("pink")%></p>
above, the println will automatically appear with the list of other hints when you type out... so when i have myClass java class...
<p><%=myClass.getMyMethod()%></p>
the .getMyMethod with all the other methods will appear.
I hope it's clear. Just asking...Thanks!

Its better to design the view part in Dreamweaver. And migrate the *.jsp files to Netbeans IDE. But this feature is supported in latest versions of Dreamweaver.

Related

Importing template vaadin lose java code reference

I have a JsModule in my vaadin project, so I want to add to my page another, I made this so:
<div><products-search id="products-search"></products-search></div>
It works but there is a problem, the template products-search is related to a java class, if I access directly the page products-search the java binding works, but including the page in another in this way it works partially indeed the layout is visibile but doesn't work the interaction with the java code!
Someone can help me?
If you're importing a custom JS module to your template, the JavaScript code won't know anything about the imported web component's Java companion class. You'll need another approach - you could use #Id binding instead or add a <slot> in your template and append the corresponding Java component on the server.

How to correctly call my Java code from a JSP project in Eclipse

All I'm trying to do is make calls to my Java code from my .jsp pages. I have written some .jsp pages for a webapp, but as the project grows I want to start putting some of the code into .java classes or servlets.
Why doesn't Eclipse "see" everything in my /src or /lib /web or /WebContent or /WebContent/src or /WebContent/WEB-INF/lib or /Webcontent/WEB-INF/src as usable? After all, it "sees my sql jdbc .jar files and I can use them as soon as they are in /WebContent/WEB-INF/src (and not any other folder). But I wrote classes which are in packages, my code isnt in .jar file form, so eclipse is not picking up on them.
You need to have the Java EE version of Eclipse installed, and create a Java Web Application, which will allow you to set up a web.xml.
Eclipse JEE which I have installed to set up web projects is:
http://eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerr
Your web.xml will definte your web servlets, which can be JSP's or Java classes that extend a servlet implementation.
This has less to do with your IDE (eclipse) than it does with Java Web Applications.
You should read this documentation for starters from Oracle about web apps, and go from there on setting up an IDE:
http://docs.oracle.com/javaee/1.4/tutorial/doc/WebApp.html
Edit based on user feedback
Import should be to class level:
<%# page import="fully.qualified.SomeClass" %>
Then from your JSP code:
<%
SomeClass someClass = new SomeClass();
someClass.helloWorld();
%>
Edit 2 based on feedback
Try this link to do using page include: http://www.coderanch.com/t/286168/JSP/java/Calling-Java-classes-JSP-page
Alternative Approach
Add a new class to your web.xml, where you want to send your request/form data to. So your JSP would be 1 servlet, your other java class would be your other servlet.
On your JSP, create a form that has an action of your new "TestProgram" servlet
This answer to this question has nothing to do with my setup or import statements. The correct answer is that eclipse doesn't make it clear what code it "sees" (or that its compiling) when it runs the project. On my JSP page, it showed it as recognizing the call to my java code. However, when I ran the page, it was still compiling the older version of my java code, that didn't have my latest changes. I've found the best way to guarantee that the newest version of my referenced java code is compiled when I run my .jsp program (that calls the java) is to go to "Project->Build All" then go to "Servers", right click "Publish". If Publish isnt an option, and it thinks its already synchronized, then you may have to change the .jsp page, save it, then "Publish" will become active again.

Web UI for existing Java application

I am trying to build a search engine using java and the lucene API as part of a project. For the last step, we plan to build a web UI (a local host would do) for the same. Are there UI softwares/plugins for eclipse which will allow me to call the functions present in the java classes?
Essentially I would want to have a search box and a search key, pressing which will throw up the search results(which is computed from the java program). javascript cannot call java code I understand. So using that is eliminated?
Any suggestions on what to use will be greatly appreciated. I have pretty poor knowledge in front end design!
Cheers!
AB
If all you have is a simple screen with a entry field and a button and you simply want to return an html table. I would go with a servlet and two jsps. Your servlet can call your search engine and then have the jsp format the data into the table. If you do not know web apis this is probably the easiest entry.
I think, If your using JAVA, that you should look into JSF.
It's a rather easy to maintain and work with library for just the uses you describe.
I recommend these tutorials to get you started: http://www.coreservlets.com/JSF-Tutorial/jsf2/#Tutorial-Intro
There are lots of options to achieve this.
you can create web-ui using jsp.
I have also created same type of project using Lucene, here i have used spring mvc.i have provided all the back-end process as REST api which any web-ui can use.
Please do not look into JSF; it is an overengineered pile for your task.
Sure you can call your java code from javascript, you can make it really simple with something like DWR.
However, for your project I would suggest GWT as then you only deal with Java and it will generate javascript, html and css for you.
For your project you dont really need an "enterprise" level framework like spring or a fullstack JavaEE, you could keep it real oldschool with only JSPs and html/javascript. However thats a bit too flaky for my taste, so go with GWT.
With GWT you basically set it up, define your module, entrance point (look at the hello world), and then you add a layout to your page like something to place the searchbox into and the resultbox to. Then you call your other Java code and classes from there like you normally would.
I would suggest you to use GWT in your application because GWT enables you to call java methods and it will also convert Javascript and css for your Java modules after GWT compile.
GWT reference :- http://code.google.com/webtoolkit/gettingstarted.html
If you're going to use GWT, you could aslo check Vaadin.
Creating a search UI is really simple, and the tutorial show a criteria /result table application taht could be adapted.

How to add context sensitive help text for custom functions in eclipse

I am programming for using eclipse as an IDE to program in a different language. I have implemented custom content-assist feature using eclipse using the org.eclipse.jface.text.contentassist.IContentAssistProcessor package. You can see my output below with the "__XXXXX" functions being displayed as someone types anything based on the context.
How can I display function details of a custom function. I mean, the type of help that can been seen in normal functions. I want to give an useful information about these functions.
See ICompletionProposal.getAdditionalProposalInfo() and ICompletionProposalExtension5.getAdditionalProposalInfo(...). Eclipse contains several examples on how to implement these.

Free XML based java gui language with builder

Is there a free decent java GUI descriptor language (probably XML based), which has a Glade-like (WYSIWYG) GUI builder?
Netbeans IDE. Whenever you use its GUI editor, it stores the GUI in XML, in a *.form file.
For example if your create a class com.some.package.MyForm which extends some Swing component or window, look for this file $SRCDIR/com/some/package/MyForm.java and $SRCDIR/com/some/package/MyForm.form.
The former is the actual Java class that gets compiled. The latter is a file that Netbeans uses to store the GUI in XML format. This is what netbeans uses to generate the auto-gen'd code that goes in the code fold to initiliase the GUI.
HTH
Edit:
I do acknowledge that the Netbeans IDE probably isn't the best one out there, and I personally use it only because it's already built into the IDE that I use anyway. For me it gets the job done, and I may sometimes have to manually apply tweaks in the code to get what I want. It's a no-frills, XML-based, Java GUI, WYSIWYG editor.
Sorry this is prob not the answer you were looking for but have you looked into using flex? The markup in Flex is all XML based and the builder is very good.
Blaze DS can then be used to communicate between flex and Java.
Dont know any pure xml layout frameworks off the top of my head. Whats your reason for wanting an XML based UI?
Simple googling yields me many like http://swingml.sourceforge.net/, http://jfcml.sourceforge.net/,http://cookxml.yuanheng.org/cookswing/etc.
You can try JavaFX, it is too a cool DSL way of representing the Swing components and it provides more of its own for API for animation and graphics usage.
Netbeans and eclipse have plugins/extensions to do DnD development for it.

Categories

Resources