JSF :: SelectOneMenu Control Not Returning Selected Value
Aug 18, 2014
I am having a problem with the SelectOneMenu control. I want the the selected item to be be displayed via the valueChange Ajax event listen. But this is not happening.
However, when I change the value in the SelectOneMenu and then click on the Submit button, then selected value is getting displayed via the 'save' bean function
The relevant xhtml code is as follows:
<!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:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<style type="text/css">
[Code] .....
View Replies
ADVERTISEMENT
Apr 4, 2014
I'm trying to implement a functionality which will control the visibility of three outputText. I'm using a selectOneMenu, which has three options. Each option will enable visibility of one outputText, and rest will be invisible.
I used the following code
<h:selectOneMenu id="search" styleClass="select-box" value="#{empMB.showHide}" required="true" requiredMessage="Please Select an Option" >
<f:selectItem itemLabel="-----Select----"/>
<f:selectItem itemLabel="By Name" itemValue="1"/>
[Code] ....
Initially all outputText s is invisible as rendered value is false, but when I select different options, their respective outputText s are not visible.
View Replies
View Related
May 19, 2014
I am working on shopping cart application in which i want to generate selectonemenu dynamically for setting Item attribute from database.for eg, I have 4 tables item, attribute,attribute_value and mapping of this three. Now i want that I ask user to select attribute for item and than assign value.to assign attribute to item i created checkboxlist that is working perfectly then i want that selected attribute as label and their value appear inside dropdown.
i made to display but get confused when it comes to storing this value in database confused in red underlined place..This is without any dynamic generation but i think solution is dynamic component but dont know how code snippets:
<c:forEach items="#{itemManagedBean.allAttribute}" var="att">
<h:outputText value="#{att.key}" title="">
</h:outputText>
[code]....
View Replies
View Related
Oct 31, 2014
The company entity contains companyName, Sector and Segment columns. The mapping is 3 entities (Company, Sector, Segment) where Sector and Segment are used to create a company record. Sector has a OneToMany relationship with Segment and with Company. I put the Sector and Segment values into two select menus as use these to create a Sector and Segment reference for the Company table. I'm getting the following exception:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row:
a foreign key constraint fails (`testdummy`.`company`, CONSTRAINT `FK_COMPANY_FK_COMPANY_SECTORID` FOREIGN KEY
(`FK_COMPANY_SECTORID`) REFERENCES `sectors` (`SECTORID`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
I'm thinking that the problem is that since the Segment entity is a child of Sector it must be entered through an instance of Sector. Because it's being entered as a separate value I'm getting this error. The problem is Segment is defined as a Set in the Sector entity and I can't figure out how to declare Segment as an instance using its parent entity (Sector).
My code is as follows, starting with the Sector entity:
@Entity
@Table(name = "SECTORSNEW")
public class SectorsNew {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int sectorId;
private String sectorName;
@OneToMany(cascade = CascadeType.PERSIST)
[code]....
View Replies
View Related
Oct 11, 2014
Is there a way you can control user input?
For example, is it possible to only allow the user to enter digits?
View Replies
View Related
Nov 18, 2014
how am i supposed to make line1B with "1f" and line2B with width of "10f"?
PHP Code:
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
[code]....
View Replies
View Related
Sep 2, 2014
So I'm working on some networking code and I have the Server running as its own thread, then I have a PacketListener which is contained in the Server, that is running on its own thread too. As of right now, the PacketListener waits for packets via DatagramSocket.receive() and then adds them to a queue. The Server runs in a loop and it checks that queue for packets and then polls the most recent and process it before sleeping for 1 millisecond. Here is my question though, I'm considering changing the program to a more observer pattern structure in that when the PacketListener would receive a packet, rather than add it to the queue, it'd notify the server which would process it. However, wouldn't this cause additional time required within the PacketListener thread dedicated to processing the packets rather than listening for them?
View Replies
View Related
Jun 14, 2014
I have a multithreaded java program. I have a few worker threads which process data over a udp server. Then I have another thread for console input. The problem is when there is an error with one of the worker threads, and it prints to the console, my console thread loses "focus", that is, the while loop seems to no longer run. Here is the console thread:
Java Code:
public void run() {
Console c = System.console();
if (c == null) {
Logger.writeError("No console.");
System.exit(1);
}
while(true){
String login = c.readLine(">>>: ");
System.out.println("You entered: " + login);
}
} mh_sh_highlight_all('java');
When an exception is raised, it prints it to the console, and suddenly the program no longer shows the >>> prompt from above.
View Replies
View Related
Jul 24, 2014
I'd like to ask is there way to control the RMI lookup timeout through programming or network configurations.
In a testing environment, I have purposely disconnect or plug out the cable between two testing servers to check the reliability.
It took very long time for the RMI API to throw out java.rmi.ConnectException which used Naming.lookup(givenURL).
I have tried to set system properties like sun.rmi.transport.tcp.handshakeTimeout, but it didn't take effect at all.
View Replies
View Related
Apr 1, 2014
I'm a student designing and developing an Air Traffic Control (ATC) system for incoming aircraft, mainly implementing the part which handles the queuing system for approaching aircraft.
View Replies
View Related
Apr 23, 2014
Java code to build control flow graph of any user program in jframe...
View Replies
View Related
Feb 24, 2015
How to Write Program with out using control structures
IMG_4216.JPG
View Replies
View Related
Jul 22, 2014
I have developed JavaFx application with playback option using JavaFx Media player and slider controls. I am updating slider value using javafx mediaplayer.currentTime().addListener() method by adding Change/Invalidate listener.
While playing MP4 video, slider values are not updating (Change/Invalidate listener not getting triggered while playing video) on Mac OS(version : 10.9.1). Below is the sample code snippet.
mediaPlayer.currentTimeProperty().addListener(new InvalidationListener() {
@Override
public void invalidated(javafx.beans.Observable o) {
updateSliderValue();
}
});
View Replies
View Related
Dec 5, 2014
I am currently building a java music player and need getting the volume control to work. I want to be able to set the computers volume directly using an integer. I've created a slider and put the value into an integer. The part that I am having trouble with is getting the volume to work.
View Replies
View Related
Mar 11, 2014
I am writing a program where i am trying to control a rectangle and determine where it moves, everything is working fine it is moving but i am trying to figure out how to change direction using the "WASD" keys. This is what I have and I am not sure why its not working.
Java Code:
addKeyListener( new KeyAdapter() {
public void keyReleased(KeyEvent event) {
for (MoveableShape creature : creatures) {
if (((Creature)creature).isPlayer()) {
if (event.getKeyCode() == KeyEvent.VK_W) //up
[Code] ....
View Replies
View Related
Jul 26, 2014
I am going to to develop an app for my final year project. basically the app is to show live video streaming on android phone from remote CCTV . The project is just in design phase i know the networking part i.e static ip for dvr etc but i dnt know how to get stream of data from dvr and how to control the CCTV camera i.e camera movement....
View Replies
View Related
Jan 26, 2015
How can I set the default stylesheet for a user control that I have created? I want to make the control available for anyone to use and I want it to use a stylesheet by default without the user of the control having to do anything. I also want it to be possible for the user of the control to override the definitions set on the default stylesheet if he wants to.
View Replies
View Related
Feb 4, 2015
My question is regarding the the Inversion of Control (IoC) and Dependency Injection (DI) patterns, when learning about Spring i saw that people keep talking about Ioc and Dependecy Injection like if its the same thing!
View Replies
View Related
Nov 5, 2014
TabPane and Pagination controls. However, I would like to be able to create a vertical toolbar that controls page or tab display.
Is it possible to create a Pagination with no page control? Or is my guess of sizing the Pagination control so that the lower section is off of the displayed window, thus hiding the page info? Or, is it possible to create a TabPane with panels, but no tabs?
View Replies
View Related
Apr 2, 2014
When I am watching scjp mock test, I am getting error about security.
I am trying to add www.javaranch.com to site exception list in java control panel. I can see security tab in java control panel, there I find field for Site Exception List. When I am add [URL] .... to this site exception list, list is not getting populated.
Why is that ? Why am I unable to add this site to list ?
I am using 64-bit system and have downloaded and installed 64 bit update patch 51.
View Replies
View Related
May 21, 2014
If I use an instance of Tooltip in my custom-control, it can not be imported to SceneBuilder any more. Using Tooltip in my custom-control skin works - is that the way it is supposed to be?
Background: I have a control (ValidatedTextField) which uses Tooltips to inform about unwanted characters. It works in SceneBuilder1.x.
SceneBuilder 2 does not "accept" this control unless I take out all Tooltips. I have verified this behavior with some other working controls.
I have found a workaround to use the Tooltip in the Skin.
View Replies
View Related
Nov 30, 2014
I'm currently writing a small program, where I need to save data into a Defaulttablemodel in a jTable.I have to save the name, a number and the email-adress.I added a button which opens a new JFrame and there I need to change the email and/or the name.My current solution is far from good: No matter which row I select, i can only update the "newest" row (last created). How can I visualize the values of the selected row (out.println// or whatever) so I can go further and overwrite these values.My Code when I click on Update:
int zeilenwahl = jTableStudenttab.getSelectedRow();
// System.out.println(jTableStudenttab.getSelectedRow());
if (zeilenwahl != -1) {
this.setVisible(false);
new Bearbeitung().setVisible(true);
} else {
JOptionPane.showMessageDialog(rootPane, "Zum Bearbeiten Zeile auswählen");
}
Here is where the mistake is (probably)
public Bearbeitung() {
initComponents();
jTextFieldvorname.setText(Student.vorname);
jTextFieldnachname.setText(Student.nachname);
matrikelstring = matrikelstring.valueOf(Student.matrikelnummer);
jLabelmatrikelwert.setText(matrikelstring);
jTextFieldemail.setText(Student.email);
}
View Replies
View Related
May 18, 2014
try {
System.out.println("1");
int row = jTable4.getSelectedRow();
System.out.println("row");
String str = (jTable4.getModel().getValueAt(row, 0).toString());
[Code] .....
I select the first row the value is 0
I select the second the value is still 0
View Replies
View Related
Nov 8, 2014
I am making an edit page and I want to populate my drop down menu with things that were already selected. For example, if i want i click to edit my favorite food it will be populated with the one the user previously selected. How do i go about doing this? [URL] ....
View Replies
View Related
Oct 9, 2014
I was wanting to select an item in a comboBox and display it in a text field but all it's doing at the minute is retrieving the first item in the comboBox and placing that in the txt field
String value = (String) comboBoxEnv.getSelectedItem().toString();
if(comboBoxEnv.getSelectedItem()!= null){
txtTo.setText(value);
View Replies
View Related
Apr 16, 2014
If I have a ComboBox and I want to copy the selected value to textfield. How can I do it?
View Replies
View Related