I've never used Java before (C# is my domain), but now I have a task that I must apply a specific style to for a tiny Java webpage. The style is from another ASP.NET application that we're rolling out and that I've helped to develop. Seems that this style is on the way to become our new company web-style. :P
The webpage is really tiny - it has only a login form and an action form with a dozen textboxes and a button. When you click the button, a file is generated and available for download.
This application has already been made by a colleague of mine, who has good experience with Java, but nearly no experience with the web. So he's no help anymore. For now the application has NO style at all. Just a bunch of textboxes.
The application is made in NetBeans and Java Faces - as far as I understand. Or maybe it's "Visual Faces". Not sure - can't make heads or tails with all these names from the Java world. Anyway, it's this ASP.NET look-alike where you have an XML page with tags like <ui:textField>
and <ui:passwordField>
, and then a code-behind file with all your Java code. (Actually I suspect that ASP.NET was created after this, but that's besides the point)
I've successfully converted the HTML layout to the one I need and set my own CSS/JavaScript files in the header. There's just one problem - the Faces thing is hell-bent on including its own CSS stylesheets as well. Sounds reasonable of course, but for some mind-boggling reason these stylesheets also deem it necessary to override styles on all the common tags - <body>
, <div>
, <span>
, etc. Which is annoying, because that breaks my design. Now, I could change my own stylesheets to over-override these default Faces stylesheets, but that seems... well, not the right solution. It's like a workaround, not a "correct" solution. Why should I redefine font attributes for every tag, when it should easily cascade down from the "body" tag?
Is there any way how I can tell Faces not to include its own stylesheets? I won't be using any of their controls anyway - just textboxes and buttons. And labels, when I find them. :P
Oh, yes, and I tried to re-create it all in simple JSP (no Faces), but that failed, because the code-behind (there's some big library there) is dependent on it... This is also the reason why I can't move it to the ASP.NET I'm so familiar with.
Added: Since it seems there are many Java Faces frameworks out there, here's a snippet of code that might help:
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:page id="page1">
<ui:html id="html1">
<ui:head id="head1">
Also I forgot to mention that there is a folder in NetBeans called "Sun Web UI Components Themes" which has three items under it - "Gray Theme", "Green Theme" and "Default Theme". I can choose one of them as the active one, and that also changes the CSS which is included by default. Unfortunately I cannot choose none.
OK, I already changed my style to override these stylesheets. Still it would be nice to hear more about what I'm dealing here with. I don't even know where I should look for documentation...
Added 2: Also, the namespace for say, TextField, is com.sun.rave.web.ui.component
.