I've recently dipped my toes into JBoss Seam and naturally have ton to learn but having had a hands on approach so far with looking at code and trying to write my own seam applications I've looking for understanding on below:
I've come across the following peace of code which i cannot see what it is trying to do which is triggered is called when user clicks a button:
<h:commandButton value="Save" type="button" onclick="return userAction(this);" title="User Actions">
<f:param value="#{user.codePk}" name="userCode"/>
<h:inputHidden value="#{user.codePk}" id="code"/>
</h:commandButton>
which calls a javascript function that open a window to display stock on hand:
var pk = document.getElementById("product:code").value;
window.open('<%=basePath1%>jsp/stockOnHand.faces?Code='+pk,"abcd");
I know that stockOnHand.faces is just stockOnHand.jsp and that stockOnHand.jsp contains has a table where stock on hand of a given product is shown in all stores.
I don't get how the part from ?Code='+pk,"abcd" works. Is it similar to how it is done in Java where you can pass parameters to a function ma开发者_如何学运维tching its signature for example
foo(int v, string s);
I hope this isn't too ambiguous.
It is just a string concatenation. The JS window.open
function has the following signature:
open (URL, windowName[, windowFeatures])
The first argument URL
in your example is a concatenation of the given string and the variable pk
. The second argument windowName
is abcd
.
精彩评论