JSF :: 2.2 And Netbeans 8.0 - Create A Website That Has Common Header / Footer And Menu
Aug 26, 2014
I am working with Netbeans 8.0 and JSF2.2. I am trying to create a web site that has a common header, footer, and menu. The only part that would be dynamic is the content. So here goes...
1) I need a common template that has 4 parts, Header, Footer, Menu, Content
2) The header, footer and menu are to be in a separate files of which are called from the main template
3) The content will change based on the menu item changed
4) The menu has to change the content section only
I know how to do this in HTML but I am trying to set up some thing in JSF to learn more on JSF pages. All I am looking for is an example that I can follow along with having the multiple pages as well having the menu change the content (I have done a ton of internet searching but nothing really fits the bill).
This is the code I have currently.
Index (Main Template)
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html">
[Code] .....
View Replies
ADVERTISEMENT
Aug 14, 2013
How to set footer and header in word document/PDF using POI/open office. Using Java COde.!!
View Replies
View Related
Oct 5, 2014
I'm having some difficulty with my bank account project. I'm supposed to create a menu where the user can create a new account, withdraw, deposit, view their balance, and exit. There's issues with the account creation.
Here's my necessitated class below: BankAccount, TestBankAccount, SavingsAccount, CurrentAccount, and Bank
/*---------------------------------------------------
Plagiarism Statement
I certify that this assignment is my own work and that I have not copied in part or whole or otherwise plagiarized the work of other students and/or persons.
----------------------------------------------------------*/
package BankAccount;
import java.util.Date;
import java.util.Random;
//Project 3
public class BankAccount {
protected static int accountID;
[code]....
View Replies
View Related
May 12, 2014
I'm trying to create a GUI java application.
I want a menu with buttons that looks like this:
Button 1: Start
Button 2: Help
Button 3: About Me
If you press one of the buttons you will get to another frame with new buttons, new labels and so on.
Next step for instance if you press button 1, I'd like my program to get this frame:
Different alternatives, and a text field with a button. One commando leads to one new JFrame with new buttons, text fields and so on.
View Replies
View Related
May 14, 2014
I'm trying to create a table where the Header is a custom object.
The custom object would be something along the lines of
public MyColumnObject
{
String myLabel;
ArrayList dataForDropdowns;
int defaultColumnIndex;
int modifiedColumnIndex;
String tooltip;
}
This is simpler then what I want to do, but it's the basic concept. I want the column header to render the myLabel for the visual (at least at first). I want this render to be applied to however many columns I have, which will differ from table to table, but I always want the column header of each column to be of type myColumnObject.
I thought somethinglike this would work, but I'm getting java.lang.ClassCastException: java.lang.String cannot be cast to myColumnObject which makes sense, but I thought that I would be getting back my object.
p.s. I re-labeled all my code from my actual project, so if something looks off, it was probably just the re labeling.
public NewTestTable(MyColumnObjects[] fields)
{
setModel(new TestObjectTableModel(
new Object [][] {
},
fields
) {
private static final long serialVersionUID = 1L;
public boolean isCellEditable(int rowIndex, int columnIndex) {
[Code]...
View Replies
View Related
Feb 7, 2015
In my book for learning java, one of the questions asks us to create a method header named convertTOKM that takes an int parameter, which is the number of miles, and returns a double value for the converted value in kilometers. I made one, but wanted to know if I was right in any way.
Here it is:public double convertTOKM(int miles, double kilometers){
View Replies
View Related
Feb 23, 2014
I have a Java application and it uses various Freemarker templates to created Web pages for a Web site. Here is a snippet of one of my Freemarker templates that will display the fee description, fee charge, and an add button. The fee has to do with charges that pertain to automobiles. When I click on the "Add" button, I will be taken to another Web page. How would I send the fee.description and the fee.charge to the other page when I click on the "Add" button?
<tr class="${rowclass}">
<td class="leftalign">${Fee.description}</td>
<td class="centeralign"><#if Fee.charge??><#if Fee.charge?trim?upper_case != "No Charge"?trim?upper_case && lot.workOrderFee.charge?trim?upper_case != "Market Price"?trim?upper_case >$</#if>${Fee.charge}</#if></td>
<td class="rightalign">
<input type="button" name="buttonsub" id="buttonsub" onclick="javascript:window.location='myPage.html'" value="Add"/>
</td>
</tr>
View Replies
View Related
Dec 5, 2014
I want to create a Jtable when i click on "new" on the menu bar,but if i click on it, i still not see the table.Here is the code:
package mestint
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTable;
import javax.swing.border.BevelBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.*;
[code].....
View Replies
View Related
Jan 22, 2015
Its required to create a service to embed widgets on any foreign website(server), using servlets where i'll pass encrypted widgetId and in turn i will get html for displaying it on screen. Also a refresh button with the embedded widget is to be provided so as to fetch updated computed data. The point is that user should copy some html/script code and place it on his website.
I am thinking of following approach.An empty span with id, followed by a js script to make ajax call to the server to get widget HTML.
View Replies
View Related
Oct 8, 2014
I would like to create a sub menu for every list item in a Jlist. I need the UI like avast interface. If we hover over an list item, its sub menu should be shown. I attempted to put an sub menu but didn't work. Is this possible in Swing?
View Replies
View Related
Oct 19, 2014
So for the last few weeks I have been working on a Java project for school. I see the light at the end of the tunnel, but I have run into some speed bumps with my main class. It was working fine, but I was pulling an all night and I deleted some of my code by mistake.Now I am not seeing what is exactly wrong. Anyways, the project was to create an address book complete with a menu system.
Here are all of my classes:
import java.util.ArrayList;
/**
* A model of an address book which keeps track of contacts.
* An address book object should keep track of the concept of a current contact (think index).
* You must use an ArrayList for your implementation.
*/
public class AddressBook {
Contact contact = new Contact();
[code]....
View Replies
View Related
May 5, 2014
I'm trying to create a JAR in NetBeans, but I get messages.:
C: Users Administrator Desktop Project nbproject build-impl.xml: 993: The Following error occurred while executing this line:
C: Users Administrator Desktop Project nbproject build-impl.xml: 837: copylibs does not support the "excludeFromCopy" attribute
NetBeans does not generate the. JAR because disses errors.
My specs
Version of OS = Windows 7 64 Bit
Java version = 1.7.0_55
Netbeans version = 7.0.1
View Replies
View Related
Mar 9, 2015
Create a Java Application in NetBeans with the following two classes.
1. A Java class College
o Use the following data fields:
College Name
College City
Number of Tracks
Number of Students
Number of Faculty
Number of Staff
o Implement an empty constructor
o Implement a full constructor
o Implement Setters and Getters (Mutators and Accessors)
o Implement SetAll() method with all data members as parameters
2. Another Java class called CollegeDemo with the main() method:
o In the main():
o Read the values of the fields of 3 colleges from a text file and for
each create a College object.
Filename: colleges.txt
IT Dubai 7 200 50 20
ENG Abudhabi 4 400 60 20
SCIENCE Sharjah 3 300 40 20
First with empty constructor then uses setters.
Second with full constructor (no need to use setters).
Last one with empty constructor and SetAll() setter.
o Display the average number of students for all the 3 colleges.
o Change the value of ‘Number of Students’ in the SCIENCE College to
500, and display the average number of students again.
here my code :
public class Demo {
private String name ;
private String city;
private String cname ;
[code]....
View Replies
View Related
Mar 17, 2015
I'm new to java and trying to learn the ropes on Netbeans!What I want to do is make a class which does the following
-Asks for and reads a first number on the command line.
-Asks for and reads a second number using a JOptionPane
-Asks for and reads your name using a JOptionPane
I want it to output the name and the remainder of the first number divided by the second number.
View Replies
View Related
Nov 7, 2014
I need to create a grocery store calculator in Netbeans GUI. It should function as follows:
1. Click "Checkout"
2. Enter item price screen pops up.
3. Input item price, and store price in Item price, subtotal and display in those text fields. Also store item number in number of items and display in text field, all after you click "Ok".
4. Enter item price screen should automatically pop back up. (Loop)
5. Once you are finished with all items, when you click "Ok" or "Cancel" with nothing in the text field. It should calculate sales tax/ total sale and display both.
6. Rest button should reset to the beginning and Exit button should exit program.
GUI 1.jpgGUI 2.jpg
The good news is my program works right now. Although I do not believe I am using the setter/getter methods correctly. More importantly I do not fully understand them. I left out the Generated code due to the length.
import java.text.NumberFormat;
import javax.swing.JOptionPane;
public class Assignment4 extends javax.swing.JFrame {
NumberFormat nF = NumberFormat.getCurrencyInstance();
private Object JoptionPane;
private double purchase; //private instance variables
private int numItems; //private instance variables
[code]....
View Replies
View Related
Aug 14, 2014
I want to read json file as follow;
{
"M": {
"row": [
{
"col1": "c00"
},
{
"col1": "c10",
"col2": "c11"
},
{
"col1": "c20",
"col2": "c21",
"col3": "c22"
}
]
}
}
Next to reading I need to assign to two dimensional array, but without giving "col1","col2","col3" a lot.
The array is for example, Array[3][] = {{"c00"},{"c10","c11"},{"c20","c21","c22"}};
View Replies
View Related
Nov 27, 2014
I am building a little application for personal use where I can track my finance. Now, what I would like to get is an always visible JTable "footer" OR horizontal space field attached to the bottom of the window. The idea is that scrolling down/up wouldn't affect it's visibility(like JTable header). Might a picture tell a thousand words: see attachment.
I am wondering, maybe JTable OR TableModel class has a property to solve this problem(I haven't found any)? Or shall I make another ScrollPane/JPanel? Which path of search shall I pursue?
View Replies
View Related
Jun 29, 2014
How to use common functions and constants in one jsp page which are used in another jsp page on page load time?
View Replies
View Related
May 12, 2014
Which of these is not a real differentiator for programming languages:
a) Object-oriented / Process-Oriented
b) Interactive / Automated
c) Interpreted / Compiled
d) Strongly-Typed / Weakly-Typed
e) All of the above
f) B and C
g) B and D
Almost all support OOP, Interactive/Automated, Interpreted/Compiled but not sure about Strongly typed/Weakly typed.
View Replies
View Related
Apr 6, 2015
I have two ArrayLists and I want to compare them for common elements, and based on the result I want to update the first Arraylist to only have these elements. sort of like the opposite of RemoveAll() which removes elements in common and keep the ones that are unique. so far I thought of using for loop and .contains() in case it was fault,element not present, remove from list. but I was wondering
in what other ways, perhaps APIs i can use to do that?
View Replies
View Related
Mar 19, 2014
I need to create an algorithm that finds the common element(s) in all arrays that has a signature of public Comparable[] findCommonElements(Object[] collection) that has an efficiency of at most O(knlogn), uses a query array, and accepts as input a collection of arrays. I am aware my time would be better spent learning how to use array lists and hash sets, but I am supposed to use concepts already covered, and these have not been.
I feel like this code should work, but it is returning null for the array of common elements. Which means it obviously is not working correctly. I am also likely going to need implementing the sort algorithm, but I wanted to get the part of finding the common elements set first.
public class CommonElements2<T extends Comparable<T>>
{
Comparable[] tempArr;
Comparable[] common;
Comparable[] queryArray;
/*
sort algorithm goes here
*/
public Comparable[] findCommonElements(Object[] collections)
[code]....
View Replies
View Related
Mar 16, 2015
I have developed a web portal using jsp and struts 2. I have approximately 10 JSP pages which looks exactly the same and have two text areas and two hidden fields. All 10 pages are exactly the same except for hidden field value. Can't i have a single common jsp page. How can i achieve it. A sample page i am attaching...
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page pageEncoding="UTF-8"%>
<%@ page language="java"%>
[Code]....
As this is an Assignment page so hidden field value is assignment. If the page is OBJECTIVEs then value will be OBJECTIVE.
View Replies
View Related
Sep 17, 2014
i need to find common String between to Strings :
Example 1:
Customer Name 1: Dr. Joe Smith
Customer Name 2: Joseph Smith, MD.
I need to search the string for a match, in this example "Smith"
Example 2:
Customer Name1: New York Market Place
Customer Name 2: NY Marketplace
I need to search the string for a match, in this example Market place
Example 3:
Customer Name1: The Deli on the Corner
Customer Name 2: Corner Deli
I need to search the string for a match, in this example Deli Corner
View Replies
View Related
May 14, 2015
I am using the following regex - [a-zA-Z0-9]{9,18} which means I can use alphabets and numbers with minimum length as 9 and maximum length as 18.It should not take special characters.
It takes values like ADV0098890 etc. but it is also taking ADV0098890[] which is wrong.
How can I prevent that ?
View Replies
View Related
Oct 16, 2014
After learning about Euclid's Algorithm for finding the greatest common divisor of 2 integers, I decided to make a demo program in Java.
public static int gcd(int number1, int number2) {
int num1 = number1;
int num2 = number2;
if(number1 < number2){
[Code] .....
View Replies
View Related
Feb 5, 2015
when a new object is created in Java it follows the idiom:
Object obj = new Object();
where the Object() constructor matches the object type Object.
But what if it doesn't? I understand from the Oracle Docs on creating objects and polymorphism that the constructor must be in that object's class or one of its subclasses. However, suppose we wanted to declare a new stack. My first instinct would be:
Stack s1 = new Stack();
But I assume it's valid to do it this way, too:
Object s2 = new Stack(); // Is there a difference here? What are we really saying about s2? I'm guessing s2 is simply an empty stack, but only has access to the Object class methods? I'm not sure why someone would ever do this, but I want to solidify my understanding of the Java hierarchy. Are there really any circumstances where someone would use a subclass's constructor when creating a new object?
View Replies
View Related