Tag: dynamic

EclipseLink动态MOXy访问枚举值

我正在使用下面列出的XSD和相应的XML。 一切都适用于动态MOXy,但我不知道如何访问java中的枚举类型。 有什么建议么? 感谢帮助。 //JAVA code DynamicEntity person = (DynamicEntity) dynamicJAXBContext.createUnmarshaller().unmarshal(instanceDoc); String firstName = person.get(“firstName”); String lastName = person.get(“lastName”); //until here it works well //but now: how to get and set the value of the “quadrant”? // following lines do not work String quadrant=person.get(“quadrant); person.set(“quadrant”,”NORTH”);

使用Criteria API进行动态JPA 2.0查询

我使用JPA 2.0的CriteriaBuilder构建动态查询有点困难。 我猜有一个很常见的用例:用户提供任意数量的搜索参数X和/或连接:如: select e from Foo where (name = X1 or name = X2 .. or name = Xn ) 方法或CriteriaBuilder不是动态的: 谓词或(谓词……限制) 想法? 样品?

来自xsd的动态java bean

我有两个应用程序,一个作为客户端,另一个作为服务器。 在服务器应用程序中,我使用Eclipse中的xjc生成ObjectFactory和类。 因此,其中一个类称为widgetEvenCall。 来自xsd: … JAXB xjc使用它们的getter和setter生成类WidgetEventCall,WidgetEventDescriptor和WidgetParameter。 客户端应用程序既没有这些类也没有ObjectFactory,远程调用服务器应用程序上的服务,得到一个XML,如: . . . … … … . . . 幸运的是,客户端应用程序可以访问.xsd定义。 我的问题是:有可能,有xml内容和xsd定义,为widgetEventCall,widgetEventDescriptor和widgetParameter创建对象,就好像它们是由xjc创建的,包括getter和setter,保持客户端应用程序不知道它们,使用专属反思? 有没有一种自动化方式来实现这一目标? 我的目标是将此结果用于JSP文件,即将对象放入请求并像widgetEventCall.widgetParameter [0] .someProperty一样访问它,因此我需要生成getter。 提前致谢。 琼。

动态生成JNLP

我需要动态地将参数传递给JNLP,我尝试使用扩展JnlpDownloadServlet的servlet然后包含一个将所有JNLP XML写入其中的jsp。 但是当我调用下载的JNLP时,我得到了BadFieldException 。 Servlet的 public class TestServlet extends JnlpDownloadServlet { public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; res.setContentType(“application/x-java-jnlp-file”); request.getRequestDispatcher(“/jnlp.jsp”).include(request, res); } jnlp.jsp 用于转储动态JNLP: <jnlp spec="1.0+" codebase= href=”test.jnlp”> Demo Sun Microsystems, Inc. 我无法在下载的JNLP中看到正确接收请求参数,但上面的request.getScheme和request.getServerName似乎工作正常。 由于没有正确接收参数值,当JNLP尝试执行时,我得到BadFieldException 。 怎么解决这个?

如何以编程方式或动态创建JSF 2中的复合组件

我需要以编程方式在JSF 2中创建复合组件。经过几天的搜索和实验,我找到了这种方法(在java.net上受到Lexi的启发): /** * Method will attach composite component to provided component * @param viewPanel parent component of newly created composite component */ public void setComponentJ(UIComponent viewPanel) { FacesContext context = FacesContext.getCurrentInstance(); viewPanel.getChildren().clear(); // load composite component from file Resource componentResource = context.getApplication().getResourceHandler().createResource(“whatever.xhtml”, “components/form”); UIComponent composite = context.getApplication().createComponent(context, componentResource); // push component to el composite.pushComponentToEL(context, […]