今天我使用servlet从HTML页面接收POST,然后重定向到我的JSF页面.
这是我的实际Servlet:
public class CommInServlet extends HttpServlet {
private String reportKey;
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getSession(true).setAttribute("reportKey", req.getParameter("reportkey"));
req.getRequestDispatcher("main.xhtml").forward(req, resp);
}
}
Run Code Online (Sandbox Code Playgroud)
HTML帖子页面:
<html>
<head />
<body>
<form action="Filtro" method="post">
<input type="text" size="120" name="reportkey" value="XXXXXXXXXXXX" />
<input type="submit" value="doPost" />
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
是否可以直接发布到我的JSF页面(ManagedBean)?怎么样?我想更换一些东西......更好.
当我序列化/反序列化任何对象时,所有字段名称都转换为小写.是否有任何配置可以让Jackson完全保留字段名称?用于序列化和反序列化?
(我知道@JsonProperty,但这似乎不对,因为我需要的只是杰克逊尊重已经存在的东西)
我的测试代码:
import java.io.Serializable;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.AnnotatedField;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
public class Test {
static class Example implements Serializable {
private String Test;
private String ABC;
private String XyZ;
public String getTest() { return Test; }
public void setTest(String test) { Test = test; }
public String getABC() { return ABC; }
public void setABC(String abc) { ABC = abc; }
public String getXyZ() { return XyZ; }
public void setXyZ(String …Run Code Online (Sandbox Code Playgroud) 即使现在在Angular Material的7.2版本中,我似乎找不到关于如何在mat-table上使用rowspan并保留组件功能的示例.
这是多远(简短?)我得到的:
https://stackblitz.com/edit/angular-wudscb
上面的Stackblitz中的示例"几乎"是我正在寻找的,但我无法看到如何完成它.
...
===============================================
|| || || || row1 ||
|| 1 || Hydrogen || 1.0079 ||========||
|| || || || row2 ||
===============================================
|| || || || row1 ||
|| || || ||========||
|| 2 || Helium || 4.0026 || row2 ||
|| || || ||========||
|| || || || row3 ||
===============================================
|| || || || row1 ||
|| 3 || Lithium || 6.941 ||========||
|| || || || row2 ||
===============================================
...
Run Code Online (Sandbox Code Playgroud)
使用其他元数据格式的示例可在以下位置找到:
我构建了一个非常简单的PhoneGap插件来开始测试我将在Android上构建一些本机操作的方式.
JavaScript的:
function callNativePlugin() {
cordova.exec(nativePluginResultHandler, nativePluginErrorHandler, "Database", "saveAdvertencia", [ 1, "TesteAdv" ]);
}
function nativePluginResultHandler(result) {
alert("SUCCESS: \r\n" + result);
}
function nativePluginErrorHandler(error) {
alert("ERROR: \r\n" + error);
}
Run Code Online (Sandbox Code Playgroud)
Java的:
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("saveAdvertencia")) {
advertenciaDS = new AdvertenciaDS(cordova.getActivity());
callbackContext.sendPluginResult(new PluginResult(Status.OK, new JSONArray("test")));
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
我需要的是一种从同一方法中的动作中检索结果的方法.总是处理3个方法(1执行动作.1定义成功动作是什么.1定义什么是错误动作.)当你没有真正控制它们何时被调用时,这是非常复杂的,因为PhoneGap在操作完成后调用它们.
如果我需要从Android Native数据库中检索一些数据:
由于selectArgs不正确,我正在执行以下方法但没有成功(至少这是我所相信的.
找到所有:
public Collection<Object> findAllByCodigoSetorOrderByStatusWhereDataAgendamentoIsNull(Integer vendedor) {
Collection<Object> objects = null;
String selection = Object.FIELDS[20] + "=?" + " OR " + Object.FIELDS[20] + "=?" + " OR " + Object.FIELDS[20] + "=?" + " AND " + Object.FIELDS[6] + "=?";
String[] selectionArgs = new String[] { "''", "'null'", "NULL", String.valueOf(vendedor) };
Collection<ContentValues> results = findAllObjects(Object.TABLE_NAME, selection, selectionArgs, Object.FIELDS, null, null, Object.FIELDS[4]);
objects = new ArrayList<Object>();
for (ContentValues result : results) {
objects.add(new Object(result));
}
return objects;
}
Run Code Online (Sandbox Code Playgroud)
findAllObjects:
protected …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的UserDAO注入Apache Shiro正在使用的自定义AuthorizingRealm中,但是......我得到了null.
我究竟做错了什么?
shiro.ini
[main]
user = demo.shiro.security.FacesAjaxAwareUserFilter
realmA = demo.shiro.security.JpaRealm
credentialsMatcher = org.apache.shiro.authc.credential.SimpleCredentialsMatcher
realmA.credentialsMatcher = $credentialsMatcher
securityManager.realms = $realmA
user.loginUrl = /pages/public/login.xhtml
[users]
admin = admin
user = user
[urls]
# public files and folders
/index.html = anon
/resources/** = anon
/pages/public/** = anon
# restricted files and folders
/pages/admin/** = user
/pages/user/** = user
Run Code Online (Sandbox Code Playgroud)
JpaRealm.java
public class JpaRealm extends AuthorizingRealm {
@Inject
private UserDao userDao;
public JpaRealm() {
setCredentialsMatcher(new Sha256CredentialsMatcher());
}
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authToken) throws AuthenticationException { …Run Code Online (Sandbox Code Playgroud) <h:form id="form">
<p:messages />
<p:panel header="Análise">
<h:outputText value="Mês da análise: " />
<p:selectOneMenu value="#{report005.selectedMes}">
<f:selectItems var="data" value="#{report005.analiseMeses}" itemLabel="#{report005.formataDataCombo(data)}" />
<f:convertDateTime pattern="MM/yyyy" />
</p:selectOneMenu>
<p:commandButton value="Análises" update="analiseTable" actionListener="#{report005.loadAnalise()}" />
<p:dataTable id="analiseTable" var="pes" value="#{report005.analiseModel}" selection="#{report005.selectedAnalise}" emptyMessage="Não há registros...">
<p:column selectionMode="multiple" style="width:18px" />
<p:ajax event="rowSelectCheckbox" listener="#{report005.loadAnaliseProduto()}" update="produtosmanycheck" />
<p:column headerText="Código">
#{pes.cod_analise}
</p:column>
<p:column headerText="Nome">
#{pes.dsc_analise}
</p:column>
<p:column headerText="Descrição">
#{pes.dsc_resumida_acao}
</p:column>
<p:column headerText="Planejamento">
<h:outputText value="#{pes.dat_planejamento_analise}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
</p:column>
</p:dataTable>
</p:panel>
<p:panel header="Produto Gerencial">
<p:selectManyCheckbox id="produtosmanycheck" value="#{report005.selectedProduto}" layout="pageDirection">
<f:selectItems id="teste" value="#{report005.produtos}" />
</p:selectManyCheckbox> …Run Code Online (Sandbox Code Playgroud)