JSF :: Getting Null Values From XHTML Page To Java Code

Nov 13, 2014

My project consists of a web app where a user can select a area from a picture and f.e. if it is a office layout he can input the worker name and any peace of hardware that the area might have. In this case there are two categories: Hardware and Computer. Hardware - it has 5 dropdown lists consisting of printer, scanner and etc. Computer - like Hardware consists of many dropdown lists which add up to components such as processor, motherboard and etc. For me, considering this is my first ever web app project, is a huge step towards web development, I have used various mixes of Java, javascript and primefaces code.

My current problem: When a user selects an area he gets a dialog box where he is prompted to select his desired input, afterwards the user clicks the 'save' button and get's another dialogbox which has a resume of what he has selected so he could check out his input and save it by clicking the 'save' button in the resume box. My problem is that when the user clicks the save button the button calls a method which takes all the input and creates an Area object (Area object consists of various objects such as: Coordinates, Dimensions, Employee, ComputerList and HardwareList) and sends a query to the database, but all the values I get is null.

XHTML code:

<!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://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">

[Code] ....

View Replies


ADVERTISEMENT

JSF :: XHTML Page - Access To Content Of Dynamic Page?

Jan 15, 2014

I have a xhtml file that initialization it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag.

<edges>
<ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar">
<edge id="#{indexVar.index}" source="#{edge.source}" target="#{edge.target}"
weight="#{edge.weight}">

[Code] ....

When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.

<edges>
</edges>

How can i access to content of this xhtml page and save it on disk?

View Replies View Related

JSF :: 404 Error While Loading XHTML Page While Implementing 2.0

May 6, 2013

I am new to JSF and when i try to implement a sample application im getting this wierd error of page not found(.xhtml). Here is the code i have created..

Bean class :

package com.trail.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class UserLoginBean {

[Code] .....

These are the jars ive used :

commons-logging 1.1.1
myfaces-api 2.0.7
myfaces-impl 2.0.7

View Replies View Related

JSF :: Call Variables Instead Of Methods From A Xhtml Page?

Jun 2, 2014

If I had this code:

<h:dataTable value="#{customer.customerList}" var="c"
styleClass="order-table"
headerClass="order-table-header"
rowClasses="order-table-odd-row,order-table-even-row"
>

And in the server getCustomerList() accessed to database, how many times getCustomerList() would be called from I request the xhtml page?. I have read this would be called several times because of JSF internals and It would be better to store it in a variable and access this variable.

1. Is this true this would be called several times? why?

2. If the previous statement was true, how to avoid it, I mean not call the method from a service?

View Replies View Related

JSP :: How To Print Null Values In EL

Dec 18, 2014

The value is: ${object1.property1} If the value of the property is null, I want "null" to be printed, like this:

The value is: null But I get an empty string, like: The value is:

I know I can use a ternary operator, but isn't there a simpler/shorter solution? A function (like NVL() in SQL)?

The value is: ${empty object1.property1 ? "null" : object1.property1 }

Not only is this long, but the value expression is typed twice, which is a magnet for bugs.

View Replies View Related

Compact Test For Any Of 4 Values Being Null

Apr 7, 2014

Any compact if statement or any type of test for checking if atleast ONE out of 4 integers is null. So 1 of all, 2 of all, 3 of all, or all of them being null will give a specific result ELSE do something else.

View Replies View Related

Better Way To Remove Null Values From Array

Dec 1, 2014

Is there a better way to remove null values from an array than what I have tried? This works just fine, but I just get the feeling that there is a better way to do this, without using the JCF.

private static String[] removeNullValues(String[] list){
int count = 0;
for(int i = 0; i < list.length; i++){
if(list[i] == null)
count++;

[Code] ....

I technically dont need to remove the null values for the project that I'm working on (since I just print it out and I can avoid null values with a simple statement like

if(update[i] != null) SOP(update[i])
),

but I'm just curious.

View Replies View Related

Objects Keep Printing Null And Zero Values?

Nov 3, 2014

Everything is written up and looks good and i get no compile errors but every student object other than the default constructor has null and zero values when printed.
 
import java.text.DecimalFormat;
import java.lang.Math;
public class Student
{
//instantiate variables
 
[Code] .....

View Replies View Related

String Comparison When Both Values Are Null

Aug 5, 2014

In Java is there  a method which  I can use to compare two Strings where in if both the values are null, they should be considered as equal?

View Replies View Related

Increase Size Of Array But Getting Null Values

Dec 3, 2014

I'm working on a program to create a blackjack game using objects (one for card, deck. and hand). Withing my hand object I am trying to add cards to the hand but it is only adding the last card i try to add and giving null values for the the ones before.

class BlackJackHand {
private BlackJackCard [] hand;
public void addToHand(BlackJackCard c) {
if (hand == null) {
BlackJackCard [] tempHand = new BlackJackCard[1];
tempHand[0] = c;
hand = tempHand;

[Code] ....

What I want this section to do is add cards to the current hand. I was intending for it the hand to be null at first and the if(hand == null) piece to add the card the first time and then the else piece would be used when the hand already has at leas one card. I want the else section to create a temporary array that is one larger than my current hand, copy the cards from the old hand to the new hand, and then add a new card to the last space before rewriting the old hand as what the temporary hand is.

The code I am using to test if the addToHand() is working is

class BlackJackTest
{
public static void main (String[]args) {
BlackJackCard c1= new BlackJackCard(1,0);
BlackJackCard c2= new BlackJackCard(1,4);
BlackJackCard c3= new BlackJackCard(1,5);
BlackJackHand h1 = new BlackJackHand();

[Code] .....

BlackJackCard has the parameters (int suit, int value)

This should print:
ace of clubs
4 of clubs
5 of clubs

but instead prints:
null
null
5 of clubs

View Replies View Related

Replacing Null Values Within Multidimensional Array

Feb 18, 2014

I have a file which contains certain positions ([a][b]) that require to be placed in a certain multi-dimensional array. For example I might have an array String[][] that is a size of 6x6 but only have values in positions [2][1] and [3][2]. Because it is important for me to maintain the given array size and also do certain actions with the given positions I cannot modify the size. In addition I need to count the surrounding neighbors each element has (including elements that are null). However because some of my further code cant process with null elements I need to remove all null elements with " " (blank).

I am not sure how this is done or if it's even possible. If it is not possible how can I do something as close as possible to my needs?

View Replies View Related

Code To Go From One Web Page To Next

Apr 24, 2014

I have a assignment in which the code has to scrape a web page for a little bit of data including the link to the next page, follow the link, and do this 100 times. It is scraping all the data correctly, including the link, but it isn't following the link to scrape the data on that next page. Instead, it is displaying the first page's data 100 times. I have the code in a while loop where it reads in one character at a time from the page into a string and then uses pattern matching to get the data and the next link from the string. Then it correctly displays the data and should loop back to connect to that next link and read one character at a time into the string and so on.

I have printed the link to the console and it is good. I don't get any errors. I just can't figure out where exactly the problem is. Here is my code:

import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.regex.*;
import javax.swing.* ;
public class SimpleWebSourceGetter{
static void getSourceCode(String url) {
String mystring = "";

[Code] ....

View Replies View Related

Servlets :: How To Set Values Into JSP Page From Database

May 30, 2014

I want to set the values coming from database with multiple field's Through AJAX and Custom XML. How to do ???

View Replies View Related

JSP :: Unable To Pass Values From Page To Servlets

Aug 12, 2014

I am trying to pass values from JSP Page to Servlets but I am getting a NullPointerException

Here is my JSP code

<html>
<head>
<title>Student Registration Form</title>
<style type="text/css">
h3{font-family: Calibri; font-size: 22pt; font-style: normal; font-weight: bold; color:SlateBlue;
text-align: center; text-decoration: underline }
table{font-family: Calibri; color:white; font-size: 11pt; font-style: normal;

[Code]...

View Replies View Related

JSP :: Dynamic Text Box - Display Values In Next Page

Mar 21, 2011

I am new to jsp .i created a wepage in jsp. That's i need to create dynamic textboxes in jsp and want to display the values of the textbox in next page.

View Replies View Related

JSF :: How To Convert Hashmap Values To Arraylist To Display On Page

Apr 2, 2015

I need assigning the selected hashmap values into a list and to display the values in a jsf page. The user will select certificates and will be stored in the below list:

private List<String> selectedCertificates = new ArrayList<String>();

The selectedCertificates will have the values ("AA","BB"). Now I will be passing the list into a hashmap in order to get the names and to display them on the jsf page.

My code is below:

Map<String, String> CertificatesNames =
new HashMap<String,String>(selectedCertificates.size());
CertificatesNames.put("AA", "Certificate A");
CertificatesNames.put("BB", "Certificate B");
CertificatesNames.put("CC", "Certificate C");
for(String key1: selectedCertificates) {
System.out.println(CertificatesNames.get(key1));
}

I want to display in my jsf page :

Certificate A
Certificate B

Now my issue is that is how to display all the values of the CertificatesNames.get(key1) in the jsf page as I tried to do the below and it printed all the values when I used the #{mybean.beans} using the :

List beans =
new ArrayList(CertificatesNames.values());

So how to do this?

View Replies View Related

Code To Connect HTML Page To Teradata Database?

Apr 17, 2015

I have designed a login page for my project....which has username and password box....I have created a Table in Teradata which has username and password information....now i need to connect this html login page to Teradata database to validate the username and password.

View Replies View Related

Servlets :: HTML To Servlet And Come Back To Same Page With Field Values

Apr 11, 2014

i have one html page ,inside html radio button and 3 textboxes and one submit button ->action->SampleServlet.java-> from here again come back to html page with checked radio buttton value and text box value. I dont want to click back button in this case, html page to servlet->here i have to call back to my html page with checked radio button and text box value .

I tried response.redirect(original.html)-->i cant able to display checked radio button and textbox value also tried requestdispatcher forward/include,html page comes newly from starting but i dont want it,i want to view in html page with checked radio button and text box value.

View Replies View Related

JSF :: Display Values Of Selected Checkboxes On Page After Submitting Form

Feb 13, 2014

I have the following simple "selectManyCheckbox" specified in my jsf page:-

<h:selectManyCheckbox id="animalsmc" layout="pageDirection" value="#{animalSelectionBean.selectedAnimals}">
<f:selectItem itemValue="1" itemLabel="Lion"/>
<f:selectItem itemValue="2" itemLabel="Tiger"/>
<f:selectItem itemValue="3" itemLabel="Elephant"/>
<f:selectItem itemValue="4" itemLabel="Eagle"/>
<f:selectItem itemValue="5" itemLabel="kangaroo"/>
</h:selectManyCheckbox>

I have the following specified in my bean class:-

private int [] selectedAnimals;
...
public int[] getSelectedAnimals() {
return selectedAnimals;
}
public void setSelectedAnimals(int[] selectedAnimals) {
this.selectedAnimals = selectedAnimals;
}

I would like to know how to display the values of selected checkboxes on the JSF page after submitting the form? I tried outputtext, however it displays the object and not the values. I cannot even frame the outputformat for the same.

View Replies View Related

Code Required In Form Of Key Values

May 20, 2014

Suppose I have the file in a particular directory with the below conntent starts with the below line -

5/15/2014 2:07:36 PM : 10 - 10 : *** Loading XML file DSH_000001_pos.xml ***

After that the content is shown below.

5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for PERIOD DSH - TRDBOOK +NSCCL :INR - HOUS - (INR).
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for Exchange Complex NSCCL PERIOD Exchange Complex (INR).
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for Combined Commodity ANDHRABANK - ANDHRABANK PERIOD Combined Commodity (INR).
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for PERIOD DSH - CFDTRADING +ASXCC :GBP - HOUS - (GBP).
5/15/2014 2:07:36 PM : 20 - 30 : For <ecPort> ASXCC can't find required associated object <clearingOrg>

[code]....

View Replies View Related

Code That Find Median Value In List Of Values

Mar 19, 2014

a simple Java program for finding the median value in a list of values with the following requirements:

- Create an array with an even number of values in it (an odd number of values is little bit trickier, so if you want a challenge, do it for either an even or odd number of values)

- Find the value with an equal number of values greater than the value as there are values less than the value

- Your solution must not require a sorted list of values - Output the median value

This assignment is intended to get you to demonstrate basic knowledge of arrays, and to create methods with both input and output.

View Replies View Related

JSP :: JSTL Code To Fetch Text Field Values Dynamically

Apr 16, 2014

I am generating textfields dynamically using JSTL forEach. Here is the code ..

<c:forEach var="underlyingTickers" items="${underlyingTickersList}" >
<tr>
<td ><input name="underlyingTickers" type="text" id = "underlyingTickers" value="<c:out value='${underlyingTickers}' />">
</td>
</tr>
</c:forEach>

If there are 4 values in underlyingTickersList A, B C, D and E ... I am getting those values correctly displayed in each text field.

However if I submit the form with all these value how can I get it in the bean? I guess I need to have dynamic id or name for each text field. How can generate it?

Note** I dont have Struts framework.. I am using request.getParameter to fetch the values and set into the bean variable.

View Replies View Related

Null Pointer Access Variable Can Only Be Null At This Location

Apr 16, 2014

I'm getting an error on line 137 and all it is rsmd = rs.getMetaData();The error happens only after I press a JButton and it is

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerExceptionat softwareDesign.createAccount.actionPerformed(createAccount.java:137)

There is a lot more to it but that has nothing to do with my code it's just the stuff with Eclipse anyway I want to know how do I fix this problem?

View Replies View Related

Why To Get Result Brand Null / Colour Null

Feb 28, 2015

public class Test {
public static void main(String[] args) {
Car c = new Car();
c.setInf("toyota", "red");
System.out.println("name: "+ c.brand + " colour: " + c.colour);

[code]....

Why do I get the result brand null, colour null? I know what null means but what am I missing here?

View Replies View Related

JSF :: How To Check Condition In Xhtml

Mar 26, 2014

I need to display button based on the condition in xhtml page.

using JSF2 & richface 4.0
<c:forEach items="#{empList}" var="emp">

How to check condition like empList.size > 0 in xhtml?

if list is having value, need to show buttons.

View Replies View Related

JSF :: Binding Xhtml And Bean Not Working?

Mar 29, 2014

I am working on eclipse kepler, JSF 2.2 with PrimeFaces 4.0 / Mojarra 2.2 library.

actually there are 2 Problems:

I still get this server message no matter what I do.

(( javax.el.PropertyNotFoundException: /Order.xhtml @28,76 value="#{kk.refugee.id}": Target Unreachable, 'refugee' returned null))

and if I delete the input text puls the hidden, the message keeps pop up for 'material' selectOneMenu. -

I have no chance to examin : ((is this javascript code correct, to copy the value of one component to the other.)) these are my xhtml file and java calsses.


**kk.java**
-----------
package khldqr.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@SessionScoped
@ManagedBean
public class kk {

[code]....

View Replies View Related







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