Table data does not refresh
Using LV2010.
A table displays the test configuration that has been selected by the user. This appeared to work fine until recently.
Nothing in that area of the code has changed .
The issue is that although valid data exists on the wire and it even gets written to file, nothing is displayed in the table.
The operator can click multiple times and nothing is displayed. Even when running with highlight execution turned ON, the table does not get refreshed.
Unfortunately, each time the operator click the button to insert the configuration, it does. But it is not displayed. The same list goes to the table. You would expect the subsequent attempts would cause all the items to be displayed when it finally does, but no... only the last selection gets displayed.
I've recently taken over the project and did notice that a previously working feature was not working. That feature was to allow multiple selections to be inserted at once. I suspect the feature still workes, but the table only displays a single line of data.
I did find a thread that started to discuss a similar behavior with a link to a description of the bug, but that page appears to have dissappeared from the website. It was discussed in 2005.
Is there a way to force a refresh display on a table? Another thought... Could it be that the table is displaying data from a portion further down the list which makes it appear as if there is no data? As I said earlier, this section of code was not touched and it is the only area where the table data is updated and the display refreshed..
Has anyone else seen this behavior?
As can be seen above, the probe does "see" the data on the wire. The screen capture was taken after the data flow had completed the entire state. The wire itself claims to have a 2D array of 1 X 11 elements. Normally, this data would be displayed. I can't think of why it wouldn't be displayed. If I could, I wouldn't be posting this..
I am curious if this is a LV bug...
Attachments:
TableDataInvisible.PNG 21 KB
You know me & locals...
Plus the property node was used for something else.
I fear using the VI Analyzer would... well... euh.. hummm... how to say this,...
blow up..
LOL!!
Similar Messages
-
Advanced Table does not refresh after database level action
Hi,
I have a page which has an advanced table. I update the advanced table from the page do some validations, update some DB level columns(also part of advanced table) and see that the changes are saved to the DB but the advanced table does not show the updates done at the DB level.
I tried clearing the VO Cache and re-executing the VO but still it does not refresh the Advanced table data.
This is very critical requirement for the client, any inputs will be greatly appreciated.
Thanks a lot in Advance.
Here is the code snippet from my CO's processRequest:
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAAdvancedTableBean tblbean = (OAAdvancedTableBean)webBean.findChildRecursive("recasttable");
if(tblbean!=null)
tblbean.setRendered(true);
OAApplicationModule tblam = (OAApplicationModule)am.findApplicationModule("RecastLineAM1");
tblam.invokeMethod("initQuery");
tblbean.getTableData();
Here is my AM - initQuery() code:
public void initQuery()
//clearVOCaches("RecastLineEO",true);
clearVOCaches(null,true);
getRecastLineVO1().init();
Here is the VO - init() code:
public void init()
System.out.println("****************************executing...");
OADBTransaction tx = (OADBTransaction) getApplicationModule().getTransaction();
if (tx.getTransientValue("RECAST_ID") !=null)
Number recastId = (Number) tx.getTransientValue("RECAST_ID");
System.out.println("recastId: "+ recastId);
setWhereClause("RECAST_HDR_ID = :1");
setWhereClauseParams(null); // Always reset
setWhereClauseParam(0, recastId);
executeQuery();
}hi,
This is how I am calling a DB package. the package does updates on the table. once done I am issueing a commit and requerying the data, however the vo is not getting refreshed.... Can someone point out what am I missing... why is the VO not getting refreshed....
This is very critical...
Thanks
Srini
public void validateRecast(String respKey)
OADBTransaction tx = (OADBTransaction)getApplicationModule().getTransaction();
Number recastId = (Number) tx.getTransientValue("RECAST_ID");
System.out.println("*********************validateRecast().RecastId: " + recastId);
OracleCallableStatement ocs = null;
Connection conn = tx.getJdbcConnection();
String strOut="", strErr="";
Number respId = null;
try
respId = new Number(respKey);
catch(Exception e)
throw new OAException("Invalid Responsibility");
String stmt = "BEGIN " +
"GE_RECAST_UTILS_PKG.validate_recast(:1,:2,:3,:4); " +
"END;";
try
ocs = (OracleCallableStatement)conn.prepareCall(stmt);
ocs.setNUMBER(1,recastId);
ocs.setNUMBER(2,respId);
ocs.registerOutParameter(3,OracleTypes.VARCHAR);
ocs.registerOutParameter(4,OracleTypes.VARCHAR);
ocs.execute();
strOut = ocs.getString(3);
strErr = ocs.getString(4);
ocs.close();
System.out.println("Returned with: " + strOut);
if(strOut.equalsIgnoreCase("ERROR"))
//throw new OAException(strErr);
tx.putTransientValue("ERROR",strErr);
tx.commit();
getApplicationModule().clearVOCaches("RecastLineEO",true);
RecastLineVOImpl lineVo = (RecastLineVOImpl)getApplicationModule().findViewObject("RecastLineVO1");
lineVo.init();
System.out.println("===============RecastLnId: " +lineVo.first().getAttribute("RecastLnId"));
System.out.println("===============Product Line: " +lineVo.first().getAttribute("ProductLine"));
catch(SQLException e)
tx.rollback();
if(ocs!=null)
try
ocs.close();
}catch(SQLException e1)
throw OAException.wrapperException(e1);
throw OAException.wrapperException(e);
} -
Management Studio 2008 does not refresh after table create / alter
hello
Management Studio 2008 does not refresh after table create / alter, why?
f5 / refresh button does not work in "Object Explorer".... i always need the restart the whole application to see any changes, this is strange...
regards, janHi jm,
I’m writing to follow up with you on this post. Was the problem resolved after performing Vishal ‘s steps? If you are satisfied with our solution, I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings
or concerns you may have.
Thanks,
Sofiya Li
Sofiya Li
TechNet Community Support -
Hi All,
We are encountering numerous short dumps in our system caused by Table AUSPN_V1 does not exist in the database with ID R/3.
Can anyone advise how to solve the issue? Please find below portion of the short dumps.
Category ABAP Programming Error
Runtime Errors DBIF_RSQL_TABLE_UNKNOWN
ABAP Program SAPLCLVF
Application Component CA-CL-CL
Date and Time 11.06.2014 12:08:28
Short text
A table is unknown or does not exist.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLCLVF" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
A table is referred to in an SAP Open SQL statement that either does not
exist or is unknown to the ABAP Data Dictionary.
The table involved is "AUSPN_V1" or another table accessed in the statement.
Source Code Extract
Line SourceCde
104 if dupl = kreuz.
105 insert auspc_v2 client specified from table auspcv2
106 accepting duplicate keys.
107 else.
108 insert auspc_v2 client specified from table auspcv2.
109 if syst-subrc ne 0.
110 message a585 with tabausp.
111 endif.
112 endif.
113 refresh auspcv2.
114 endif.
115 read table auspcv3 index 1.
116 if syst-subrc = 0.
117 if dupl = kreuz.
118 insert auspc_v3 client specified from table auspcv3
119 accepting duplicate keys.
120 else.
121 insert auspc_v3 client specified from table auspcv3.
122 if syst-subrc ne 0.
123 message a585 with tabausp.
124 endif.
125 endif.
126 refresh auspcv3.
127 endif.
128 read table auspnv1 index 1.
129 if syst-subrc = 0.
130 if dupl = kreuz.
131 insert auspn_v1 client specified from table auspnv1
132 accepting duplicate keys.
133 else.
>>>>> insert auspn_v1 client specified from table auspnv1.
135 if syst-subrc ne 0.
136 message a585 with tabausp.
137 endif.
138 endif.
139 refresh auspnv1.
140 endif.
141 read table auspnv2 index 1.
142 if syst-subrc = 0.
143 if dupl = kreuz.
144 insert auspn_v2 client specified from table auspnv2
145 accepting duplicate keys.
146 else.
147 insert auspn_v2 client specified from table auspnv2.
148 if syst-subrc ne 0.
149 message a585 with tabausp.
150 endif.
151 endif.
152 refresh auspnv2.
153 endif.Hello
Please check on transaction SE11 if this table exists and if it is active.
Also, it may be a database issue. What is your database?
BR
Caetano -
Tables in popups not refreshing
I'm having difficulty with some table refreshes within a popup. Here's my scenario. I have a window that displays a table. The user clicks edit, and the table is shown in an “edit” popup. At this point, if the user makes changes, clicks ok, then the table on the beginning page is refreshed correctly. To do this, I am using the following method to refresh the page fragement, AdfFacesContext.getCurrentInstance().addPartialTarget(this.getViewTablex());
Here is the issue,
The user chooses to edit the main table, and the edit popup appears. So far so good. The user then wants to add a new record, they click “Add” within the edit popup so I then show a new popup form where the user enters the fields for the new row. When they click ok on the "add" popup form, then the edit popup (from which they called the add popup) does not refresh the table with the newly added row. The row they added then appears as the first row in the edit popup.
What further complicates this is that I have to validate the "edit" popup rows when they click ok, to make sure all the data is valid, so I can not do a commit on the underlying table until after the validation. But, I need the newly added row in the table (or view) in the edit popup as part of my validation.
So, I have a table that makes use of an edit table popup that in turn makes use of an add form popup. But I cannot commit until I validate the edit popup. The problem is I’m not getting the newly added row that was created in the “add” popup to show up in my edit popup.
Here is the add popup handler I’m using
public void onAddxxxPopupFetchAction(PopupFetchEvent pPopupFetchEvent) {
try {
OperationBinding lOperationBinding =
lBindings.getOperationBinding("CreateInsert");
//If the Insert failed, return a "Severe" message.
Object result = lOperationBinding.execute();
if (!lOperationBinding.getErrors().isEmpty()) {
return;
} catch (Exception e) {
public void addxxxDialogOKAction(DialogEvent pDialogEvent) {
try {
//refresh the page fragment.
AdfFacesContext.getCurrentInstance().addPartialTarget(this.getEditPopupTable());
} catch (Exception e) {
And here is the popup portions of the page fragment
<af:popup id="addPopup" contentDelivery="lazyUncached"
popupFetchListener="#{backingBeanScope.backing_ui_pages_Maintenance. onAddxxxPopupFetchAction }"
popupCanceledListener="#{backingBeanScope.backing_ui_pages_Maintenance.onAddxxxPopupCancelAction}">
<af:dialog id="addDialog"
dialogListener="#{backingBeanScope.backing_ui_pages_Maintenance. addxxxDialogOKAction }"
closeIconVisible="false">
and for the edit popup;
<af:popup binding="#{backingBeanScope.backing_ui_pages_Maintenance.editPopup}"
id="editPopup">
<af:dialog binding="#{backingBeanScope.backing_ui_pages_Maintenance.editDialog}"
id="editDialog" closeIconVisible="false"
dialogListener="#{backingBeanScope.backing_ui_pages_Maintenance.editxxxDialogOKAction}">
I am using JDeveloper 11.1.1.6.0.
Any help would be appreciated.
thanks!
DougSeems like a PPR issue. Try have a partialTrigger corresponding to the OK button of add popup on the table in the edit popup.
Thanks,
TK -
I have an application set still running on OutlookSoft version 4.2 SP3
When I run a package on one of my applications, and when I post data and run the currency conversion package, the data does not show in my application.
If I run a select query on my fact tables I can see the data as it should be, but it doesn't come through in my application.
When I go to analysis services and refresh the cube from there then the data come through in the application. Even if i just process the application, I don't see the data, I need to refresh the data in the cube. Does anyone have an idea why this happens?Please notice that inquiries related to BPC topics should now be posted to dedicated forums.
Business Planning and Consolidations, version for SAP NetWeaver
<a class="jive_macro jive_macro_community" href="" __jive_macro_name="community" modifiedtitle="true" __default_attr="2065"></a>
Business Planning and Consolidations, version for the Microsoft Platform
<a class="jive_macro jive_macro_community" href="" __jive_macro_name="community" modifiedtitle="true" __default_attr="2066"></a>
Please adjust any bookmarks or shortcuts you may have set previously to point to this forum.
Best regards,
[Jeffrey Holdeman|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/jeffrey+holdeman]
SAP BusinessObjects
Enterprise Performance Management
Regional Implementation Group -
The data does not encrypt using Wallet!
Hi All,
I've created a wallet to encrypt/decrypt the data, but when I change any column to be ecrypted by this command:
alter table accounts modify (ssn encrypt); --accounts is the table containing ssn column to be ecrypted.
and then inserting data on it, the data does not appear in encrypted format it appears in it's truth format!
how to make the data ecrypted?Dev. Musbah wrote:
Hi All,
I've created a wallet to encrypt/decrypt the data, but when I change any column to be ecrypted by this command:
alter table accounts modify (ssn encrypt); --accounts is the table containing ssn column to be ecrypted.
and then inserting data on it, the data does not appear in encrypted format it appears in it's truth format!
how to make the data ecrypted?Did you go back and read that what does TDE(transparent data encryption) actually does? It does NOT make your column look encrypted but makes the physically stored data in teh datafile as encrypted which otherwise can be reverse engineered by someone and can be read. In your case, whatever is happening is the right thing.
For your unmentioned version, here is the link for the same,
http://download.oracle.com/docs/cd/E11882_01/network.112/e10746/asotrans.htm#ASOAG10137
HTH
Aman.... -
Discoverer 10.1.2 does not refresh new added column
Hello,
I need help to add a new item to EUL Business Area folder for a new added column in the database table.
When I refresh the folder in the BA EUL, the result shows no difference between the folder and the underlying table in the database; however, when I quey the table in the database, a new column is there. The refresh of the folder in the Discoverer Admin tool cannot find the newly added column. Weird!! The first time saw this problem.
Could someone shine some light on it? Would be really appreciate it!
PingI have a slightly different problem and can't solve it! When I refresh the EUL, the result shows the differences between the folder and the underlying tables in the database. However, it does not refresh the EUL in Discoverer Administrator 10g. Nothing happens! When I try to refresh again, the same list is shown... Does anyone know what could be happening?
Thanks -
Job Cancelled with an error "Data does not match the job def: Job terminat"
Dear Friends,
The following job is with respect to an inbound interface that transfers data into SAP.
The file mist.txt is picked from the /FI/in directory of the application server and is moved to the /FI/work directory of application server for processing. Once the program ends up without any error, the file is moved to /FI/archive directory.
The below are the steps listed in job log, no spool is generated for this job and it ended up with an error "Data does not match the job definition; job terminated".Please see below for more info.
1.Job Started
2.Step 001 started (program Y_SAP_FI_POST, variant MIST, user ID K364646)
3.File mist.txt copied from /data/sap/ARD/interface/FI/in/ to /data/sap/ARD/interface/FI/work/.
4.File mist.txt deleted from /data/sap/ARD/interface/FI/in/.
5.File mist.txt read from /data/sap/ARD/interface/FI/work/.
6.PD-DKLY-Y_SAP_FI_POST: This job was started periodically or directly from SM36/SM37 (Message Class: BD, Message Number : 076)
7.Job PD-DKLY-Y_SAP_FI_POST: Data does not match the job definition; job terminated (Message Class : BD, Message No. 078)
8.Job cancelled after system exception
ERROR_MESSAGE
Could you please analyse and come up about under what circumstance the above error is reported.
As well I heard that because of the customization issues in T.Code BMV0, the above error has raised.
Also please note that we can define as well schedule jobs from the above transaction and the corresponding data is stored in the table TBICU
My Trials
1. Tested uplaoding an empty file
2. Tested uploading with wrong data
3. Tested uploading with improper data that has false file structue
But failed to simulate the above scenario.
Clarification Required
Assume that I have defined a job using BMV0. Is that mandatory to use the same job in SM37/SM36 for scheduling?
Is the above question valid?
Edited by: dharmendra gali on Jan 28, 2008 6:06 AMDear Friends,
_Urgent : Please work on this ASAP _
The following job is with respect to an inbound interface that transfers data into SAP.
The file mist.txt is picked from the /FI/in directory of the application server and is moved to the /FI/work directory of application server for processing. Once the program ends up without any error, the file is moved to /FI/archive directory.
The below are the steps listed in job log, no spool is generated for this job and it ended up with an error "Data does not match the job definition; job terminated".Please see below for more info.
1.Job Started
2.Step 001 started (program Y_SAP_FI_POST, variant MIST, user ID K364646)
3.File mist.txt copied from /data/sap/ARD/interface/FI/in/ to /data/sap/ARD/interface/FI/work/.
4.File mist.txt deleted from /data/sap/ARD/interface/FI/in/.
5.File mist.txt read from /data/sap/ARD/interface/FI/work/.
6.PD-DKLY-Y_SAP_FI_POST: This job was started periodically or directly from SM36/SM37 (Message Class: BD, Message Number : 076)
7.Job PD-DKLY-Y_SAP_FI_POST: Data does not match the job definition; job terminated (Message Class : BD, Message No. 078)
8.Job cancelled after system exception
ERROR_MESSAGE
Could you please analyse and come up about under what circumstance the above error is reported.
As well I heard that because of the customization issues in T.Code BMV0, the above error has raised.
Also please note that we can define as well schedule jobs from the above transaction and the corresponding data is stored in the table TBICU
My Trials
1. Tested uplaoding an empty file
2. Tested uploading with wrong data
3. Tested uploading with improper data that has false file structue
But failed to simulate the above scenario.
Clarification Required
Assume that I have defined a job using BMV0. Is that mandatory to use the same job in SM37/SM36 for scheduling?
Is the above question valid? -
Hyperlinked JSP Page does not refresh contents
I have a very typical problem.
In my application whenever I call a jsp page using hyperlink without any querystring attached to it the page called does not refresh. However when I press refresh on the browser it does refresh the contents. Basically in this page I am using some session variables to fetch data. So I do not call the page by passing querystring instead set the attributes of session variables and then the page is called as a hyperlink.
However if I call the same page using submit the values are refreshed.
Help on this urgently will be appreciated.
Thanks
ManishJust set 'no-cache' option for the jsp page and test it. It should work. only you need to do is
response.setDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
if(request.getProtocol().equals("HTTP/1.1")) {
response.setHeader("Cache-Control","no-cache");
have fun!!
---rajsekhar -
Need help in formatting the Date - Date does not
Need help in formatting the Date - Date does not formats and give Not a valid month error in the below scenario.
select oc.ST_PGM_MGR, r.ag_dnum, get_major_work_type(r.perf_eval_rtng_id) "v_work_code", r.ag_dnum_supp "supp", r.intfinal, to_char(r.formdate,'MM/DD/YYYY') "formdate", to_char(r.servfrom,'MM/DD/YYYY') "srv_from", to_char(r.servto,'MM/DD/YYYY') "srv_to", descript, add_months(to_char
--- Bellow line of Code on trying to format it to mm/dd/yyyy gives the error
(r.formdate, 'DD-MON-YYYY'),12) "formdate2"
from table REdited by: Lucy Discover on Jul 7, 2011 11:34 AM
Edited by: Lucy Discover on Jul 7, 2011 1:05 PMYour syntax is wrong - look at the post above where this syntax is given:
to_char (add_months(r.formdate,12), 'MM/DD/YYYY') "formdate2"Look at the formula from a logical perspective - "inside out" to read what is happening -
take formdate, add 12 months
add_months(r.formdate, 12)then apply the to_char format mask - basic syntax
to_char(date, 'MM/DD/YYYY')Compare to your syntax:
to_char(add_months(r.formdate, 'MM/DD/YYYY'),12) "formdate2"You will see your format string inside the call to add_months, and your 12 inside the call to to_char.
Good luck! -
EJB 3.0 - JSF APPLICATION: DATA DOES NOT PERSIST TO THE DATABASE
Hi,
I am developing a JSF - EJB application and the data that I send from JSP Page through JSF Managed Bean --> Session Bean --> Java Persistence does not persist in database.
Here is my scenario ( Iam using JDeveloper IDE to create this application) -
SCENARIO START
The scenario consists of two web pages, one enlisting all the users stored in the database, the other contains a form for adding a user
1.) INDEX.JSP
2.) ADDUSER.JSP
Step 1: Create the USERS Table in database
CREATE TABLE users
user_id serial,
username varchar(255) NOT NULL,
first_name varchar(255),
last_name varchar(255),
password char(64) NOT NULL,
CONSTRAINT pk_users PRIMARY KEY (user_id)
Step 2: Add Database Connection To JDeveloper
Go to Database Connection Navigator and create a New Database Connection using the Wizard
Step 3: Create a New Application in JDeveloper and select JSF, EJB from Application Template
Step 4: ENTITY BEAN - In the EJB Node Right Click and Select EJB à New Entites from Table (JPA/EJB3.0)
Use The Wizard and create Entity Bean from Users Table which creates an Entity Bea POJO file as follows –
User.java -
package lux.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@NamedQuery(name = "User.findAll", query = "select o from User o")
@Table(name = "USERS")
public class User implements Serializable {
@Column(name="FIRST_NAME")
private String firstName;
@Column(name="LAST_NAME")
private String lastName;
@Column(nullable = false)
private String password;
@Column(nullable = false)
private String username;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="users_seq_generator")
@SequenceGenerator(name="users_seq_generator", sequenceName="users_user_id_seq")
@Column(name="USER_ID", nullable = false)
private Long userId;
public User() {
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public Long getUserId() {
return userId;
public void setUserId(Long userId) {
this.userId = userId;
Step 5: STATELESS SESSION BEAN - In the EJB Node Right Click and Select EJB à New Entites from Table (JPA/EJB3.0)
Again Right Click on Model and create Session Bean from Wizard which creates two files –
UserDAOBean.java – Stateless Session Bean
UserDAO.java – Local Interface
package lux.facade;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import lux.domain.User;
@Stateless(name="UserDAO")
public class UserDAOBean implements UserDAO {
@PersistenceContext(unitName="Model")
private EntityManager em;
public UserDAOBean() {
public User getUser(int UserId) {
User u = new User();
u = em.find(User.class, UserId);
return u;
public List<User> getAllUsers() {
Query q = em.createQuery("SELECT u FROM User u");
List<User> users = q.getResultList();
return users;
public void createUser(User u) {
String hashedPw = hashPassword(u.getPassword());
u.setPassword(hashedPw);
em.persist(u);
public void updateUser(User u) {
String hashedPw = hashPassword(u.getPassword());
u.setPassword(hashedPw);
em.merge(u);
public void deleteUser(User u) {
em.remove(u);
private String hashPassword(String password) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA");
byte[] bs;
bs = messageDigest.digest(password.getBytes());
for (int i = 0; i < bs.length; i++) {
String hexVal = Integer.toHexString(0xFF & bs);
if (hexVal.length() == 1) {
sb.append("0");
sb.append(hexVal);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(UserDAOBean.class.getName()).log(Level.SEVERE, null, ex);
return sb.toString();
Step 6: Create a Deployment file in the Model and Deploy this to a JAR file
Step 7: Now Right Click on View/Controller Node and create a Java File –
UserController.java -
package lux.controllers;
import javax.ejb.EJB;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import lux.domain.User;
import lux.facade.UserDAO;
public class UserController {
@EJB UserDAO userDao;
private User user;
private DataModel model;
public String createUser() {
this.user = new User();
return "create_new_user";
public String saveUser() {
String r = "success";
try {
userDao.createUser(user);
} catch (Exception e) {
e.printStackTrace();
r = "failed";
return r;
public DataModel getUsers() {
model = new ListDataModel(userDao.getAllUsers());
return model;
public User getUser() {
return user;
public void setUser(User user) {
this.user = user;
Step 8: Configure page flow in faces-config.xml
1. Create the JSP file adduser.jsp by right-clicking View-Controller
node and selecting New > JSP. Use the wizard to create JSF – JSP Page, fill in
File Name adduser.jsp, click Finish. -
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New user</title>
</head>
<body>
<f:view>
<h:form>
<h:messages/>
<h:panelGrid columns="2">
<h:outputText value="Username"/>
<h:inputText
id="Username"
value="#{user.user.username}"
required="true"/>
<h:outputText value="First name"/>
<h:inputText
id="FirstName"
value="#{user.user.firstName}" />
<h:outputText value="Last name"/>
<h:inputText
id="LastName"
value="#{user.user.lastName}" />
<h:outputText value="Password" />
<h:inputSecret
id="Password"
value="#{user.user.password}"
required="true" />
<h:panelGroup/>
<h:commandButton
action="#{user.saveUser}"
value="Save"/>
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>
2. Repeat the previous step for another JSP file failed.jsp.
3. On failed.jsp add the string
Save failed
Next we configure the page flow.
1. Open faces-config.xml.
2. Create index.jsp -
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User Listing</title>
</head>
<body>
<f:view>
<h:form>
<h:outputText value="User Listing"/>
<h:commandLink action="#{user.createUser}" value="Create a user"/>
<h:dataTable value="#{user.user}"
var="dataTableItem" border="1" cellpadding="2" cellspacing="2">
<h:column>
<f:facet name="header">
<h:outputText value="Username"/>
</f:facet>
<h:outputText value="#{dataTableItem.username}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="First name"/>
</f:facet>
<h:outputText value="#{dataTableItem.firstName}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Last name"/>
</f:facet>
<h:outputText value="#{dataTableItem.lastName}" />
</h:column>
</h:dataTable>
</h:form>
</f:view>
</body>
</html>
3. Drag an arrow from index.jsp to adduser.jsp and replace the arrow’s label to create_new_user.
4. Repeat the previous step for failed, by dragging and arrow from adduser.jsp to failed.jsp renaming the label to f
ailed
5. Finally repeat the step for adduser.jsp, by dragging from adduser.jsp to index.jsp renaming the label to success.
This creates the following faces-config.xml file –
<?xml version='1.0' encoding='UTF-8'?>
<faces-config>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>lux.controllers.UserController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>username</property-name>
<value>#{username}</value>
</managed-property>
<managed-property>
<property-name>firstName</property-name>
<value>#{firstName}</value>
</managed-property>
<managed-property>
<property-name>lastName</property-name>
<value>#{lastName}</value>
</managed-property>
<managed-property>
<property-name>password</property-name>
<value>#{password}</value>
</managed-property>
</managed-bean>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>create_new_user</from-outcome>
<to-view-id>/adduser.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/adduser.jsp</from-view-id>
<navigation-case>
<from-outcome>failed</from-outcome>
<to-view-id>/failed.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Step 9: Create a Deployment file in the View-Controller and Deploy this to a WAR file
Step 10: Create a Deployment file in the View-Controller and create an EAR file and add Model’s JAR and View-Controller’s
WAR files to it.
Step 11: Run the JSP Files
SCENARIO END
Now, When I execute Index.jsp, it does not list values from database and when I click on Create User link, it takes me to adduser.jsp page. When I fill values in this page and click Save button, it takes me to Save Failed page and data does not persist to the database.
WHAT IS WRONG OUT HERE ???If you set a breakpoint in your createUser method - does this code get executed?
We have a couple of tutorials that might show you how to do this.
EJB/JSF with ADF-binding tutorial:
http://www.oracle.com/technology/obe/obe1013jdev/10131/ejb_and_jpa/master-detail_pagewith_ejb.htm
EJB/JSF without ADF binding:
http://www.oracle.com/technology/obe/JavaEE_tutorial_10131/index.htm -
JSF - EJB 3.0 Application - Data does not persist to the database
Hi,
I am developing a JSF - EJB application and the data that I send from JSP Page through JSF Managed Bean --> Session Bean --> Java Persistence does not persist in database.
Here is my scenario ( Iam using JDeveloper IDE to create this application) -
------------------------------------------------------- SCENARIO START
The scenario consists of two web pages, one enlisting all the users stored in the database, the other contains a form for adding a user
1.) INDEX.JSP
2.) ADDUSER.JSP
Step 1: Create the USERS Table in database
CREATE TABLE users
user_id serial,
username varchar(255) NOT NULL,
first_name varchar(255),
last_name varchar(255),
password char(64) NOT NULL,
CONSTRAINT pk_users PRIMARY KEY (user_id)
Step 2: Add Database Connection To JDeveloper
Go to Database Connection Navigator and create a New Database Connection using the Wizard
Step 3: Create a New Application in JDeveloper and select JSF, EJB from Application Template
Step 4: ENTITY BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
Use The Wizard and create Entity Bean from Users Table which creates an Entity Bea POJO file as follows �
User.java -
package lux.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@NamedQuery(name = "User.findAll", query = "select o from User o")
@Table(name = "USERS")
public class User implements Serializable {
@Column(name="FIRST_NAME")
private String firstName;
@Column(name="LAST_NAME")
private String lastName;
@Column(nullable = false)
private String password;
@Column(nullable = false)
private String username;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="users_seq_generator")
@SequenceGenerator(name="users_seq_generator", sequenceName="users_user_id_seq")
@Column(name="USER_ID", nullable = false)
private Long userId;
public User() {
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public Long getUserId() {
return userId;
public void setUserId(Long userId) {
this.userId = userId;
Step 5: STATELESS SESSION BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
Again Right Click on Model and create Session Bean from Wizard which creates two files �
UserDAOBean.java � Stateless Session Bean
UserDAO.java � Local Interface
package lux.facade;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import lux.domain.User;
@Stateless(name="UserDAO")
public class UserDAOBean implements UserDAO {
@PersistenceContext(unitName="Model")
private EntityManager em;
public UserDAOBean() {
public User getUser(int UserId) {
User u = new User();
u = em.find(User.class, UserId);
return u;
public List<User> getAllUsers() {
Query q = em.createQuery("SELECT u FROM User u");
List<User> users = q.getResultList();
return users;
public void createUser(User u) {
String hashedPw = hashPassword(u.getPassword());
u.setPassword(hashedPw);
em.persist(u);
public void updateUser(User u) {
String hashedPw = hashPassword(u.getPassword());
u.setPassword(hashedPw);
em.merge(u);
public void deleteUser(User u) {
em.remove(u);
private String hashPassword(String password) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA");
byte[] bs;
bs = messageDigest.digest(password.getBytes());
for (int i = 0; i < bs.length; i++) {
String hexVal = Integer.toHexString(0xFF & bs);
if (hexVal.length() == 1) {
sb.append("0");
sb.append(hexVal);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(UserDAOBean.class.getName()).log(Level.SEVERE, null, ex);
return sb.toString();
Step 6: Create a Deployment file in the Model and Deploy this to a JAR file
Step 7: Now Right Click on View/Controller Node and create a Java File �
UserController.java -
package lux.controllers;
import javax.ejb.EJB;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import lux.domain.User;
import lux.facade.UserDAO;
public class UserController {
@EJB UserDAO userDao;
private User user;
private DataModel model;
public String createUser() {
this.user = new User();
return "create_new_user";
public String saveUser() {
String r = "success";
try {
userDao.createUser(user);
} catch (Exception e) {
e.printStackTrace();
r = "failed";
return r;
public DataModel getUsers() {
model = new ListDataModel(userDao.getAllUsers());
return model;
public User getUser() {
return user;
public void setUser(User user) {
this.user = user;
Step 8: Configure page flow in faces-config.xml
1. Create the JSP file adduser.jsp by right-clicking View-Controller
node and selecting New > JSP. Use the wizard to create JSF � JSP Page, fill in
File Name adduser.jsp, click Finish. -
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New user</title>
</head>
<body>
<f:view>
<h:form>
<h:messages/>
<h:panelGrid columns="2">
<h:outputText value="Username"/>
<h:inputText
id="Username"
value="#{user.user.username}"
required="true"/>
<h:outputText value="First name"/>
<h:inputText
id="FirstName"
value="#{user.user.firstName}" />
<h:outputText value="Last name"/>
<h:inputText
id="LastName"
value="#{user.user.lastName}" />
<h:outputText value="Password" />
<h:inputSecret
id="Password"
value="#{user.user.password}"
required="true" />
<h:panelGroup/>
<h:commandButton
action="#{user.saveUser}"
value="Save"/>
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>
2. Repeat the previous step for another JSP file failed.jsp.
3. On failed.jsp add the string <h2>Save failed</h2>.
Next we configure the page flow.
1. Open faces-config.xml.
2. Create index.jsp -
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User Listing</title>
</head>
<body>
<f:view>
<h:form>
<h1><h:outputText value="User Listing"/></h1>
<p><h:commandLink action="#{user.createUser}" value="Create a user"/></p>
<h:dataTable value="#{user.user}"
var="dataTableItem" border="1" cellpadding="2" cellspacing="2">
<h:column>
<f:facet name="header">
<h:outputText value="Username"/>
</f:facet>
<h:outputText value="#{dataTableItem.username}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="First name"/>
</f:facet>
<h:outputText value="#{dataTableItem.firstName}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Last name"/>
</f:facet>
<h:outputText value="#{dataTableItem.lastName}" />
</h:column>
</h:dataTable>
</h:form>
</f:view>
</body>
</html>
3. Drag an arrow from index.jsp to adduser.jsp and replace the arrow�s label to create_new_user.
4. Repeat the previous step for failed, by dragging and arrow from adduser.jsp to failed.jsp renaming the label to f
ailed
5. Finally repeat the step for adduser.jsp, by dragging from adduser.jsp to index.jsp renaming the label to success.
This creates the following faces-config.xml file �
<?xml version='1.0' encoding='UTF-8'?>
<faces-config>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>lux.controllers.UserController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>username</property-name>
<value>#{username}</value>
</managed-property>
<managed-property>
<property-name>firstName</property-name>
<value>#{firstName}</value>
</managed-property>
<managed-property>
<property-name>lastName</property-name>
<value>#{lastName}</value>
</managed-property>
<managed-property>
<property-name>password</property-name>
<value>#{password}</value>
</managed-property>
</managed-bean>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>create_new_user</from-outcome>
<to-view-id>/adduser.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/adduser.jsp</from-view-id>
<navigation-case>
<from-outcome>failed</from-outcome>
<to-view-id>/failed.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Step 9: Create a Deployment file in the View-Controller and Deploy this to a WAR file
Step 10: Create a Deployment file in the View-Controller and create an EAR file and add Model�s JAR and View-Controller�s
WAR files to it.
Step 11: Run the JSP Files
------------------------------------------------------- SCENARIO END
Now, When I execute Index.jsp, it does not list values from database and when I click on Create User link, it takes me to adduser.jsp page. When I fill values in this page and click Save button, it takes me to Save Failed page and data does not persist to the database.
WHAT IS WRONG OUT HERE ???PLZZZZZZZZZzzzzzzzzzzz HELP ! ! !
-
Regarding "Data does not match the job definition; job terminated"
Dear Friends,
The following job is with respect to an inbound interface that transfers data into SAP.
The file mist.txt is picked from the /FI/in directory of the application server and is moved to the /FI/work directory of application server for processing. Once the program ends up without any error, the file is moved to /FI/archive directory.
The below are the steps listed in job log, no spool is generated for this job and it ended up with an error "Data does not match the job definition; job terminated".Please see below for more info.
1.Job Started
2.Step 001 started (program Y_SAP_FI_POST, variant MIST, user ID K364646)
3.File mist.txt copied from /data/sap/ARD/interface/FI/in/ to /data/sap/ARD/interface/FI/work/.
4.File mist.txt deleted from /data/sap/ARD/interface/FI/in/.
5.File mist.txt read from /data/sap/ARD/interface/FI/work/.
6.PD-DKLY-Y_SAP_FI_POST: This job was started periodically or directly from SM36/SM37 (Message Class: BD, Message Number : 076)
7.Job PD-DKLY-Y_SAP_FI_POST: Data does not match the job definition; job terminated (Message Class : BD, Message No. 078)
8.Job cancelled after system exception
ERROR_MESSAGE
Could you please analyse and come up about under what circumstance the above error is reported.
As well I heard that because of the customization issues in T.Code BMV0, the above error has raised.
Also please note that we can define as well schedule jobs from the above transaction and the corresponding data is stored in the table TBICU
My Trials
1. Tested uplaoding an empty file
2. Tested uploading with wrong data
3. Tested uploading with improper data that has false file structue
But failed to simulate the above scenario.
Clarification Required
Assume that I have defined a job using BMV0. Is that mandatory to use the same job in SM37/SM36 for scheduling?
Is the above question valid?Hi dharmendra
Good Day
How are you
I am facing the same problem which you have posted
By any chance have you got the soultion for this
If so please let me know the solution for this.
Thanks in advance.
Cheers
Vallabhaneni -
EJB-JSF Application : Data does not persist to the database
Hi,
I am developing a JSF - EJB application and the data that I send from JSP Page through JSF Managed Bean --> Session Bean --> Java Persistence does not persist in database.
Here is my scenario ( Iam using JDeveloper IDE to create this application) -
SCENARIO START
The scenario consists of two web pages, one enlisting all the users stored in the database, the other contains a form for adding a user
1.) INDEX.JSP
2.) ADDUSER.JSP
Step 1: Create the USERS Table in database
CREATE TABLE users
user_id serial,
username varchar(255) NOT NULL,
first_name varchar(255),
last_name varchar(255),
password char(64) NOT NULL,
CONSTRAINT pk_users PRIMARY KEY (user_id)
Step 2: Add Database Connection To JDeveloper
Go to Database Connection Navigator and create a New Database Connection using the Wizard
Step 3: Create a New Application in JDeveloper and select JSF, EJB from Application Template
Step 4: ENTITY BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
Use The Wizard and create Entity Bean from Users Table which creates an Entity Bea POJO file as follows �
User.java -
package lux.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@NamedQuery(name = "User.findAll", query = "select o from User o")
@Table(name = "USERS")
public class User implements Serializable {
@Column(name="FIRST_NAME")
private String firstName;
@Column(name="LAST_NAME")
private String lastName;
@Column(nullable = false)
private String password;
@Column(nullable = false)
private String username;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="users_seq_generator")
@SequenceGenerator(name="users_seq_generator", sequenceName="users_user_id_seq")
@Column(name="USER_ID", nullable = false)
private Long userId;
public User() {
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public Long getUserId() {
return userId;
public void setUserId(Long userId) {
this.userId = userId;
Step 5: STATELESS SESSION BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
Again Right Click on Model and create Session Bean from Wizard which creates two files �
UserDAOBean.java � Stateless Session Bean
UserDAO.java � Local Interface
package lux.facade;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import lux.domain.User;
@Stateless(name="UserDAO")
public class UserDAOBean implements UserDAO {
@PersistenceContext(unitName="Model")
private EntityManager em;
public UserDAOBean() {
public User getUser(int UserId) {
User u = new User();
u = em.find(User.class, UserId);
return u;
public List<User> getAllUsers() {
Query q = em.createQuery("SELECT u FROM User u");
List<User> users = q.getResultList();
return users;
public void createUser(User u) {
String hashedPw = hashPassword(u.getPassword());
u.setPassword(hashedPw);
em.persist(u);
public void updateUser(User u) {
String hashedPw = hashPassword(u.getPassword());
u.setPassword(hashedPw);
em.merge(u);
public void deleteUser(User u) {
em.remove(u);
private String hashPassword(String password) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA");
byte[] bs;
bs = messageDigest.digest(password.getBytes());
for (int i = 0; i < bs.length; i++) {
String hexVal = Integer.toHexString(0xFF & bs);
if (hexVal.length() == 1) {
sb.append("0");
sb.append(hexVal);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(UserDAOBean.class.getName()).log(Level.SEVERE, null, ex);
return sb.toString();
Step 6: Create a Deployment file in the Model and Deploy this to a JAR file
Step 7: Now Right Click on View/Controller Node and create a Java File �
UserController.java -
package lux.controllers;
import javax.ejb.EJB;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import lux.domain.User;
import lux.facade.UserDAO;
public class UserController {
@EJB UserDAO userDao;
private User user;
private DataModel model;
public String createUser() {
this.user = new User();
return "create_new_user";
public String saveUser() {
String r = "success";
try {
userDao.createUser(user);
} catch (Exception e) {
e.printStackTrace();
r = "failed";
return r;
public DataModel getUsers() {
model = new ListDataModel(userDao.getAllUsers());
return model;
public User getUser() {
return user;
public void setUser(User user) {
this.user = user;
Step 8: Configure page flow in faces-config.xml
1. Create the JSP file adduser.jsp by right-clicking View-Controller
node and selecting New > JSP. Use the wizard to create JSF � JSP Page, fill in
File Name adduser.jsp, click Finish. -
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New user</title>
</head>
<body>
<f:view>
<h:form>
<h:messages/>
<h:panelGrid columns="2">
<h:outputText value="Username"/>
<h:inputText
id="Username"
value="#{user.user.username}"
required="true"/>
<h:outputText value="First name"/>
<h:inputText
id="FirstName"
value="#{user.user.firstName}" />
<h:outputText value="Last name"/>
<h:inputText
id="LastName"
value="#{user.user.lastName}" />
<h:outputText value="Password" />
<h:inputSecret
id="Password"
value="#{user.user.password}"
required="true" />
<h:panelGroup/>
<h:commandButton
action="#{user.saveUser}"
value="Save"/>
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>
2. Repeat the previous step for another JSP file failed.jsp.
3. On failed.jsp add the string
Save failed
Next we configure the page flow.
1. Open faces-config.xml.
2. Create index.jsp -
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User Listing</title>
</head>
<body>
<f:view>
<h:form>
<h:outputText value="User Listing"/>
<h:commandLink action="#{user.createUser}" value="Create a user"/>
<h:dataTable value="#{user.user}"
var="dataTableItem" border="1" cellpadding="2" cellspacing="2">
<h:column>
<f:facet name="header">
<h:outputText value="Username"/>
</f:facet>
<h:outputText value="#{dataTableItem.username}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="First name"/>
</f:facet>
<h:outputText value="#{dataTableItem.firstName}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Last name"/>
</f:facet>
<h:outputText value="#{dataTableItem.lastName}" />
</h:column>
</h:dataTable>
</h:form>
</f:view>
</body>
</html>
3. Drag an arrow from index.jsp to adduser.jsp and replace the arrow�s label to create_new_user.
4. Repeat the previous step for failed, by dragging and arrow from adduser.jsp to failed.jsp renaming the label to f
ailed
5. Finally repeat the step for adduser.jsp, by dragging from adduser.jsp to index.jsp renaming the label to success.
This creates the following faces-config.xml file �
<?xml version='1.0' encoding='UTF-8'?>
<faces-config>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>lux.controllers.UserController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>username</property-name>
<value>#{username}</value>
</managed-property>
<managed-property>
<property-name>firstName</property-name>
<value>#{firstName}</value>
</managed-property>
<managed-property>
<property-name>lastName</property-name>
<value>#{lastName}</value>
</managed-property>
<managed-property>
<property-name>password</property-name>
<value>#{password}</value>
</managed-property>
</managed-bean>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>create_new_user</from-outcome>
<to-view-id>/adduser.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/adduser.jsp</from-view-id>
<navigation-case>
<from-outcome>failed</from-outcome>
<to-view-id>/failed.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Step 9: Create a Deployment file in the View-Controller and Deploy this to a WAR file
Step 10: Create a Deployment file in the View-Controller and create an EAR file and add Model�s JAR and View-Controller�s
WAR files to it.
Step 11: Run the JSP Files
SCENARIO END
Now, When I execute Index.jsp, it does not list values from database and when I click on Create User link, it takes me to adduser.jsp page. When I fill values in this page and click Save button, it takes me to Save Failed page and data does not persist to the database.
WHAT IS WRONG OUT HERE ???If you set a breakpoint in your createUser method - does this code get executed?
We have a couple of tutorials that might show you how to do this.
EJB/JSF with ADF-binding tutorial:
http://www.oracle.com/technology/obe/obe1013jdev/10131/ejb_and_jpa/master-detail_pagewith_ejb.htm
EJB/JSF without ADF binding:
http://www.oracle.com/technology/obe/JavaEE_tutorial_10131/index.htm
Maybe you are looking for
-
My Macbook pro is not even a month old, do I need a new battery?!
I bought this laptop THIS month. It started acting up by shutting down with no warning. Just out of nowhere, a black sceen, and when I went to turn it back on, it would struggle to boot up. I fixed this by resetting the PRAM, and then after that the
-
How do I turn off Air Drop on my MacBook Pro?
Realy don't like the idea of my MacBook being available to people around me.
-
DBMS_SCHEDULER wait for job/program to finish
Hello All, I've run into a little limitation on my understanding of DBMS_SCHEDULER. I have an executable script which does a network scan. My goal is to lauch this from an application, and wait (could be 5 minutes or 2 hours) for the scan to finish b
-
HttpURLConnection : unable to use cookie to go to next page
Hi, I'm trying to login a form by using java application. I'm successfully login in and http return 200 response code for me. i had set the cookie for the page. Now, i try to access the another page of the web and it seems like unable to use the cook
-
Library of some song Messed up
My song order appears nicely in iTunes, no.1 is at the top of the album order and everything is fine. When I turn the iPod on, seems that the song order is all messed up. And for another artist, I can see duplicates of it. i.e. when u select your son