我正在发送HTML格式的电子邮件通讯.在HTML里面我有类似的东西
<img height='70' width='70' style='display:block' src='myDomain.com/imageName.png'>
当我用Thunderbird或Outlook打开时事通讯时,正在显示图像.但是,当我使用Gmail打开它时,不会显示任何图像.我不确定这是关于Gmail出于安全原因使用的代理还是其他内容.无论哪种方式,我想知道是否有人遇到过这个,如果有的话,它是如何解决的.
我onsubmit不行.我的想法是放置一些必填字段,为了实现这一点,我onsubmit在HTML中使用调用JavaScript函数的表单中的方法.
这个想法是,如果所有必填字段都填写完毕,javascript函数将返回true并继续转到页面/control/Cadastro.php.否则,如果任何必填字段为空,它将返回false并且不会移动到页面/control/Cadastro.php,保持在当前页面中直到为真.
不幸的是,false如果没有按预期填充所有必填字段,函数会返回,但它仍然会移动到页面/control/Cadastro.php,即使它不应该.
我将切断一些代码,使我的观点可以察觉.
<!DOCTYPE html>
<html>
<head>
<script>
function ValidateRequiredFields()
{
var message = new String('\nCampos obrigatórios:\n');
var flag=new Boolean(1);
var x=document.forms["theForm"]["nr_processoCA"].value;
if (x==null || x==""){
message += '\nNº do processo\n';
flag = new Boolean(0);
}
if (flag == false){
alert(message);
}
return flag;
}
</script>
</head>
<body>
<form name="theForm" onsubmit="return ValidateRequiredFields()" method="post" action="../control/Cadastro.php">
Nº do Processo: <br>
<input type="text" name="nr_processoCA" class="input-xlarge">
<br> …Run Code Online (Sandbox Code Playgroud) 我有一个会话范围的 bean ComponenteM,它被注入到请求范围的 bean ComponenteC 中。
@Named
@RequestScoped
public class ComponenteC implements Serializable {
@Inject
ComponenteM componenteM;
}
Run Code Online (Sandbox Code Playgroud)
ComponenteC 有一个由 HtmlCommandLink(以编程方式创建)调用的导出方法。导出方法调用与 SAP BO 网络服务集成的网络服务,以便将报表导出到 excel。但是,只有当调用时间过长时,我才会收到 BusyConversationException。任何其他少于 10 分钟的导出都是成功的。
同时我在对话中没有其他电话(AJAX 或非 AJAX 调用)。我已经尝试在开始对话时为对话 bean 设置显式超时,但我读到它仅用作对 CDI 容器的建议,并且可能会被忽略:
public void beginConversation() {
if (conversation.isTransient()) {
conversation.setTimeout(60 * 60 * 1000);
conversation.begin();
}
}
Run Code Online (Sandbox Code Playgroud)
错误是:
ServletException.org.jboss.weld.context.BusyConversationException 的根本原因:WELD-000322 对话锁定超时:1
我还尝试通过线程发出导出请求,然后将导出的文档返回到对话中。我的想法是让一个线程忙于处理文档和 componenteC 的导出,在等待线程完成时,偶尔会检查执行 componenteM.beginConversation();
我试图理解为什么即使没有并发请求也会抛出 BusyConversationException。
谢谢你。
我有两个不同的项目:A 和 B。
B 包含一个拦截器,我想在项目 A 以及将来的项目 C 和 D 中使用它。
我在两个项目中都使用 jboss-javaee-6.0 版本 3.0.3.Final (这意味着 CDI 版本 1.0)。
项目B(不包含beans.xml):
@InterceptorBinding
@Target({TYPE, METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PerformanceLog {
}
@Interceptor
@PerformanceLog
public class LoggingInterceptor {
private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
@AroundInvoke
public Object logMethodEntry(InvocationContext ctx) throws Exception {
LOG.debug("Entered method (" + ctx.getMethod().getName() + ") of class (" + ctx.getMethod().getClass() + ").");
}
}
Run Code Online (Sandbox Code Playgroud)
项目A(包含beans.xml):
beans.xml(声明拦截器以激活它):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>commons.utils.logging.performanceInterceptor.LoggingInterceptor</class>
</interceptors>
</beans> …Run Code Online (Sandbox Code Playgroud) 我正从DB中检索大块数据并使用此数据将其写入其他位置.为了避免漫长的处理时间,我正在尝试使用并行流来编写它.
当我将其作为顺序流运行时,它可以完美地运行.但是,如果我将其更改为并行,则行为很奇怪:它会多次打印同一个对象(超过10个).
@PostConstruct
public void retrieveAllTypeRecords() throws SQLException {
logger.info("Retrieve batch of Type records.");
try {
Stream<TypeRecord> typeQueryAsStream = jdbcStream.getTypeQueryAsStream();
typeQueryAsStream.forEach((type) -> {
logger.info("Printing Type with field1: {} and field2: {}.", type.getField1(), type.getField2()); //the same object gets printed here multiple times
//write this object somewhere else
});
logger.info("Completed full retrieval of Type data.");
} catch (Exception e) {
logger.error("error: " + e);
}
}
public Stream<TypeRecord> getTypeQueryAsStream() throws SQLException {
String sql = typeRepository.getQueryAllTypesRecords(); //retrieves SQL query in String format …Run Code Online (Sandbox Code Playgroud) 我有一个动态生成的数据表,就像这样
DataTable dataTable = new DataTable();
dataTable.setValue(relatorioVOList);
dataTable.setVar("rVO");
Column checkBoxColumn = new Column();
checkBoxColumn.getChildren().add(this.viewComponentBuilder.createExpressionTextWithLink("#{rVO.iRelatorio}","#{rVO.nNome}"));
dataTable.getColumns().add(checkBoxColumn);
public HtmlForm createExpressionTextWithLink(String iRelatorioExpressionValue, String valueExpressionValue) {
HtmlForm form = new HtmlForm();
HtmlCommandLink link = new HtmlCommandLink();
//config
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ExpressionFactory ef = application.getExpressionFactory();
ELContext elc = context.getELContext();
//value that is the reports name
ValueExpression nameValueExp = ef.createValueExpression(elc, valueExpressionValue, Object.class);
link.setValueExpression("value", nameValueExp);
//action that goes to method teste when link is clicked
MethodExpression methodExpression = createMethodExpression("#{componenteC.teste(rVO.iRelatorio)}", String.class, Integer.class);
link.setActionExpression(methodExpression); …Run Code Online (Sandbox Code Playgroud) cdi ×2
html ×2
forms ×1
gmail ×1
interceptor ×1
jakarta-ee ×1
java-8 ×1
java-stream ×1
javascript ×1
jsf ×1
onsubmit ×1
primefaces ×1
weld ×1