开发者

Set attribute of standard HTML-tag using JSF

开发者 https://www.devze.com 2023-02-05 15:26 出处:网络
Me again about JSF. This time I have another JSF page, looking like: <%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%>

Me again about JSF. This time I have another JSF page, looking like:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <f:loadBundle var="messages" basename="ch.bfh.web2.stundenplan.Messages"/>
    <head>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style.css">
        <script type="text/javascript" src="${pageContext.request.contextPath}/script.js">    </script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Insert title here</title>
    </head>
    <body>
        <f:view>
            <h1><h:outputText value="#{messages.graphicalTitle}"/><h:commandButton value="#{messages.btnBack }" type="submit" action="return"></h:commandButton></h1>
            <h:outputText value="#{displayCalendarBean.text}"></h:outputText>
            <iframe src="#{displayCalendarBean.calendarSource }" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>
        </f:view>
    </body>
</html>

This time, JSF complains about the iframe. What I really would like to do is something like

<iframe src="someUrl.php?param1=#{someBean.someProperty}&param2=#{someBean.someProperty2}"></iframe>

But i thought maybe it doesn't work that way. So I generate the entire property in the bean and try to put it in there entirely.

What do I need to do to have the EL expression replaced?


Edit: Error: org.apache.jasper.JasperException: /displayCalendar.jsp(17,16) #{...} is not allowed in template text

I'm using JSF 2.0 on Dynamic Web Module 2.5 with Java 1.5. And this doesn't come from eclipse but a MyFaces' error page is shown. I could post the component tree but I think it doesn't change anything here.

Stack trace:

javax.faces.FacesException: org.apache.jasper.JasperException: /displayCalendar.jsp(17,16) #{...} is not allowed in template text
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:258)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.jasper.JasperException: /displayCalendar.jsp(17,16) #{...} is not allowed in template text
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:706)
at org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:958)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:865)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1763)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:368)
at org.apache.myfaces.view.jsp.JspViewDeclarationLanguage.buildView(JspViewDeclarationLanguage.java:94)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:66)
at 开发者_StackOverflow社区org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
... 13 more

Maybe there's another way: I would like to use Google Calendar API using the publish tools. Any even better way to do this?


Deferred EL #{...} in template text is only allowed when you're using Facelets, the successor of JSP. Use ${...} instead. It won't auto-create the managed bean, but it will just work if the managed bean is already been auto-created by #{...} before in the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号