
What is meant by Context binding?

A binding context is an object that holds data that you can reference from your bindings. While applying bindings, Knockout automatically creates and manages a hierarchy of binding contexts. The root level of the hierarchy refers to the viewModel parameter you supplied to ko.applyBindings(viewModel). Then, each time you use a control flow binding such as with or foreach, that creates a child binding context that refers to the nested view model data.

Thanks:-)
public class B { public static void main(String[] args) throws javax.naming.NoInitialContextException { maths mat=new A(); mat.add(); mat.sub(); String name; try { name = new B().getName(); System.out.println(name); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void createName() throws NamingException { Context context = (Context) new InitialContext(); ((InitialContext) context).bind("java:comp/env", "MyApp"); } public String getName() throws NamingException { Context context = (Context) new InitialContext(); return (String) ((InitialContext) context).lookup("java:comp/env"); } }
if i run this program means it will show error give some solution....
error
javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable {} [Root exception is java.lang.NullPointerException] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:238) at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:322) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:352) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:436) at javax.naming.InitialContext.lookup(InitialContext.java:450) at Model.B.getName(B.java:26) at Model.B.main(B.java:13) Caused by: java.lang.NullPointerException at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:230) ... 6 more
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.