inject

Change to content of IFRAME. Inject script into IFRAME from another IFRAME

和自甴很熟 提交于 2020-01-17 01:21:21
问题 I am working on a script to get and change the content of an IFrame, by accessing a variable and a function defined in it, through a button and a Javascript script created in another IFrame. The script works fine, but what I would like to do is instead of text been injected in the IFRAME 1 I would like to inject a script, something like: <script src="map.js" type="text/javascript"></script> I have tried with injecting IMG and also works: <button onclick="f_ifr2('<img height=\'410\' src=\

Guice : Inject an ArrayList of Strings

江枫思渺然 提交于 2020-01-13 17:54:37
问题 I'm trying to inject an ArrayList of String s with the help of Guice. I want to show a panel with many RadioButtons (for example) where an user can select some services to activate. Once selected, I would like to get all the names of the selected services and add them into a list, and inject this list to the manager responsible to create the services. Here is an example: public class UIProviderModule extends ProviderServiceModule { private ArrayList<String> requestedServices; public

Converting spring xml to java configuration with implicit setter autowiring and ComponentScan

南楼画角 提交于 2020-01-13 07:05:31
问题 I have two classes: vehicle.Tire and vehicle.Car. package vehicle; @Named public class Tire { private String age; } package vehicle; @Named public class Car { private Tire tire; // Spring calls this setter because default-autowire="byName" of xml configuration public void setTire(Tire newTire) { this.tire = newTire; } public Tire getTire() { return this.tire; } } The following spring xml works fine. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001

Why do I need a setter for autowired / injected field?

你离开我真会死。 提交于 2020-01-12 03:28:54
问题 I have a bean: <bean id="BasketLogic" class="efco.logic.EfcoBasketLogic" autowire="byType"> <property name="documentLogic" ref="DocumentLogic" /> <property name="stateAccess" ref="StateAccess" /> <property name="contextAccess" ref="ContextAccess" /> </bean> <bean id="EfcoErpService" autowire="byType" class="efco.erp.service.EfcoErpServiceImpl"> <constructor-arg ref="ErpConnector"/> </bean> documentLogic , stateAccess and contextAccess are fields on BasketLogicImpl And I do not have <context

JAX-RS failed to inject @EJB or @Inject

偶尔善良 提交于 2020-01-11 09:20:54
问题 I'm trying to test a minimal JAX-RS + EJB/CDI injection mechanism and currently hitting a road-block due to GlassFish unable to inject for whatever reason. (Using @Inject will throw NPE because GlassFish cannot inject the POJO). My beans.xml contains only <beans /> Here's my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun

Spring autowire stops working for classes on the Tomcat classpath

丶灬走出姿态 提交于 2020-01-07 04:03:06
问题 Inside my library FooLibrary.jar Spring instantiates class com.example.FooImpl which has a property bars . I have lots of Bar instances also instantiated by Spring. A set of bars is autowired into FooImpl like this: @Component public class FooImpl { @Inject private Set<Bar> bars; In a standalone application, Spring instantiates the Bar instances, instantiates the FooImpl instances, and then autowires FooImpl.bars with the set of Bar s. It works. Now I'm running the same Spring configuration

Spring Boot Inject CrudRepository into Service

纵饮孤独 提交于 2020-01-04 07:18:26
问题 I am having difficulty injecting a CrudRepository into a service annotated with the @Service annotation. I have two packages one "core" package containing @Service definitions and reusable controller definitions. My main application in the x.y.application package is as follows: package x.y.application; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication;

CDI - Injecting objects dynamically at runtime

穿精又带淫゛_ 提交于 2020-01-02 15:52:56
问题 How do I inject objects at runtime? For example, if I want to inject DerviedOne, DerivedTwo objects at runtime into the Test class in the following example, how do I do that? I found a few examples in Spring, but I'm not using Spring. This is a Dynamic Web Project with CDI using Java EE 6. public abstract class Base { public Base(String initiator) { this.initiator = initiator; } public abstract void process(); public void baseProcess() { System.out.println("base process"); process(); } public

CDI - Injecting objects dynamically at runtime

末鹿安然 提交于 2020-01-02 15:52:32
问题 How do I inject objects at runtime? For example, if I want to inject DerviedOne, DerivedTwo objects at runtime into the Test class in the following example, how do I do that? I found a few examples in Spring, but I'm not using Spring. This is a Dynamic Web Project with CDI using Java EE 6. public abstract class Base { public Base(String initiator) { this.initiator = initiator; } public abstract void process(); public void baseProcess() { System.out.println("base process"); process(); } public

How to insert html in iframe

亡梦爱人 提交于 2020-01-02 06:21:28
问题 Hallo all: I need to insert a html string in a iframe as shown below: .... var html = "<html><head><title>Titolo</title></head><body><p>body</p></body></html>" jQuery('#popolaIframe').click(function() { parent.$("#indexIframe")[0].documentElement.innerHTML = html; }); Is there a way to achieve this? 回答1: var html = "<html><head><title>Titolo</title></head><body><p>body</p></body></html>" jQuery('#popolaIframe').click(function() { var doc = parent.$("#indexIframe")[0].documentElement; doc.open