JSF :: Unable To Set Prime-faces Data Table Column FilterMatchMode In Managed Bean

Nov 13, 2014

I have a requirement where in my primefaces datatable ,the filterMatchMode attribute(like any part of field,whole field) needs to be selected by the user by select menu .

To achieve this i have declared a variable in my viewscoped managed bean as filterCriteria and set the filterMatchMode attribute as filterMatchMode="#{beanName.filterCriteria}".The bean variable is getting set in the managed bean on submit but the filtering is not happening,i am getting empty message.

Also when i remove the keyed in value from filter box the data table is not restored which otherwise must be restored in normal situations. I have used and modified the example code given in primefaces showcase here.The code snippet is as below

<h:form id="tblFrm">
<h:selectOneMenu id="filterOptions"
value="#{dtFilterView.filterOption}" required="true"
requiredMessage="You must select an option!">
<f:selectItem id="hd1" itemLabel="Select" itemValue="#{null}" />

[code]....

View Replies


ADVERTISEMENT

JSF :: Get Data From Managed Bean Method After Servlet Filter

Feb 15, 2015

I have a situation to load data while JSF page loads. Also have a filter which populates user information from http request.

I was expecting the filter first to populate the user information and in the managed bean get method to verify the user information and get the data (from database). But in this case i see the managed bean get method is invoked before filter populates user information and i get null pointer exception because the user information is null.

I had to work around to get the user information from FacesContext in the managed bean get method because the user information wasn't available. Is there a way to make sure the filter is invoked first?

View Replies View Related

JSF :: Printing Only Part Of Prime-faces Page?

Jan 15, 2014

I have a print button as below

<p:commandButton id="printit" value="Print" type="button" icon="icn-print">
<p:printer target=":topForm:data" />
</p:commandButton>

when i click print button only top half of the page is getting printed and bottom half is pushed to next page. How do i fix this issue.

View Replies View Related

How To Insert Value Into SQL Server Table Column Of Data Type Datetime With JDBC

May 8, 2014

How can insert value into sql server column of data type 'datetime' with jdbc the methods in java.sql are 'setdate()' and 'setTime()'

How can I do this. I'm using java.time.LocalDateTime.

View Replies View Related

JSF :: Managed Bean Is Not Getting Instantiated Intermittently

Jun 5, 2014

I have a JSF bean which is request scope and corresponding JSF UI page. when user tries to open this page, we are getting exception 'Cannot instantiate user.java class <default constructor>'. This does not come always. It comes very rarely. JSF version is 1.2

View Replies View Related

JSF :: Create A Managed Bean Per View

Jun 11, 2014

About creating views,

1. When we have a view and this uses two or three managed beans and not only one, is this ok? is a good design?

2 If we have two views and both of them only share one functionality (they need to display datatable with clients) , for the second view and for the shared functionality, should I in the managed bean for the second view create the same method that gets the clients or reuse the method in the managed bean created for the first view?

View Replies View Related

JSF :: Count Number Of Views Created In A Session While Using Managed Bean With View Scope

Jan 30, 2014

I am trying to restrict the number of views in JSF 2.0.2 using

<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>5</param-value>
</context-param>

In my case my managed bean is View Scoped and it supports a UI page which has multiple forms and each form is submitted as AJAX POST request.

As per the statndard, setting restriction to 5 should create 5 views and after that based on LRU algorithm the oldest views should get deleted if 6th views is created.

Therefore any action on the oldest view will throw the ViewExpiredException and i simply redirect the user to view expired page.

1) When i set the restriction to 5 views, i open 4 tabs with 3 forms each.
2) I submit the 3 forms on first tab everything works fine.
3) As soon as I go to 2nd tab and submit the first form thr, i get view expired exception
4) It seems I am exceeding the number of views I mentioned in web.xml

I want to know :

1) Does every AJAX POST submit itself creates a view ?
2) How I can count the number of views created in a session ?
3)Can i force expiry of a view in JSF 2.0.2 while the session is still alive ?
4) Normally JSF 2.0.2 session cachces the views. Lets assume session is alive the entire day but a view was created in morning at 9:00 AM and is not used again the entire day. Assuming that session doesn't reaches the max number of views it can save in entire day, will the view created in morning expire on its own after certain interval of time ? If not , can we still force its expiry while keeping the session alive ?

View Replies View Related

JSF :: How To Read CSV File From User Defined Directory Path For Loading To Managed Bean

Jan 10, 2015

I'm using a PrimeFaces UploadedFile xhtml page to select a csv file to read and write using a managed bean (SuperCSVParser.java). The file is read and written to an entity class which then persists the data to a database. The application works fine if I specify a file path on the physical server and select a csv file on that file path. But for the production version I want the user to select ANY file name from ANY directory on their local system.

I know about the FacesContext methods and I've looked at some methods from the java.io File class. Most of these methods are about getting the path from the server, where I want to 'pass' the path String from the client machine to allow the uploaded file to go through. When I try with the below code I get:

java.io.FileNotFoundException: data.csv (The system cannot find the file specified)

I'd like to know what I'm doing as I prefer not to explicitly declare a path in the final app. I'm almost sure that's possible.

<h:form enctype="multipart/form-data">
<p:fileUpload value="#{SuperCsvParser.file}"
mode="simple"
auto="true"

[Code].....

View Replies View Related

JSF :: Null Pointer Exception While Creating File From Resources In Managed Bean Class

Feb 7, 2014

i want to list files from resources folder like this:

@ManagedBean
public class galley implements Serializable {
private List<String> list;
@PostConstruct
public void init() {
list = new ArrayList<String>();

[Code] ....

but it give me a null pointer exception on fList .... The directory of resources is :

How is this caused and how can I solve it?

View Replies View Related

Enterprise JavaBeans :: Does Container Managed Entity Manager Is Thread-safe In Stateless Session Bean?

May 8, 2014

I read JEE6 doc and confused with : Does container managed entity manager (injected by PersistenceContext annotation) is thread-safe in stateless session bean in multiple-thread env?
 
See code below, if there are 2 requests to stateless sesion bean in 2 concurrent threads ,  is it using same Entity Manager Instance or not?
 
@Stateless(name = "HRFacade", mappedName = "HR_FACES_EJB_JPA-HRFacade-HRFacade")
public class HRFacadeBean implements HRFacade, HRFacadeLocal {
    @Resource
    SessionContext sessionContext;
   
    @PersistenceContext(unitName = "HRFacade")
    private EntityManager em;
 
[Code] .....

View Replies View Related

JSF :: XHTML On One Server Can Talk To Managed-bean On Other Server (different Machine)?

Jul 27, 2014

I am developing a web application using JSF-2.0 on weblogic 10.3.6. I am using Facelets as VDL. I have 5 different machine. They are different according to their OS and their geographical location. On my first xhtml page server (machine) is decided. Then on next page file upload and rest of processing takes place. My restriction is that SSO configuration can be done on only one machine.

So I am restricted to using xhtml files from only my primary server where SSO configuration is done. But I have to connect to servlets or managed-bean of different machine as requests are machine specific and file needs to be uploaded to those machines for processing. So I cannot use redirectUrl as I need to be only on one machine. Is it possible that xhtml on one server can talk to managed-bean on other server(different machine)?.

View Replies View Related

Unable To Find Prime Palindrome Numbers Less That A Number By Program

Oct 10, 2014

I want to find the prime palindrome numbers less that a given number by my program. Here is my code, I am trying to find the method to solve the errors when I compile it. It said variable a might not have been initialized in line 41,62,86.

import java.util.Scanner;
public class Lab5{
public static void main (String[] args){
System.out.println("Please input a number");
Scanner Input=new Scanner(System.in);
int num = Input.nextInt();

[Code]...

View Replies View Related

JSF :: Unable To Add Mysql Table Columns To Table

Apr 29, 2014

I'm trying to add some mysql table columns to JSF table. And I'm getting error:

/index.xhtml: The class 'logon.User' does not have the property 'description'.

User.java
package logon;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

[Code]...

View Replies View Related

How To Get The Value Like Numbers From Column Of Table And Get Sum Or Total

May 5, 2014

Is it possible to get the value(like numbers) from column of table and get sum or total?

View Replies View Related

How To Merge Two SQL Table Columns Into One JTable Column

Sep 5, 2013

I have a database table containing two columns A and B. They both contain integers. I'd like to know if it's possible, when displaying them in a JTable, to be combined in one column X. I still need, however, to be able to distinguish them from each other when selecting a row from the JTable. E.g. to store each of the values in a a separate variable. Maybe I can combine them when reading from the ResultSet and use some sort of delimiter ? But how?

View Replies View Related

Swing/AWT/SWT :: Check Boxes On First Column Of Table

Sep 10, 2014

From what I can determine check boxes are applied in SWT to the first column only of a table.

final Table table_project = new Table(g3_tabfolder_projects, SWT.BORDER | SWT.CHECK);

However I require check boxes on all cells. I tried creating a table for each column (which gives me my check boxes) but as the number of enries are often numerous and thus require vertical scroll the tables become out of sync (and to the user that sync is important).

Before I knock up some code to try and synchronise the tables I just wanted to check any alternative approaches. The project is SWT based.

View Replies View Related

How To Make A Table - Put Label For Each Column To Identify What Values Are

May 27, 2014

So I just processed this rectangular array and made myself a table. I want to put a label for each column to identify what the values are. My attempt at this failed miserably, because it looks horrible. Here is the necessary code.

Java Code:

System.out.println();
System.out.println("FORMATTED RESULTS");
System.out.println(results);
values[rowCount][0] = currency.format(monthlyInvestment);
values[rowCount][1] = percent.format(interestRate/100);
values[rowCount][2] = Integer.toString(years);
values[rowCount][3] = currency.format(futureValue);
rowCount++;

[Code] .....

If you are to compile this yourself, you would see the horrible output at the end. I would like to know how to properly align each label with its corresponding column.

View Replies View Related

JSP / JSTL :: Adding Column With Checkboxes For Each Record In Table?

Mar 18, 2013

How I can add a column with check boxes for each record in my table in JSP? Also, I want to figure out a way that what records the user has checked!

View Replies View Related

Swing/AWT/SWT :: Set A Column In A JTable To Make It Unable To Gain Focus?

Jun 29, 2007

How would you set a column in a JTable to make it unable to gain focus i.e. select the next column on the same row or ignore the command completely when selecting a column that should not be able to be gained focus on?

View Replies View Related

JavaFX 2.0 :: Handle Table Column Re-position / Movement Event

Sep 4, 2014

How to catch the event when table view's column are re-positioned. Basically when the column is re-positioned from 1 position to 5 position ,  i want to do update the db.

View Replies View Related

Adding Data In Table But The Table Is In Another Frame

Mar 13, 2014

This is my codes in a button that if I click it . that information will send to Jtable but the problem is the jtable is in another frame so how can i connect this ?

DefaultTableModel model = (DefaultTableModel)
new admin().tableBagtags.getModel();
if (txtName.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Please fill out all fields.", "Error!", JOptionPane.ERROR_MESSAGE);

[Code] .....

View Replies View Related

Swing/AWT/SWT :: How To Make One Auto-increment MySQL Table Column Invisible

Dec 8, 2014

The problem is that I populate the table with autoincrement primary key. I don't want it to be visible. I have been googling for hours to find no solution. It seems that sql/mysql provides no solution by selecting all table columns except one. So I wonder, how I could overcome this problem. Here is some of my code:

public void tableChanged(TableModelEvent e) {
int row = e.getFirstRow();
int col = e.getColumn();
model = (MyTableModel) e.getSource();
String stulpPav = model.getColumnName(col);
Object data = model.getValueAt(row, col);

[Code] .....

The ID is used in

stmt.addBatch("update finance.fin set " + stulpPav + " = " + duom
+ " where ID = " + studId + ";");

I tried to omit ID from my SELECT statement, I tried to put Date as a first element in data[iEil][0] but neither options were successful. Data hasn't been changed in database. NOW, everything works fine, except I don't want ID column to be visible in my table.

View Replies View Related

Enterprise JavaBeans :: How To Refresh JPA Data When Table Data Is Updated From Backend

Nov 27, 2012

Is there a way to inform the Entity Manager or force the JPA provider to reload data from the database? The scenario could be data being updated by a store procedure or direct SQLPlus maintenance, without restarting the Application Server, the JPA need to load the newly updated data from the database.

I think the current JPA API is not enough. The void refresh(java.lang.Object entity) from EntityManager need to pass in the Entity object, I will like to know how to refresh the entire JPA Entity data after the physical table data being update from backend.

View Replies View Related

Writing Data To A Static Table - Can't Populate All Fields With Data

Jun 24, 2015

I have a program which consist of several classes. The program reads a pom file and parses the data and then writes the data to a static table. The issue I'm having is with writing my LIB file data to my table. In the HtmlDataTable Class Im trying to write the files that are read in the lib directory to the table. My table currently consist of 3 columns (missing jar files,Lib Directory files, and POM file data) currently Im only able to write the missing jar files data to my table. In the HtmlDataTable class there is a for statement where I write the missing jar file data to my table. Im also trying to write the contents of the Lib directory within this statement as well. This is where I'm having my issue. My other classes consist of a SAX parser which parses the xml file, a class that creates my static table and a class that compares the jar files in my lib directory to the jar files in my pom file. . Theres a lot of code so I included the parts I felt were useful. If needed I can include the other classes as well.
 
public class ReadPomFile extends DefaultHandler {
public static void main(String[] args) {
try {
// obtain a SAX based parser to parse XML document

[Code].....

View Replies View Related

Parsing CSV File - Column And Row Data?

Dec 19, 2014

I am trying to merge two files together using the Apache Commons CSV library. I figured it was easier to use this than to write my own implementation.

The first problem is that the output contains the underlying class logic and as a results my output contains a bunch of un-needed data. How do I get rid of this? I just want the column and row data, nothing else.

Example

I want this:

customerNo, firstName, lastName, birthDate, mailingAddress, married, numberOfKids, favouriteQuote, email, loyaltyPoints
1, John, Dunbar, 13/06/1945, 1600 Amphitheatre Parkway Mountain View, CA 94043

But I get this:

CSVRecord [comment=null, mapping=null, recordNumber=1, values=[customerNo, firstName, lastName, birthDate, mailingAddress, married, numberOfKids, favouriteQuote, email, loyaltyPoints]]
CSVRecord [comment=null, mapping=null, recordNumber=2, values=[1, John, Dunbar, 13/06/1945, 1600 Amphitheatre Parkway
Mountain View, CA 94043

The second problem is that I just want the row Headers from the first file, but the row headers from my second file are still being included in my output. I used withSkipHeaderRecord(true), but it didn't have the desired results.

Code is below.

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;

[Code] .....

View Replies View Related

Filtering MySQL Data To JTable In Particular Column

Jun 11, 2014

I have a jtable. the fields are like Product_code,Product_name,Qty,Rate in my java program.. now i want to do is when i press a first letter in my jtable under Product_name like "P" it will display the reminding Product_name which will have the starting letter of "P" like pen, pencil, peper like this i want to populate in my jtable.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved