JSF :: How To Render More Than One JSP Pages Into 1 Single View
May 15, 2014
I have an application where the WebContent folder has a number of .jsp pages like navigation.jsp, primarytabs.jsp etc.
The navigation.jsp contains a vertical menu and the primarytabs.jsp contains a tab on top, and some other jsps contain individual components.
When I run the application of the application server, it opens up a welcome page, and all these navigation items, and tabs and others merge into a single view and show us a well formed combination of all these components.
I did some studying and read about "composite views". But I wasn't sure if I can call this composite view or not.
How JSF combines all these jsps into one view and where to find that "binding" within the code so I can make the relevant changes?
View Replies
ADVERTISEMENT
Sep 7, 2014
I have huge PDF files which are in booklet format. Example:
Assume a booklet pdf file has 24 pages which each page contains 2 pages which is in two sides - left side and right side.
The first page has 48th page number on the left side and 1st page number on the right side
The second page has 2nd page number on the left side and 47th page number on the right side
The third page has 46th page number on the left side and 3rd page number on the right side
I have vertically cut the Booket PDF files in to separate individual PDF files using bulk operation in separate folder.
for example, the cutted PDF file will be as follows in the above case
1st pdf file - 48th page
2nd pdf file - 1st page
3rd pdf file - 2nd page
4th pdf file - 47th page
5th pdf file - 46th page
6th pdf file - 3rd page..
Similarly for other PDF files too....if a PDF file has 95 pages....
the first page has 95th page number on the left side and 1st page number on the right side
Now the issue is how to rename and arrange the files correctly in the sequence for EACH PDF file so that we can merge the PDF file as one at last for each PDF file...
After renaming correctly in the proper sequence for the above file
1st pdf file should point to 1st page
2nd pdf file should point to 2nd page
3rd pdf file should point to 3rd page...
The problem is all the PDF files which we are planning to split will have different set of pages..example
PDF1 file - has 48 pages as above -> files should be renamed and arranged as 1, 2, 3, 4...48 correctly
PDF2 file - has 96 pages -> files should be renamed and arranged as 1, 2, 3, 4.....96 correctly
PDF3 file - has 56 pages -> files should be renamed and arranged as 1, 2, 3, 4.....56 correctly
Program which will rename the vertically cutted files in a proper sequence??
View Replies
View Related
Mar 23, 2014
I am building a room management system in Java (Netbeans) and Ms Access. The jasper report is only showing code (source view) instead of design view. The GUI JFrame and Login JFrame are not displaying records in the database and the buttons are not working. Also the labels and text fields are not neatly arranged. The connection to the database is not displaying records.
Connection to the database. COIRMS.java
package Login;
import java.sql.*;
public class COIRMS {
Connection con;
Statement st;
ResultSet rs;
public COIRMS ()
[Code] ....
View Replies
View Related
Jun 4, 2014
I have used the following code and I am trying to render a String in the JPanel. The text is getting displayed in the mirror image format.
I understand that there is a problem with .scale(), not able to get an idea about the corrective step. Please run the below class.
class Surface extends JPanel {
final int PAD = 40;
private void doDrawing(Graphics g)
{
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
[Code] ....
View Replies
View Related
Aug 24, 2014
I have a jtable , a customtablemodel and a customcellrenderer with the NetBeans IDE. I want to have different colors for different rows. But anytime I run the application , the rows are not painted as expected. The code snippets are provided below.
This code is from the jtable :
duesTable = new javax.swing.JTable();
duesTable.setModel(duestableModel);
TableColumn tcol = duesTable.getColumnModel().getColumn(2);
tcol.setCellRenderer(new CustomTableCellRenderer2());
duesTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
this code is from the TableCellRenderer
public class CustomTableCellRenderer2 extends DefaultTableCellRenderer{
@Override
public Component getTableCellRendererComponent (JTable table,
Object obj, boolean isSelected, boolean hasFocus, int row, int column) {
Component cell = super.getTableCellRendererComponent(
table, obj, isSelected, hasFocus, row, column);
[Code]...
This is from the Table Model.
public class DuesTableModel extends AbstractTableModel implements TableModelListener {
private List<List<Object>> dataList = new ArrayList<>();
private String[] header = { "ID"," PAYMENT YEAR" , "AMOUNT"}; // Payment year is a date
datatype
private int minRowCount = 5;
[Code]....
View Replies
View Related
Oct 5, 2014
So I can only get 1 tile to render Okay so now it's no tiles Nvm.
Window
import java.awt.BorderLayout;
import java.awt.HeadlessException;
import java.awt.image.BufferStrategy;
import javax.swing.JFrame;
[code]....
View Replies
View Related
Jan 22, 2014
I am working in JSF and I've forgot few of the basics :'I use eclipse IDE to develope JSF projects. When I used to create a JSF file, it's extension is basically .jsp and when I ran that file in server .jsf extension used to be displayed in url. But recently, when I did the same thing I got .jsp extension in browser. in web.xml
when url-pattern is the following, .jsp extension is shown, eg: FileName.jsp
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
but when I change the url-pattern as per following, .jsf extention is shown , eg: FileName.jsf
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
even if I change the url-pattern to abc or xyz, the webpage url is shown in that format. eg: FileName.abc this is the actual scenario to specify extension of a jsf page, or is this an error.
View Replies
View Related
Feb 28, 2014
I have a large product with many maven projects, all of which can be hierarchically tracked back to the same parent. The projects have javadocs and whatnot.
Icommand line instructions (Windows 7) to generate the full API documents html on my local machine (of all the projects together). If there is a maven command for doing this from the CMD, more the better.
View Replies
View Related
Apr 22, 2014
How to find the total number of pages in java script .how to achieve it.
View Replies
View Related
Jul 19, 2014
So I have an application where the user logs in (using j_security_check). User is taken to a welcome page where user's name is displayed as a link. When clicking that link I would like to take the user to a page where the user is able to update the credentials (password, address, etc). In this way the user only has access to the link related to that specific user's credentials. I am trying the following structure:
The welcome page (adminindex.xhtml) is:
<h:form>
Welcome to admin <h:commandLink value="#{userb.loggedUser}" action="#{userb.selectedUser}"/>
<f:param name="userName" value="#{userb.userName}"/>
</h:form>
The user backing bean:
public String selectedUser() {
userName = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(userName);
selUser=uServ.findByName(userName);
return "UpdateUser";
[Code] ....
The last line of the stack suggests that a null PK value is being picked up by the FacesContext method in the backing bean. I'm confused because the userName string IS the primary key of the user table which is structured like this:
CREATE TABLE sha_users
( username VARCHAR(255) NOT NULL
, password VARCHAR(255) NULL
, PRIMARY KEY ( username ) );
I'm sure I'm getting the concept of how to pass query parameters...
View Replies
View Related
Jul 20, 2010
i want to create a program in java which counts the number of prints taken from a printer..
View Replies
View Related
Mar 18, 2014
I have a question about how to check for a session as the user goes through different pages. I am using Java beans and EL to pass data from page to page but I cannot figure out how to check for a session on the pages without the use of a scriptlet with an if else statement in it.
I do not want the user to be able to access any pages unless they are logged in. With a scriptlet, I can create a statement that says if session exists show name else redirect to login page.
From what I have read and what some of the wonderful members here have told me, scriptlets are a big no no these days. So, how do I do these without the use of a scriptlet?
View Replies
View Related
Feb 18, 2014
I need to parse an html web page to extract specific information from the tags in Java. For example,
<b>Species </b> Strain </td>
I need to look for the Strain info (Strain is variable in length) in the page. The whole web page is stored as a huge string. I need a regular expression that can identify all the Species and retrieve their corresponding strain info. how to do this or can propose some clever string manipulation methods in Java.
View Replies
View Related
Oct 20, 2014
I am working on this experiment code, I keep getting an exception:
run:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -256
at .MemoryManager.read(MemoryManager.java:68)
at .MemoryProcess.callMemory(MemoryProcess.java:39)
at .main(Lab3.java:29)
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
The offending line is data=RAM[physicalAddress]; inside MemoryManager.java.
why this is exactly happening and thus correct my piece of code.
The code:
main.java
package experiment;
public class Main{
/**
* @param args the command line arguments
[Code].....
View Replies
View Related
Apr 3, 2015
I have a Registration Form in which I am registering user to perform some sort like Entering messages I want to perform some Server Side validation.
Like suppose a user has Enter an Id then as soon as he start entering the Id then I want that this Id should be checked in database that if this Id exists in database or not.
and similar types of validation I want to apply on other fields to.
How can I acheive this?
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
Nov 7, 2014
I have a server written in java and can display html pages. but when i try to add css to the page the server doesnt use it.(not my code). Do you have to flag the browser to use css or something?
public class SimpleWebServer extends Thread {
public static final String VERSION = "SimpleWebServer";
public static final Hashtable MIME_TYPES = new Hashtable();
static {
String image = "image/";
MIME_TYPES.put(".gif", image + "gif");
MIME_TYPES.put(".jpg", image + "jpeg");
[Code] .....
View Replies
View Related
May 1, 2014
I have a random list of links whose title I am getting from the database. I'd like to catch one of these links when the user clicks one of them and process it from a single jsp file. Possible?
<ul>
<%
Random random=new Random();
TreeSet<Integer> ts=new TreeSet<Integer>();
for(int i=0;i<8;i++) {
randomInteger=al.get(random.nextInt(al.size()));
ts.add(randomInteger);
[Code] ....
E.g.: when user clicks one of these links, can I dynamically call a web page that fetches information from the click and gets values from a database and insert it on JSP page....
View Replies
View Related
Oct 16, 2014
How to make margin and next pages on printable in the java application???
View Replies
View Related
Apr 15, 2014
Trying to implement PageRank in a naive manner with graph nodes as pages and subsequent calculations. Correcting the code.
import java.util.*;
import java.io.*;
class PageRank {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter no.of pages");
int n=sc.nextInt();
[Code] .....
View Replies
View Related
Sep 26, 2014
I have two images. I want to be able to click them and kick off a call to a listener in Java to change a value in the bean. I also want the view to update my dropdown (labeled "menuModel") to either be rendered or not, depending on which image I click. Alternatively, I would be fine with the dropdown simply being disabled and enabled for the same criteria.
So far, the listener kicks off fine, and the value gets updated correctly in the bean. However, the view never gets updated. I have tried this a hundred different ways, but nothing seems to work. If I hit refresh on my browser, the view updates. But I want it to do it automatically.
I am using standard JSF 2.1.
<div style="font-family: Verdana; font-size: 10pt; color: #FFFFFF">
<h2>Calibrations</h2>
<h:form id="tunerSelectionForm" style="color: #000000">
<h:commandLink>
[Code] .....
View Replies
View Related
Jun 8, 2014
In some examples I see jsf components inside the tag view, other times dont.
- Is it important to put all jsf components inside "the view" tag?
- What would be the difference not putting them inside this tag?
View Replies
View Related
Feb 16, 2015
Is it possible to map URL's with independent view dir structure? If so how?
My goal is to simply point an url to a specific view file:
i.e.
[URL] ....
to
not/default/path/views/main/index.xhtml
and
www.myserver.com/application/admin/
to
not/default/path/views/admin/index.xhtml
A couple solutions I found so far where:
Solution 1
PrettyFaces
I just didn't wanted to use a third party solution. This is my best solution so far.
Solution 2(a JSF solution):
navigation rule entries in the faces-config.xml file.
A bean is required, not a bad thing in above example but not great in combination with static navigation like:<h:commandButton action="index"/>
Solution 3 (another JSF solution)
Resource Library Contracts
This forces me to work in the contracts file.
None of the solutions gave me a clear solution except prettyfaces.
Are there some elegant native JSF solutions ? Something flexible and reusable? Something like a mvc controller i used to use in php applications. In this controller I was able to add a template file in the constructor and an content file in specific function. Custom paths where no problem. I didn't want to use mvc nor the php language in this project.
View Replies
View Related
Sep 12, 2014
create an application following the MVC pattern. My frame is composed of a JTable with some JComboBox and classic next/previous buttons to page the table. The table shows data of current accounts of the members of a family. My problem is figuring out how the controller interacts with the view, for example to enable / disable buttons or reset and reload the data in the comboboxes. In the view class all the graphical components are private instance variables. What is the best approach to ensure that the controller can act on them?
I need to create in the view public methods to act on each component like getSelectedItemAccountCombo, getSelectedItemYearsCombo, getSelectedItemMonthCombo, populateAccountCombo (ArrayList <String> list), setNextButton (boolean b) ... and so on (I think that the methods would be many ...) This approach does not convince me because I think that the class is fouled by procedures that should be in the controller class.
View Replies
View Related
Feb 9, 2015
why get a runtime error when choosing option 2 after adding a contact?
Main:
package contactlist;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
[code]....
View Replies
View Related
Jan 23, 2015
I have to write a program that will generate 20 random circles with random radius lengths. If any of these circles intersect with another, the circle must be blue, and if it does not intersect, the color is red. I must also place a button on the JFrame. If this button is pressed, it needs to clear out the JFrame, and generate a new set of 20 circles following the same color rules. I am extremely new to Java Swing and am really stuck. I have everything working except the button. I cannot get a new set of circles to generate.
import java.awt.Graphics;
import javax.swing.JPanel;
import java.util.Random;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
[Code] ....
View Replies
View Related