抢先JavaServer Faces [英] Head start JavaServer Faces

查看:59
本文介绍了抢先JavaServer Faces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 JavaServer Faces (JSF)有一些大概的想法清理.

I have a couple of probably common thoughts on JavaServer Faces (JSF) which I want to clear up.

  • 是否可以仅从JSF(x)页面中向其中添加Java类和Call方法?

我不知道在编写Java程序和开发Web应用程序时怎么做甚至是一个问题.但是,我似乎找不到关于此的具体而直接的指南.

I can't see how this even could be an issue knowing to do when you program Java and develop webapplications. However, I can't seem to find a concrete and straight forward guide on this.

作为旁注,我正在使用Oracle的 JDeveloper .

As a side-note I am using JDeveloper from Oracle.

我希望能够像创建ASP.NET页面一样简单地创建JSF页面,并且希望从某种隐藏的代码"中处理输入并显示结果.

I want to be able to just create a JSF Page as easy as I create a ASP.NET Page and from somewhat a "Code-behind" I want to process input and display outcome.

请按照正确的方向引导我,以便我可以导航此JavaServer Faces丛林!

Please guide me in the right direction so I can navigate this JavaServer Faces jungle!

推荐答案

通常不可能在支持JSF页面的bean中调用任意方法.

it's not generally possible to call arbitrary methods in backing beans from your JSF pages.

我建议阅读一本不错的JSF书或教程( IBM网站上的书或教程有点旧,但仍然值得一读).

I suggest reading a decent JSF book or tutorial (the ones on the IBM website are a little old but still well worth reading).

通常,后备bean使用动作"来工作.

In general backing beans work using "actions".

因此,您在页面中定义了以下内容:

So, you define something like this in your page:

<h:commandLink action="#{backingBean.doSomething}" />

然后,在您的支持bean中,您将拥有:

Then, in your backing bean you have:

public String doSomething() {
    // Your logic goes here
    return "navigation-target";
}

从"doSomething"返回的字符串;将是faces-config.xml文件中定义的字符串,称为结果",它将告诉JSF导航到哪个页面.

The String returned from "doSomething" will be a string as defined in your faces-config.xml file, known as an "outcome", which will tell JSF which page to navigate to.

希望这会有所帮助!

这篇关于抢先JavaServer Faces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆