I'm developing with zk framework in java (with eclipse ) .
I'm trying to link some textbox (view) to controller throught wired variable .
The problem is that in the controller the wired variable is null when the submit event is called .
Index:Index.zul
Login :Login.java
In your doAfterCompose method add this line or you can use doAfterCompose method like
this
#AfterCompose
public void afterCompose(#ContextParam(ContextType.VIEW) Component view){
Selectors.wireComponents(view, this, false);
}
Don't use CSS selectors in the #Wire parameter, just use the ZK component id. That is to say, leave off the #.
Also, if the Java variable name is the same as the ZK component id (eg "win") you can leave off the #Wire parameter all together and it'll still work fine.
Edit:
There is another problem in your code. The Textbox you're importing is from the POI package =X
Related
I am working on a project in Java where I should be able to launch a site and then recognize a browser Web Elements with a Mouse Over, like the Object Spy in QTP. The Elements that I hope to get are Name, Class Name, ID, Tagname, Linktext,Partial LinkText, CSS Xpath..etc..
I am kind of lost on how to bridge the Browser and the Application.Can anyone help?
Thank you in Advance.
Inject a javascript/Jquery code into the web page to capture element properties. You can pass the element back to Java class and catch it in a org.w3c.dom.HTMLElement object. Using the methods in the object, you can retrieve all the attributes corresponding to the Element.
I am trying to set a value to a variable in play template and access it in the controller.
For ex, in homepage.scala.html, I would like to set a pageName variable a value as "homepage.scala.html".
Once I set this value in the play template, I want to access it in my controller which is presently in Java.
How do I achive this?
I will then be migrating the controller to scala. How do access the pageName value in scala controller?
Why I am trying to do this?:
I am trying to apply Play Aloha editor to my application How to integrate the Aloha Wysiwyg Editor with Play! Framework. Here, when a static content on the page is edited, the page name is passed to central controller which then modifies the actual template page or even message resource to update the static content. If I can't or shouldn't pass the page name to the controller then how do I achieve this?
Many thanks.
At a general level, your templates should be acting like pure functions, without containing any state. But based on what you're asking, assuming your view is in scope as views.html.homepage, you could do something like views.html.homepage.getClass.getName
In my App (Fusion Web) exist a ViewObject from Oracle DB.
I created the java classes and build a specific method (makeUniqueSearchByDate(String)) to process the data.
This method appears in "Data controls" that I can drag to the "view" and use as any other function. When I try to use it in a "bean" (instead of dragging directly):
public void setDate(ActionEvent actionEvent) {
ApplicationModule appMod =
Configuration.createRootApplicationModule("com.svr.model.AppModule", "AppModuleLocal");
ViewModelosByDataImpl fo = (ViewModelosByDataImpl) appMod.findViewObject("ViewModelosByData1");
String dateV = "07-01-2013";
fo.makeUniqueSearchByDate(dateV);
}
This code has no effect on the table. Can anyone see why?
Btw, the program does not throw any exception. Just does not work. The table remains the same. But if I use the button, automatically generated by "drag and drop" the function runs normally. I know I should study ADF, but unfortunately I have no time.
i think after you have exposed the method written at VO as Client interface, you need to create a method binding in pageDef file of you page. after creating the method binding, you need to access the method in bean through binding layer something like this :
OperationBinding op=((DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry()).getOperationBinding("Method Binding");
op.execute();
i think the method used by you to call VO method from bean is not right.
i think one more thing you need to do in your bean after calling the VO method is that you need to do refresh the table / perform PPR programatically :
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(component binding for your table component);
you can try setting autosubmit to true for command button which invokes action event, and set partial trigger for table to component id of the command button.
can you post VO method code as well ?
does the method get called and data gets committed / updated when you execute it through bean ? is it only a table refresh issue ? do you see changes to data if you manually refresh the page ?
I'm using Play Framework and setting a cache value as such:
String sessionId = Scope.Session.current().getId();
Cache.set(sessionId + "_user", "Doser");
and I want to ouput the value in my main.html without adding the value to every single controller in my application.
How do I achieve this in Play?
The other option you have for this, is to create an action in your controller that uses the #Before annotation, and then add the value using renderArgs().
I answered a previous question which I think is very similar to your requirements.
Does Play Framework support "snippets"?
You should also be aware that all session variables are available within your template, by default. You can see all the implicit objects that are available in the template in the Template Documentation here -- http://www.playframework.org/documentation/1.2.2/templates#implicits.
I need to stop answering my own questions.
I've created a tag as described in the link below, and it works perfectly:
http://www.playframework.org/documentation/1.2.2/templates#tags
My current problem regards updating context information dynamically in FormInjector, my previous question Updating a zone inside a form in Tapestry 5 probably contains useful background information.
I added the following in my template.
<div t:type="FormInjector" t:id="injector" t:context="item.id"/>
And the following in my component class.
#OnEvent(component = "injector")
Block loadItemFields(String id) {
item = itemRepository.find(id);
return itemFieldsBlock;
}
Everything is working fine, new form fields appear, but the search is always done with the same id. I would like to change the id with JavaScript before triggering the event, but I don't know how to achieve this.
If there is additional information required I am happy to supply it.
Using the context parameter to pass a dynamic value wouldn't be my first option. (The FormInjector component generates a URL to trigger the event handler, which then includes the context - however, this is done when the component renders, and is not meant to be dynamic.)
I'd get rid of the context parameter and find a different way to submit the value. One possibility would be to submit the form via AJAX and trigger the injection in the callback:
this.myFormElement.observe('change', this.onChange.bindAsEventListener(this));
...
onChange: function(event) {
this.myFormElement.form.request({
onSuccess: this.afterFormSubmitted.bind(this)
});
},
afterFormSubmitted: function() {
this.formInjector.trigger();
}
That way, the value of the form element has been set on the server side when you trigger the form injection, and you can use it in your injection event handler.