当我调试我的接缝应用程序时,我突然意识到我并不真正理解参数传递的工作原理.以下术语让我很困惑.所以我在问这个非常普遍的问题,希望能够很好地解释什么与什么以及某些事物的作用有什么关系.
首先,要从一个页面到下一个页面,您可以使用h:commandButton或s:按钮.我理解s:按钮不提交表单,但这并不能帮助我理解差异.如果您没有通过从一个页面到下一个页面提交表单,那么您在做什么?
我的应用程序涉及在表单中输入信息,点击按钮然后转到运行查询后显示结果的新页面.我似乎已经看到这个活动是用s:按钮进行的,那么如果它不是"提交表单"怎么办呢?我觉得我在这里缺少一些基本的东西.
至于参数本身...从我看到的你可以使用3种方法之一传递参数:
我敢肯定,这个问题揭示了很多无知.
希望你们中的一个有说服力的人会"得到"我所要求的东西并给我一个解释这个过程的方法.
提前致谢.
TDR
似乎无论我做什么,我得到了错误的结果.
我的清单定义如下:
private List<String> selectedPriorities;
Run Code Online (Sandbox Code Playgroud)
getter/setter没什么奇怪的或花哨的:
public void setSelectedPriorities(List<String> selectedPriorities) {
this.selectedPriorities = selectedPriorities;
}
public List<String> getSelectedPriorities() {
return selectedPriorities;
}
Run Code Online (Sandbox Code Playgroud)
在会话bean中,我想根据此列表的内容(或缺少内容)更改不同的列表.
这是代码:
List<String> restrictList = new ArrayList<String>();
restrictList.add("lower(logs.clazz) like lower(concat(#{logs.clazz},'%'))");
restrictList.add("lower(logs.rule) like lower(concat(#{logs.rule},'%'))");
PrioritySelectorBean selectorBean = (PrioritySelectorBean) Component.getInstance("prioritySelectorBean",true);
System.out.println("constructRestrictionList selectorBean "+selectorBean.getSelectedPriorities());
if (selectorBean.getSelectedPriorities() == null) {
System.out.println("IS NULL");
return restrictList;
}
if (selectorBean.getSelectedPriorities().isEmpty()){
System.out.println("IS EMPTY");
}
if (selectorBean.getSelectedPriorities().size()<1){
System.out.println("HAS NOTHING IN IT");
return restrictList;
}
System.out.println("NOT NULL");
restrictList.add("lower(logs.priority) in (#{prioritySelectorBean.selectedPriorities})");
Run Code Online (Sandbox Code Playgroud)
它总是落到NOT NULL并将字符串添加到restrictList.它让我疯了!如何在此列表中检测到虚无?这是日志片段
14:24:10,057 INFO [STDOUT] constructRestrictionList selectorBean [] …
Run Code Online (Sandbox Code Playgroud) 我试图将换行标记
插入到某些文本中并将其显示在网页上.<和>符号正被翻译成<
和>
,并且标签在网页上显示为文本.
当我从数据库中选择它时,文本看起来像这样(我将它输出到SYSOUT):
version 12.4
service timestamps debug datetime
service timestamps log datetime
service password-encryption
Run Code Online (Sandbox Code Playgroud)
然后我通过这个小过滤器运行它:
public DevConfigs getDevConfig() {
String config = devConfig.getConfig();
Pattern pattern = Pattern.compile(".$", Pattern.MULTILINE | Pattern.DOTALL);
Matcher matcher = pattern.matcher(config);
String newConfig = matcher.replaceAll("<br />");
devConfig.setConfig(newConfig);
return this.devConfig;
}
Run Code Online (Sandbox Code Playgroud)
这是网页(它是使用facelets的Seam应用程序):
<rich:tab label="Config">
hello<br />
there<br />
#{devConfig.config}
</rich:tab>
Run Code Online (Sandbox Code Playgroud)
页面源代码如下:
hello<br />
there<br />
<br />
<br />
version 12.<br />
service timestamps debug datetim<br />
service timestamps log datetim<br />
service …
Run Code Online (Sandbox Code Playgroud) 在JBoss AS 7.1.0.Final上部署.
我有一个非常简单的测试应用程序.它正在按预期工作直到前一天(着名的最后一句话)并且不再做最基本的事情,即设置输入组件的值并在动作组件中使用它.我把这件事情剥夺了基础,无法弄清楚发生了什么.
index.xhtml在这里
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>contacts</title>
</h:head>
<h:form>
<h:outputLabel value="Message:" />
<h:inputText value="#{contactView.siteCode}" />
<h:commandButton action="#{contactView.save}" value="Save" />
</h:form>
</html>
Run Code Online (Sandbox Code Playgroud)
ViewScoped bean就在这里
@Named
@ViewScoped
public class ContactView implements Serializable {
public ContactView() {
}
private String siteCode;
public String getSiteCode() {
System.out.println("getSiteCode: "+ siteCode);
return siteCode;
}
public void setSiteCode(String siteCode) {
System.out.println("setSiteCode: "+ siteCode);
this.siteCode = siteCode;
}
public String save(){
System.out.println("Saving sitecode: " + siteCode); …
Run Code Online (Sandbox Code Playgroud) 我有 2 个工作区。我无法在第二个工作区中配置服务器部署目录。
日蚀靛蓝。JBoss 服务器 5.x。
部署目录为 D:\Development2\projects2.metadata.plugins\org.jboss.ide.eclipse.as.core\JBoss_EAP_5.x_Runtime_Server1324558380698\deploy
我希望它是 D:\Development\jboss-eap-5.1\jboss-as\server\default\deploy,因为它是第一个工作区中的服务器。
我已经尝试了与此服务器相关的所有首选项和属性,但无法更改。我完全是为了编辑 .xml 文件,我只是找不到包含此信息的文件。
有任何想法吗?