This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 222236 - Not clear how to integrate HTML5, Web and Java projects
Summary: Not clear how to integrate HTML5, Web and Java projects
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Project (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal with 2 votes (vote)
Assignee: David Konecny
URL:
Keywords:
: 225618 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-15 20:36 UTC by _ gtzabari
Modified: 2013-05-02 09:38 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
an experimental patch (just for record) (27.32 KB, patch)
2012-11-29 20:58 UTC, David Konecny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2012-11-15 20:36:20 UTC
Say we use an HTML5 project to develop the client-side of an application, how do we then integrate the result with an existing Web or Java project (running Jetty)?

I don't see any obvious way to take the result of the HTML5 project and have the Web or Java project package it into a WAR file for execution.

Side-note: I believe HTML5 support should be an optional feature from all project types, as opposed to having its own project type. The same is true for comparing JavaEE-based Web projects vs Jetty-based Java projects. It seems to me we only really need one project type and the ability to add "aspects" to it such as Javascript or JavaEE container support. Even Ant vs Maven projects need to be unified in some way so features developed for one aren't left out of the other (when it makes sense).
Comment 1 David Konecny 2012-11-15 22:44:27 UTC
First, we do plan to tightly integrate HTML5 functionality into other project types like Java Web or PHP etc. It's definitely going to happen for the next NB release.

As for packaging HTML5 project in Java Web App, this also should be easier to do out of the box but in the meantime use Packaging tab in Java Web project's properties and add your HTML5 project site root via "Add Folder".
Comment 2 _ gtzabari 2012-11-16 01:42:29 UTC
David,

Thanks for the clarification. I'd just like to highlight one final point: I am using a Java Maven Project with a src/main/webapp directory. Please this use-case in mind. It's a hybrid between a Java application (in actuality, running Jetty) and a web application (I edit both server-side and client-side code under the same project).

The main reason I went for Jetty in the first place is it supports automatic resource reloading (and it's extremely light-weight). I can edit HTML source-code files, hit reload in the browser, and the new version shows up. I just had to add one line of code to my startup method. For all I know, Netbeans is doing the exact same thing under the hood with its "Internal Web Server" option.

I'd still appreciate having access to HTML5-Project-specific features, like highlighting HTML blocks selected in Netbeans navigator. So you're saying all of this will be implemented post-7.3? So what will 7.3 look like? HTML5 features will only be accessible from the HTML5 project?

Here's another design you might want to consider (composition instead of inheritance):

1. Create an HTML5 project for client-side code (HTML, CSS, JS)
2. Create a Web project for server-side code (you would probably rename the projects in this case)
3. Link the Server-side and Client-side projects such that when some super-project is compiled/run it affects these sub-projects as well.

Anyway, food for thought...
Comment 3 David Konecny 2012-11-16 08:29:38 UTC
Thanks for sharing your opinion. I appreciate it. More inlined:

(In reply to comment #2)
> I am using a Java Maven Project

I see. I did not realize you are using Maven. Another project type to enhance after 7.3.

> For all I know, Netbeans
> is doing the exact same thing under the hood with its "Internal Web Server"
> option.

That's what we do. The beauty of client side development is that you do not need a server as no server side processing is required and therefore you do not even need deployment. Our internal web server just serves the files as they are on disk. And using such server instead of direct file:// URLs helps dealing with issues like CORS.

> I'd still appreciate having access to HTML5-Project-specific features, like
> highlighting HTML blocks selected in Netbeans navigator. So you're saying all
> of this will be implemented post-7.3? So what will 7.3 look like? HTML5
> features will only be accessible from the HTML5 project?

Unfortunately yes. We wanted to get this out as soon as possible and get a feedback on it and then integrate it into other project types. I still think it is usable in many cases - you just develop your client separately and *include* it into some server side project.

> Here's another design you might want to consider (composition instead of
> inheritance):
> 
> 1. Create an HTML5 project for client-side code (HTML, CSS, JS)
> 2. Create a Web project for server-side code (you would probably rename the
> projects in this case)
> 3. Link the Server-side and Client-side projects such that when some
> super-project is compiled/run it affects these sub-projects as well.
 
Absolutely agree. That's on our radar. A case when you are developing REST services on server and client side consumes them is a good example too.
Comment 4 David Konecny 2012-11-29 20:58:03 UTC
Created attachment 128608 [details]
an experimental patch (just for record)
Comment 5 David Konecny 2013-02-06 01:42:48 UTC
web-main#29cbb404a987
Comment 6 _ gtzabari 2013-02-06 02:39:34 UTC
Sorry. It's not really clear what you did to resolve this issue. What changes did you make?
Comment 7 David Konecny 2013-02-06 02:57:25 UTC
One more fix - I overlooked that web.clientproject.api is in webcommon cluster and therefore not accessible for nbbrowse task which can access only ide cluster. The new SPI is in web.browser.api where it should have been since the beginning.

web-main#689ec9071fc3
Comment 8 David Konecny 2013-02-06 03:04:01 UTC
(In reply to comment #6)
> What changes did you make?

I pushed the original patch with few modifications. It enables "Project Easel" functionality directly in Java Web project. Current implementation in trunk is preliminary and can change but it should be good start to see whether this works well or what else is needed.

To try it out use any Java Web Project and open its properties and in Run panel change browser to "Chrome with NB integration" and re-run your Java Web Project. For any HTML, CSS, JS which you are authoring directly in your Java Web project you will be able to style them and debug them as you would in "HTML5 Project". That's all for now.

What are your thoughts on this change? Thanks for the feedback in advance.
Comment 9 Petr Jiricka 2013-02-06 10:10:50 UTC
I filed an analogous issue 225786 for Maven web projects.
Comment 10 Quality Engineering 2013-02-06 11:20:32 UTC
Integrated into 'main-golden', will be available in build *201302060843* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/29cbb404a987
User: David Konecny <dkonecny@netbeans.org>
Log: #222236 - Not clear how to integrate HTML5, Web and Java projects
Comment 11 Petr Jiricka 2013-02-22 09:09:20 UTC
*** Bug 225618 has been marked as a duplicate of this bug. ***
Comment 12 David Konecny 2013-04-24 20:12:30 UTC
See https://blogs.oracle.com/netbeanswebclient/entry/html5_development_with_java_ee for the latest update on this functionality.
Comment 13 Vladimir Riha 2013-05-02 06:55:24 UTC
I guess this is not going to 7.3.1, like issue 219542, right?
Comment 14 Petr Jiricka 2013-05-02 09:37:17 UTC
No, not for 7.3.1.
Comment 15 Vladimir Riha 2013-05-02 09:38:03 UTC
OK, thanks for confirmation