HGrid tutorial or example wanted
Hi gurus,
I am developing a custom page with a HGrid. I am trying to folllow the OAF Developer Guide. Section on VO and View Links are OK, but I am getting stuck when trying to define the UI nodes.
Are there any good tutorials or examples out there?
Regards,
Søren Moss
Hi - let me be more specific.
I'd like an example that explains and illustrates the following section in the OAF developers guide under chapter 4 -> HGrid -> Defining a HGrid -> Step 4:
**** Quote start ****
Set the Ancestor Node property on this item to indicate the region where you are looping back. The
Ancestor Node property can be set to another tree region, to the same tree region (for a recursive
relationship), or to no tree region (null, indicating that the node is a leaf level in the hierarchy tree).
The ancestor node should be set as a fully-qualified path name such as
/oracle/apps/<applshortname>/<module>/<pagename>.<childNode ID > where the ancestor
childNode ID is whatever childNode (node) you are looping back to.
Attention: For a recursive relationship, as indicated above, you set the ancestor node to the same
tree region. However, the "same tree region" refers to the parent of the base recursing node and
not the recursing node itself.
**** Quote end ****
Regards Søren
Similar Messages
-
Searching for simple bluetooth to bluetooth messages tutorial or example
Hi,
I want to send messages from 1 mobile phone to another one using Bluetooth but I can't find any simple tutorial or example with this type of bluetooth use.
So i'm asking for your help :) any simple tutorial/example for bluetooth messages between devices?
Thanks in advanceimport java.util.Vector;
import java.io.IOException;
import javax.microedition.io.Connector;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Choice;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.DataElement;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.UUID;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.ServiceRecord;
import javax.bluetooth.L2CAPConnectionNotifier;
import javax.bluetooth.L2CAPConnection;
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.BluetoothConnectionException;
import javax.bluetooth.ServiceRegistrationException;
public class ChatController extends MIDlet implements CommandListener
private Display display = null;
private Form mainForm = null;
private ChoiceGroup devices = null;
private TextField inTxt = null;
private TextField outTxt = null;
private Command exit = null;
private Command start = null;
private Command connect = null;
private Command send = null;
private Command select = null;
private StringItem status = null;
private LocalDevice local = null;
private RemoteDevice rDevices[];
private ServiceRecord service = null;
private DiscoveryAgent agent = null;
private L2CAPConnectionNotifier notifier;
private L2CAPConnection connection = null;
private static final String UUID_STRING = "112233445566778899AABBCCDDEEFF";
private boolean running = false;
public ChatController()
super();
display = Display.getDisplay(this);
mainForm = new Form("CHAT");
devices = new ChoiceGroup(null,Choice.EXCLUSIVE);
inTxt = new TextField("incoming msg:","",256,TextField.ANY);
outTxt = new TextField("outgoing msg:","",256,TextField.ANY);
exit = new Command("EXIT",Command.EXIT,1);
start = new Command("START",Command.SCREEN,2);
connect = new Command("CONNECT",Command.SCREEN,2);
send = new Command("SEND",Command.SCREEN,2);
select = new Command("SELECT",Command.SCREEN,2);
status = new StringItem("status : ",null);
mainForm.append(status);
mainForm.addCommand(exit);
mainForm.setCommandListener(this);
protected void startApp() throws MIDletStateChangeException
running = true;
mainForm.addCommand(start);
mainForm.addCommand(connect);
display.setCurrent(mainForm);
try
local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
catch(BluetoothStateException bse)
status.setText("BluetoothStateException unable to start:"+bse.getMessage());
try
Thread.sleep(1000);
catch(InterruptedException ie)
notifyDestroyed();
protected void pauseApp()
running = false;
releaseResources();
protected void destroyApp(boolean uncond) throws MIDletStateChangeException
running = false;
releaseResources();
public void commandAction(Command cmd,Displayable disp)
if(cmd==exit)
running = false;
releaseResources();
notifyDestroyed();
else if(cmd==start)
new Thread()
public void run()
startServer();
}.start();
else if(cmd==connect)
status.setText("searching for devices...");
mainForm.removeCommand(connect);
mainForm.removeCommand(start);
mainForm.append(devices);
DeviceDiscoverer discoverer = new DeviceDiscoverer(ChatController.this);
try
agent.startInquiry(DiscoveryAgent.GIAC,discoverer);
catch(IllegalArgumentException iae)
status.setText("BluetoothStateException :"+iae.getMessage());
catch(NullPointerException npe)
status.setText("BluetoothStateException :"+npe.getMessage());
catch(BluetoothStateException bse1)
status.setText("BluetoothStateException :"+bse1.getMessage());
else if(cmd==select)
status.setText("searching devices for service...");
int index = devices.getSelectedIndex();
mainForm.delete(mainForm.size()-1);//deletes choiceGroup
mainForm.removeCommand(select);
ServiceDiscoverer serviceDListener = new ServiceDiscoverer(ChatController.this);
int attrSet[] = {0x0100}; //returns service name attribute
UUID[] uuidSet = {new UUID(UUID_STRING,false)};
try
agent.searchServices(attrSet,uuidSet,rDevices[index],serviceDListener);
catch(IllegalArgumentException iae1)
status.setText("BluetoothStateException :"+iae1.getMessage());
catch(NullPointerException npe1)
status.setText("BluetoothStateException :"+npe1.getMessage());
catch(BluetoothStateException bse11)
status.setText("BluetoothStateException :"+bse11.getMessage());
else if(cmd==send)
new Thread()
public void run()
sendMessage();
}.start();
//this method is called from DeviceDiscoverer when device inquiry finishes
public void deviceInquiryFinished(RemoteDevice[] rDevices,String message)
this.rDevices = rDevices;
String deviceNames[] = new String[rDevices.length];
for(int k=0;k<rDevices.length;k++)
try
deviceNames[k] = rDevices[k].getFriendlyName(false);
catch(IOException ioe)
status.setText("IOException :"+ioe.getMessage());
for(int l=0;l<deviceNames.length;l++)
devices.append(deviceNames[l],null);
mainForm.addCommand(select);
status.setText(message);
//called by ServiceDiscoverer when service search gets completed
public void serviceSearchFinished(ServiceRecord service,String message)
String url = "";
this.service = service;
status.setText(message);
try
url = service.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false);
catch (IllegalArgumentException iae1)
try
connection = (L2CAPConnection)Connector.open(url);
status.setText("connected...");
new Thread()
public void run()
startReciever();
}.start();
catch(IOException ioe1)
status.setText("IOException :"+ioe1.getMessage());
// this method starts L2CAPConnection chat server from server mode
public void startServer()
status.setText("server starting...");
mainForm.removeCommand(connect);
mainForm.removeCommand(start);
try
local.setDiscoverable(DiscoveryAgent.GIAC);
notifier = (L2CAPConnectionNotifier)Connector.open("btl2cap://localhost:"+UUID_STRING+";name=L2CAPChat");
ServiceRecord record = local.getRecord(notifier);
String conURL = record.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false);
status.setText("server running...");
connection = notifier.acceptAndOpen();
new Thread()
public void run()
startReciever();
}.start();
catch(IOException ioe3)
status.setText("IOException :"+ioe3.getMessage());
//starts a message reciever listening for incomming message
public void startReciever()
mainForm.addCommand(send);
mainForm.append(inTxt);
mainForm.append(outTxt);
while(running)
try
if(connection.ready())
int receiveMTU = connection.getReceiveMTU();
byte[] data = new byte[receiveMTU];
int length = connection.receive(data);
String message = new String(data,0,length);
inTxt.setString(message);
catch(IOException ioe4)
status.setText("IOException :"+ioe4.getMessage());
//sends a message over L2CAP
public void sendMessage()
try
String message = outTxt.getString();
byte[] data = message.getBytes();
int transmitMTU = connection.getTransmitMTU();
if(data.length <= transmitMTU)
connection.send(data);
else
status.setText("message ....");
catch (IOException ioe5)
status.setText("IOException :"+ioe5.getMessage());
//closes L2CAP connection
public void releaseResources()
try
if(connection != null)
connection.close();
if(notifier != null)
notifier.close();
catch(IOException ioe6)
status.setText("IOException :"+ioe6.getMessage());
import java.util.Vector;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.ServiceRecord;
public class DeviceDiscoverer implements DiscoveryListener
private ChatController controller = null;
private Vector devices = null;
private RemoteDevice[] rDevices = null;
public DeviceDiscoverer(ChatController controller)
super();
this.controller = controller;
devices = new Vector();
public void deviceDiscovered(RemoteDevice remote,DeviceClass dClass)
devices.addElement(remote);
public void inquiryCompleted(int descType)
String message = "";
switch(descType)
case DiscoveryListener.INQUIRY_COMPLETED:
message = "INQUIRY_COMPLETED";
break;
case DiscoveryListener.INQUIRY_TERMINATED:
message = "INQUIRY_TERMINATED";
break;
case DiscoveryListener.INQUIRY_ERROR:
message = "INQUIRY_ERROR";
break;
rDevices = new RemoteDevice[devices.size()];
for(int i=0;i<devices.size();i++)
rDevices[i] = (RemoteDevice)devices.elementAt(i);
controller.deviceInquiryFinished(rDevices,message);//call of a method from ChatController class
devices.removeAllElements();
controller = null;
devices = null;
public void servicesDiscovered(int transId,ServiceRecord[] services)
public void serviceSearchCompleted(int transId,int respCode)
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DataElement;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.ServiceRecord;
public class ServiceDiscoverer implements DiscoveryListener
private static final String SERVICE_NAME = "L2CAPChat";
private ChatController controller = null;
private ServiceRecord service = null;
public ServiceDiscoverer(ChatController controller)
super();
this.controller = controller;
public void deviceDiscovered(RemoteDevice remote,DeviceClass dClass)
public void inquiryCompleted(int descType)
public void servicesDiscovered(int transId,ServiceRecord[] services)
for(int j=0;j<services.length;j++)
DataElement dataElementName = services[j].getAttributeValue(0x0100);
String serviceName = (String)dataElementName.getValue();
if(serviceName.equals(SERVICE_NAME))
service = services[j];
break;
public void serviceSearchCompleted(int transId,int respCode)
String message = "";
switch(respCode)
case DiscoveryListener.SERVICE_SEARCH_COMPLETED:
message = "SERVICE_SEARCH_COMPLETED";
break;
case DiscoveryListener.SERVICE_SEARCH_ERROR:
message = "SERVICE_SEARCH_ERROR";
break;
case DiscoveryListener.SERVICE_SEARCH_TERMINATED:
message = "SERVICE_SEARCH_TERMINATED";
break;
case DiscoveryListener.SERVICE_SEARCH_NO_RECORDS:
message = "SERVICE_SEARCH_NO_RECORDS";
break;
case DiscoveryListener.SERVICE_SEARCH_DEVICE_NOT_REACHABLE:
message = "SERVICE_SEARCH_DEVICE_NOT_REACHABLE";
break;
controller.serviceSearchFinished(service,message);//calling a method from ChatController class
controller = null;
service = null;
} -
Need one to many toplink+Jdeveloper tutorial with example
Hi
I need tutorial with example of one to many with Toplink+J developer
Thanks
Edited by: user11802935 on Aug 18, 2009 1:06 PMHi,
The following links should get you started.
EclipseLink JPA + Eclipse
http://wiki.eclipse.org/EclipseLink/Examples/JPA
JDeveloper tutorials
http://www.oracle.com/technology/products/jdev/index.html
TopLink + JDeveloper tutorial
http://www.oracle.com/technology/obe/obe11jdev/bulldog/ejb_jpa_jsf/ejb.html
@OneToMany documentation
http://wiki.eclipse.org/Introduction_to_EclipseLink_JPA_%28ELUG%29#.40OneToMany
thank you
/michael
www.eclipselink.org -
Tutorial or example to import JournalEntries
Hello,
have you a tutorial to import JournalEntries with DTW ?
have you files example ?
I want to use journalEntries and /or JournalVouchers objects
thank'sHello Luis - you might want to try this SQL to get that information (of course you need to definitely modify it to your environment).
--SQL 2FN GL Acct List with Code and Segs Ver 1 ZP 2009 12 20
--DESCRIPTION: Displays GL Account Codes and Associated Segmentation
--AUTHOR(s):
--Version 1 Zal Parchem 2009 12 20
SELECT
T0.AcctCode,
T0.AcctName AS "GL Account Name",
T0.Segment_0 AS "Natural Acct",
T0.Segment_1 AS "Location Acct"
FROM OACT T0
ORDER BY
T0.Segment_0,
T0.Segment_1,
T0.AcctCode
Regards - Zal -
LR & SlideShowPro Examples Wanted
I was looking at the SlideShowPro plugin for LR Web photo Galleries. The site doesn't offer aceeptable examples of galleries made through LR. Does anyone have a gallery built with this software, which I could look at? Thanks - Steven
BTW; I like the Airtight viewers, but I may want something with more pizzazz. I'm open to suggestions for other LR plugins as well.I really like the SSP plug-in and have used it a lot in recent weeks:
http://www.stephenetnier.com/gallery.html
(embedded in an HTML page: full use of fullscreen mode and popup images)
http://www.thesameband.com/gallery.html
(audio playback controlled in the slideshow)
http://www.chronicjazz.com/photos.html
(audio embedded in the html file after the fact)
http://www.pilatesportland.com/
(embedded in an HTML page: a simple slideshow with no controller or thumbnails, a bit down the page) -
Searching OWB-Tutorial with Example to each component
Hi,
i search a tutorial with a typical example to each component of OWB 11g. I have found this two links which was good for the beginning and an overview, but anyone know a better tutorial if possible in german language (that would be the best for me) - but of course english is possible too.
Oracle® Database 2 Day + Data Warehousing Guide;
http://download.oracle.com/docs/cd/E11882_01/server.112/e10578/toc.htm
Oracle® Database 2 Day + Data Warehousing Guide;
http://apex.oracle.com/pls/apex/f?p=44785:24:1778744827384310::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:5248,29
I look forward for your replies :)This OBE has some useful illustrations;
http://apex.oracle.com/pls/apex/f?p=44785:24:1753420051941801:::24:P24_CONTENT_ID,P24_PREV_PAGE:4262,24
I created the following blog to show the results of the debugger for some operations which is an alternative view - doesn't show how to setup though...
https://blogs.oracle.com/warehousebuilder/entry/owb_11gr2_debugging
Cheers
David -
JavaEE5 tutorial ejb example not working!
I have downloaded latest javaee5 tutorial example and i downloaded latest netbeans 6.9 and tried to run ejb cart example but i am getting
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.lang.NoClassDefFoundError: cart/util/BookException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.glassfish.appclient.client.acc.FacadeLaunchable.getMainClass(FacadeLaunchable.java:256)
at org.glassfish.appclient.client.acc.AppClientContainer.setClient(AppClientContainer.java:317)
at org.glassfish.appclient.client.acc.AppClientContainerBuilder.createContainer(AppClientContainerBuilder.java:174)
at org.glassfish.appclient.client.acc.AppClientContainerBuilder.newContainer(AppClientContainerBuilder.java:161)
at org.glassfish.appclient.client.AppClientFacade.createContainerForAppClientArchiveOrDir(AppClientFacade.java:458)
at org.glassfish.appclient.client.AppClientFacade.createContainer(AppClientFacade.java:420)
at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:256)
at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75)
FATAL ERROR in native method: processing of -javaagent failed
... 6 more
Caused by: java.lang.ClassNotFoundException: cart.util.BookException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.glassfish.appclient.client.acc.ACCClassLoader.findClass(ACCClassLoader.java:211)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 16 more
Exception in thread "main" Java Result: 1
please help
Edited by: vinaysb on Sep 1, 2010 3:29 AMthere is not much help to give. Java already says what the problem is: the cart/util/BookException class is not on the application's classpath. That can indicate a missing library or bad deployment settings. Hard to say what it exactly is.
All I can say is: learn how a JEE application is properly packaged and deployed and with that knowledge try and figure out where the mistake is. -
JWSDP Tutorial - Servlet Example
I am trying to run the bookstore example in the Servlet section of the JWSDP on Red Hat 7.3.I am also getting confused over ANT and the Tomcat Manager.
I need to build the bookstore example and the instructions read: (for those who know the tutorial)
1. In a terminal window, go to /docs/tutorial/examples/web/bookstore1
2. Run ant build - The build target will spawn any necessary compilations and copy files to the docs/tutorial/examples/web/bookstore1/build directory.
3. Make sure Tomcat is started.
4. Run ant install - The install target notifies Tomcat that the new context is available.
5. Start the Pointbase database server and populate the database if you have not done so already
6. Open the bookstore URL http://localhost:8080/bookstore1/enter
On the command line I can run ANT BUILD fine, but ANT INSTALL fails. (It also fails in Tomcat Manager...but not sure whether I can use this instead of ANT INSTALL?)
I know this is sketchy but does anyone have any idea?
Regards
ScottHi Scott,
Thank you any way.
Last time, I met it and carried the tutorial on by compiling and copying manually. Then, I came back to set the ant.jar into path&classpath, and it worked.(ant build)
Today, I'm trying on "hello1" example, but can't get though.
Maybe it's still classpath and path issue, as I can't compile two servlet classes by javac from command line, but from Forte, it passed.
Cheers!
Zhan -
New Tutorial and example available on OTN - representing preferences
The tutorial demonstrates an approach for using preferences in conjunction with approaching limits or thresholds. The approach is useful in dealing with aggregating across a set such as line items, insurance claim lines etc, while considering individual or annual deductibles and copays, accumulating inventory for shipping from multiple locations or expressing preferences such as for replacement or up-sell, cross-sell of products, preferential configurations based on available inventory, etc.
Tutorial - Limits, Thresholds and Preferences in OPM (Nov 2012) and the example project are available at: http://www.oracle.com/technetwork/apps-tech/policy-automation/learnmore/index.htmlNice one. Thanks
-
Request for abap objects tutorial with examples
hi,
i am new to <b>abap objects</b>,
please send me a good tutorial for <b>abap objects</b> which contain good explanation with
good examples.
please send the tutorials to
<b>[email protected]</b>
thanks®ards
vamsi nHello,
<b>General Tutorial for OOPS</b>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
<b>Have a look at these links for OO ABAP.</b>
http://www.sapgenie.com/abap/OO/
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
<b>SDN Series:</b>
https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb [original link is broken]
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
<b>Basic concepts of OOPS</b>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
http://www.henrikfrank.dk/abapuk.html
http://www.erpgenie.com/abap/OO/
Regards,
Beejal
**Reward if this helps -
J2ee tutorial bookstore2 example - again
Folks,
I've been trying to run the bookstore2 example of the j2ee tutorial.
When I click on the start shopping link nothing happens.
I found this in the server.log file
[#|2005-05-11T11:26:22.353+0100|WARNING|sun-appserver-pe8.1|javax.enterprise.system.stream.err|_ThreadID=18;|
org.apache.jasper.JasperException: /bookcatalog.jsp(39,2) The end tag "</c:forEach" is unbalanced
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:43)
I have tried to fix this and redeploy the application but I continue to get the same error. Obviously I am not deploying this correctly. Can someone tell me the steps involved? Thanks?
Here is the offending code.
<c:if test="${!empty param.Add}">
<c:set var="bid" value="${param.Add}"/>
<jsp:setProperty name="bookDB" property="bookId" value="${bid}" />
<c:set var="addedBook" value="${bookDB.bookDetails}" />
<p><h3><font color="red" size="+2">
<fmt:message key="CartAdded1"/> <em>${addedBook.title}</em> <fmt:message key="CartAdded2"/></font></h3>
</c:forEach>
</c:if>Somehow you accidentally added an incorrect tag. That section should be:
<c:if test="${!empty param.Add}">
<c:set var="bid" value="${param.Add}"/>
<jsp:setProperty name="bookDB" property="bookId" value="${bid}" />
<c:set var="addedBook" value="${bookDB.bookDetails}" />
<p><h3><font color="red" size="+2">
<fmt:message key="CartAdded1"/> <em>${addedBook.title}</em> <fmt:message key
="CartAdded2"/></font></h3>
</c:if>
That is, remove the </c:forEach>.
-Ian Evans -
Simple MVC desktop example wanted
Hi,
I've been looking and can't find a good example of MVC in a desktop application. I don't mean MVC as it is used in component development (I've seen some examples relating to Swing and Buttonmodels, for instance), but more business-object level. I'm not a Java or Swing expert, but I have been programming for a while and and am pretty comfortable writing non-UI Java classes and simple Swing apps. But I want to know how to do this right.
Here's the simplest example I can think of to explain my confusion:
Suppose I have a class called Customer with fields FirstName and LastName. Suppose further I want to create a desktop GUI that allows the customer to edit that model in two separate windows in such a way that changes in one edit window are immediately reflected in the other, and I want clean separation of presentation and logic.
The example doesn't have to be in Swing, but it shouldn't require a server.
Thanks for any help you can give on this - and, if this isn't the right place to post this query, I'd appreciate a pointer to a more appropriate forum.There are many ways but here is a simple example of how I do it.
******************************* CustomerModel.java
import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
public class CustomerModel
/** Change Support Object */
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
/** bound property names */
public static final String FIRST_NAME_CHANGED = "firstname";
public static final String LAST_NAME_CHANGED = "lastname";
/** First Name Element */
private String firstName;
/** Last Name Element */
private String lastName;
/** Blank Constructor */
public CustomerModel()
super();
* Sets the first name element. If value changed a notification is
* sent to all listeners of this property
* @param newFirstName String
public void setFirstName(String newFirstName)
String oldFirstName = this.firstName;
this.firstName = newFirstName;
propertyChangeSupport.firePropertyChange(FIRST_NAME_CHANGED, oldFirstName, newFirstName);
* @return String
public String getFristName()
return firstName;
* Sets the last name element. If value changed a notification is
* sent to all listeners of this property
* @param newFirstName String
public void setLastName(String newLastName)
String oldLastName = this.lastName;
this.lastName = newLastName;
propertyChangeSupport.firePropertyChange(LAST_NAME_CHANGED, oldLastName, newLastName);
* @return String
public String getLastName()
return lastName;
/** Passthrough method for property change listener */
public void addPropertyChangeListener(String str, PropertyChangeListener pcl)
propertyChangeSupport.addPropertyChangeListener(str, pcl);
/** Passthrough method for property change listener */
public void removePropertyChangeListener(String str, PropertyChangeListener pcl)
propertyChangeSupport.removePropertyChangeListener(str, pcl);
}******************************* CustomerFrame.java
import javax.swing.*;
import java.awt.event.*;
import java.awt.GridLayout;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
public class CustomerFrame extends JFrame implements ActionListener, PropertyChangeListener
/** Customer to view/control */
private CustomerModel customer;
private JLabel firstNameLabel = new JLabel("First Name: ");
private JTextField firstNameEdit = new JTextField();
private JLabel lastNameLabel = new JLabel("Last Name: ");
private JTextField lastNameEdit = new JTextField();
private JButton updateButton = new JButton("Update");
* Constructor that takes a model
* @param customer CustomerModel
public CustomerFrame(CustomerModel customer)
// setup this frame
this.setName("Customer Editor");
this.setTitle("Customer Editor");
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.getContentPane().setLayout(new GridLayout(3, 2));
this.getContentPane().add(firstNameLabel);
this.getContentPane().add(firstNameEdit);
this.getContentPane().add(lastNameLabel);
this.getContentPane().add(lastNameEdit);
this.getContentPane().add(updateButton);
// reference the customer locally
this.customer = customer;
// register change listeners
this.customer.addPropertyChangeListener(CustomerModel.FIRST_NAME_CHANGED, this);
this.customer.addPropertyChangeListener(CustomerModel.LAST_NAME_CHANGED, this);
// setup the initial value with values from the model
firstNameEdit.setText(customer.getFristName());
lastNameEdit.setText(customer.getLastName());
// cause the update button to do something
updateButton.addActionListener(this);
// now display everything
this.pack();
this.setVisible(true);
* Update the model when update button is clicked
* @param e ActionEvent
public void actionPerformed(ActionEvent e)
customer.setFirstName(firstNameEdit.getText());
customer.setLastName(lastNameEdit.getText());
System.out.println("Update Clicked " + e);
* Update the view when the model has changed
* @param evt PropertyChangeEvent
public void propertyChange(PropertyChangeEvent evt)
if (evt.getPropertyName().equals(CustomerModel.FIRST_NAME_CHANGED))
firstNameEdit.setText((String)evt.getNewValue());
else if (evt.getPropertyName().equals(CustomerModel.LAST_NAME_CHANGED))
lastNameEdit.setText((String)evt.getNewValue());
}******************************* MainFrame.java
import javax.swing.JFrame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
public class MainFrame extends JFrame implements ActionListener
/** Single customer model to send to all spawned frames */
private CustomerModel model = new CustomerModel();
/** Button to click to spawn new frames */
private JButton newEditorButton = new JButton("New Editor");
/** Blank Constructor */
public MainFrame() {
super();
/** Create and display the GUI */
public void createAndDisplayGUI()
this.setName("MVC Spawner");
this.setTitle("MVC Spawner");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.newEditorButton.addActionListener(this);
this.getContentPane().add(newEditorButton);
this.pack();
this.setVisible(true);
/** Do something when the button is clicked */
public void actionPerformed(ActionEvent e)
new CustomerFrame(model);
* Creates the main frame to spawn customer edit frames from.
* @param args String[] ignored
public static void main(String[] args) {
MainFrame mainframe = new MainFrame();
mainframe.createAndDisplayGUI();
} -
Run JWSDP tutorial JAXR example problem
Dear all:
I'm running examples from JWSDP 2.0 tutorial
I use sjsas-9_1
my location is jwstutorial20/examples/jaxr/simple
my registry server is http://localhost:8080/RegistryServer as default
asant run-publish
I got following errors:
javaee-home-test:
init:
prepare:
build:
run-publish:
[java] Created connection to registry
[java] Got registry service, query manager, and life cycle manager
[java] Sep 30, 2007 1:39:56 PM com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
[java] SEVERE: SAAJ0008: Bad Response; Not Found
[java] javax.xml.registry.JAXRException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at com.sun.xml.registry.uddi.RegistryServiceImpl.jaxmSend(Unknown Source)
[java] at com.sun.xml.registry.uddi.RegistryServiceImpl.send(Unknown Source)
[java] at com.sun.xml.registry.uddi.Processor.processRequestJAXB(Unknown Source)
[java] at com.sun.xml.registry.uddi.UDDIMapper.getAuthorizationToken(Unknown Source)
[java] at com.sun.xml.registry.uddi.ConnectionImpl.setCredentials(Unknown Source)
[java] at JAXRPublish.executePublish(Unknown Source)
[java] at JAXRPublish.main(Unknown Source)
[java] Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:146)
[java] ... 7 more
[java] Caused by: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
[java] ... 7 more
[java] Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:323)
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
[java] ... 9 more
BUILD SUCCESSFUL
can anyone help?
thanksHi Scott,
Thank you any way.
Last time, I met it and carried the tutorial on by compiling and copying manually. Then, I came back to set the ant.jar into path&classpath, and it worked.(ant build)
Today, I'm trying on "hello1" example, but can't get though.
Maybe it's still classpath and path issue, as I can't compile two servlet classes by javac from command line, but from Forte, it passed.
Cheers!
Zhan -
J2ee tutorial bookstore2 example
Hi,
I'm having difficulty getting the bookstore2 example to run.
In my web browser I get the following message
The requested resource (/bookstore2/bookstore) is not available.
The server.log file contains this message
Couldn't create bookstore database bean: Couldn't open connection to database: Error in allocating a connection. Cause: Connection could not be allocated because: SQL-server rejected establishment of SQL-connection. Pointbase Server may not be running on localhost at port 9092.|#]
Howevere, the Pointbase Server is running fine on localhost at port 9092
Any suggestions?
Thanks.
SeanHi,
this was happening to me also and after hours of troubleshooting I stumbled across the fix (just now).
Go into the Deploytool and double click on Servers (local host:4848) - I discovered here that bookstore2 had a status of "stopped". When I selected it and pressed the "start" button, the URL then worked fine. Not sure why I had to start it manually as I didn't have to do this with bookstore1 for it to work.
Anyway hope this helps and fixes your error too.
Cheers
Sandy -
Web database application design examples wanted
Hi! I�ve written a couple of smaller web database applications in Java but I�m not completely satisfied with my design, especially where and how to put the database code. Now I�m looking for small open source examples of good design of web database applications in Java. I would appreciate if you could direct me to a good example application, preferably easy to understand. Also feel free to mention any other resource that you think I should look at. At the moment I don�t have the time to read a complete book but I plan to do this later � so book recommendations for professional Java developer are also very welcome.
Summary of recommendations I would like to get:
1) Java web database application with good design
2) Design book for professional Java developers
3) Any other design related resource
Thanks!http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step.html
Maybe you are looking for
-
I need step by step instructions as my 10 year old knows more than I do!
-
Playing iPhone Through Car Stereo
Tragically, the tape deck on my 2000 Ford Mustang pooped out the other day. I had been using a cassette adapter to play my iPhone/iPod for years, and now I'm stuck. I know people who have the adapters that play through the radio, but I live in a big
-
Problem in length - smartforms
I have to display a dynamic text named reason in smartforms.I am getting the reason from the selection screen which is of length 250 characters.The o/p smartform screen contains 5 lines for reason of 2.5 line spacing. I want to know how should i popu
-
Hi , We are stuck in problem with our private cloud protection , when ever DPM trying to backup virtual machines the cluster shared volume i.o timeout and the disk disappeared for a moment and that cause my virtual machine rebooted unexpectedly and m
-
Classic Scenarion with MM-SUS (SUS-ECC-SRM/EBP)
Hi SRM Gurus, We are going for SRM Classic Scenario with MM-SUS . SRM 7.0 with ECC 6.0 (Ehp4). Here ECC will be connected to SRM and SUS ,i..e SUS-ECC-SRM. I learnt that Classic deployment supports MM-SUS scenario. It means that , every document crea