更新时间:2022-04-15 08:13:34
我终于修复了它!
感谢@Kukeltje用户,他向我提示了我做错的基本事情-和@Wietlol用户,通过道德支持和相信我"来激励我进行聊天:)
Thanks to User @Kukeltje, who hinted me at basic things that i got wrong - and User @Wietlol who motivated me in the chat through moral support and 'believes in me' :)
解决方案:
..在Application.java中:
..in Application.java:
public List<Feed> sentNotifications = new ArrayList<>();
public List<String> emails = new ArrayList<>();
public List<String> words = new LinkedList<>(Arrays.asList("vuln", "banana", "pizza", "bonanza"));
public List<String> feeds = new LinkedList<>(
Arrays.asList("http://www.kb.cert.org/vulfeed",
"https://ics-cert.us-cert.gov/advisories/advisories.xml",
"https://ics-cert.us-cert.gov/alerts/alerts.xml")
);
private String currentEmail;
private String currentFeed;
private String currentWord;
[...]
public void addEmail() {
emails.add(currentEmail);
}
.. and gui.xhmtl:
..and gui.xhmtl:
<!-- EMAILS -->
<h3>Configured Emails</h3>
<h:form>
<h:inputText value="#{Application.currentEmail}" var="email"/>
<h:commandButton value="Add Email" action="#{Application.addEmail}"/>
</h:form>
<h:form>
<ui:repeat var="email" value="#{Application.emails}">
<tr>
<td>#{email}</td>
<td>
<f:facet name="header">Action</f:facet>
<h:commandLink value="Delete" action="#{Application.rmEmail(email)}"/>
</td>
</tr>
<br></br>
</ui:repeat>
</h:form>
注意action="#{Application.addEmail}"
如何不使用参数-而是通过value="#{Application.currentEmail}"
将参数传递给方法.
Notice how action="#{Application.addEmail}"
does not make use of arguments- rather the parameter is handed to the method via value="#{Application.currentEmail}"
.
如果您是读者,也有同样的问题,请考虑以下几点:
If you, reader, have the same problem please consider these points:
希望这个答案对有同样问题的人有用!
Hope this answer is usefull to ppl having the same issue!
问候, 皮革