Using JSP scriplets in the JSF tags

Hi,
I haven't done that much JSP development using various tag libraries prior to looking at JSF, hence this very basic question:
I am declaring and manipulating Java variables in my JSP. Is there a way to access those in my JSF tags? It seems that something like:
<%
String myString="MyLabel";
%>
<h:view>
<h:outputText id="myID" value="<%=myString%>" />
</h:view>
blows up in the JSF processor.
I am porting some stuff to JSF and hence do not use backing beans in all cases.
Any suggestions/ideas/pointers are greatly appreciated.
Thanks in advance,
Vadim.

JSF action element attributes take JSF EL expressions, not Java expressions. A JSF EL expression has access to objects in one of request, session or application scope only, not to scripting variables. One way to get your example to work is by putting the String in one of these scopes within the scriptlet, e.g.:
<%
  String myString="MyLabel";
  request.setAttribute("myString", myString);
%>
<h:view>
  <h:outputText id="myID" value="#{myString}" />
</h:view>But, if you're porting a JSP-based application to JSF, I strongly recommend that you move all scriptlet code into beans; otherwise it's kind of pointless to migrate to JSF. The strength of JSF is its separation of UI layout and application logic.
Even though JSP happens to be one way to wire up a JSF view with JSF components, JSF has very little to do with JSP. You need to understand the basic JSF component model, event-driven development, and use JavaBeans to really gain any benefits. Don't be fooled into believing that JSF is "just a new JSP tag library" by the support for JSP as the default presentation layer; it's far more than that, and I personally believe that using JSP as the presentation layer makes using JSF a lot harder than it should be. In fact, most of the issues posted in this forum are issues with the JSP layer, not with the core JSF components or the infrastructure classes.
Hans Bergsten (EG member)

Similar Messages

  • I have deploy an EJB in weblogic 6.1,but how to use jsp to invoke the EJB's method?

    i have deploy an EJB in weblogic 6.1,but how to use jsp to invoke the EJB's method?
    thanks!

    You'd do something like:
    <%
    //vvv this part can potentially be done in initialization
    Context ctx = getInitialContext();
    BeanHome home =
    (BeanHome)PortableRemoteObject.narrow(ctx.lookup("the.jndi.name"),
    BeanHome.class);
    Bean b = home.create();
    //^^^
    Result r = b.invokeMethod();
    %>
    "toxin" <[email protected]> wrote in message
    news:3d2e95e5$[email protected]..
    >
    i have deploy an EJB in weblogic 6.1,but how to use jsp to invoke theEJB's method?
    thanks!

  • Weblogic does not render the JSF tags when .jspf is included in main.jsp

    Hi,
    I have a main.jsp page that has the following:
    <div style="left: 0px; top: 0px; position: absolute">
    <jsp:include page="header.jspf" />
    </div>
    the header.jspf did not get rendered. It displays my main.jsp without rendered the header.jspf when I deploy it to weblogic.
    However, I used the following that works in the creator/SunApp
    <div style="left: 0px; top: 0px; position: absolute">
    <jsp:directive.include file="header.jspf" />
    </div>
    Weblogic gave the following errors:
    Servlet failed with IOException
    java.io.IOException: javax.servlet.jsp.JspException:
    The taglib validator rejected the page: "org.xml.sax.SAXParseException: The markup in the documen
    t following the root element must be well-formed., "
    at weblogic.servlet.jsp.Jsp2Java.outputs([Ljava/lang/Object;)Ljava/util/Enumeration;(Jsp2Java.java:130)
    at weblogic.utils.compiler.CodeGenerator.generate([Ljava/lang/Object;)[Ljava/lang/String;(CodeGenerator.java:258)
    at weblogic.servlet.jsp.JspStub.compilePage(Lweblogic/servlet/internal/RequestCallback;)V(JspStub.java:396)
    at weblogic.servlet.jsp.JspStub.prepareServlet(Lweblogic/servlet/internal/RequestCallback;Z)V(JspStub.java:246)
    at weblogic.servlet.jsp.JspStub.prepareServlet(Lweblogic/servlet/internal/RequestCallback;)V(JspStub.java:196)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(Lweblogic/servlet/internal/RequestCallback;)Ljavax/servlet/Servlet;(ServletStubImpl.ja
    va:598)
    My header.jspf :
    <div style="-rave-layout: grid; width: 400px; height: 200px" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://www.sun.com/web/ui">
    <f:subview id="headernew" rendered="#{headernew != null}">
    <ui:label binding="#{headernew.label1}" id="label1" style="left: 216px; top: 48px; position: absolute" text="Logged In:"/>
    <ui:label binding="#{headernew.label2}" id="label2" style="left: 216px; top: 24px; position: absolute" text="Today's Date:"/>
    <ui:image binding="#{headernew.cccLogo1}" id="cccLogo1" style="left: 0px; top: 0px; position: absolute" url="/resources/ccc_card.gif"/>
    <ui:staticText binding="#{headernew.staticText1}" id="staticText1" style="left: 312px; top: 48px; position: absolute" text="test"/>
    <ui:staticText binding="#{headernew.staticText2}" converter="#{_header.dateTimeConverter1}" id="staticText2"
    style="left: 312px; top: 24px; position: absolute" text="#{SessionBean1.currentDate}"/>
    </f:subview>
    </div>
    please let me know how to dynamically include jspf file to main.jsp and make it work in weblogic.
    Thanks.

    Try the following:
    * Revert the include directive in the main.jsp page to how it was originally.
    * Export the war file for J2EE 1.3 and deploy that to Weblogic.
    The problem is that Weblogic can't handle our xml formated page fragments:-( (Weblogic problem:-()
    In the J2EE 1.3 we try to do a static include of the page fragments into the main pages at build time. So the container never sees the fragments.
    I hope this helps.
    Thanks,
    -- Marco

  • Passing values to JavaBean function using jsp scriplet

    Hi,
    I have a JavaBean funtion that is SaveData(parameters)
    which save the values from HTML form.
    Now i want a code for pass the values from HTML form to SaveData() function using jsp scriptlet.
    I used the code
    <jsp:useBean id="JDBC" class="bean.JDBCBean" scope="application"></jsp:useBean>
    <%=JDBC.saveData(phonenumber,manufacturer,model,email,country,newsletter)%>
    Here
    JDBCBean -> Bean Name
    phonenumber,manufacturer,model,email,country,newsletter ->HTML form's text values
    But it didnt work properly.
    Anyone help me to correct this.

    Hi,
    i have the same code like above
    I have to pass the parameters with form name under the following code.
    <jsp:useBean id="JDBC" class="bean.JDBCBean" scope="application"></jsp:useBean>
    <%=JDBC.saveData(registration.phonenumber.value,id_type.value,id_style.value,registration.email.value,registration.scountry.value,player_type.values)%>
    Here
    registration -> HTML form name
    But i got the error for
    package registration does not exist
    out.print(JDBC.saveData(registration.phonenumber.value,id_type.value,id_style.value,registration.email.value,registration.scountry.value,player_type.values));
    How to i correct this?
    Anyone help me......

  • Using JSP examples in the tutorial of JSP Tomcat

    I have installed Tomcat 4.0.4 and j2sdk1.4.0.
    I have set the folowwing environment variables :
    JAVA_HOME = c:\j2sdk1.4.0
    CLASSPATH = c:\j2sdk1.4.0
    When I try to run the examples from the tutorial, I have the following errors :
    Apache Tomcat/4.0.4 - HTTP Status 500 - Internal Server Error
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: sun/tools/javac/Main
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:481)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.NoClassDefFoundError: sun/tools/javac/Main
         at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:136)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:272)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)
    What is wrong ?

    Add this into your
    CLASSPATH
    <Drive you install Tomcat In>:\Apache Tomcat 4.0\common\lib\servlet.jar
    (This enables Tomcat to find the servlet class files)
    CATALINA_HOME
    <Drive you install Tomcat In>:\Apache Tomcat 4.0
    You should also read the documentation that comes with your Tomcat
    Hope this helps!

  • Programatic Value/MethodBindings with JSF tags

    I read thread http://forum.java.sun.com/thread.jsp?forum=427&thread=526026 "Using JSP scriplets in the JSF tags". The following was suggested but not recomended in order to use JSF Tag EL with a programatically set value.
    <%
    String myString="MyLabel";
    request.setAttribute("myString", myString);
    %>
    <h:view>
    <h:outputText id="myID" value="#{myString}" />
    </h:view>
    Is it possible to set up ValueBinding's and MethodBindings in a similar way or would it be better to dump the JSF tags and use JSF altogether programatically. Below is an example that seems like it should work but the result is the ValueBinding.toString() ends up being the value.
    thanks in advance;
    <%
    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    ValueBinding vb= app.createValueBinding("#{MyBean.member}");
    request.setAttribute("vb", vb);
    %>
    <h:inputText id="myid" value="#{vb}"/>

    --right ValueBinding.getValue() takes a FacesContext, which you definately would not want to pass as and arg in El, even if you could I would think. 
    To answer your question, we are generating several software layers based on an MDA approach. We reverse engineer the database schema into XML then use that "Platform Independent Model" to generate a JDO model and set of persistence-capable Java classes, and now a Faces Bean model and Bean classes. We also have a set of constants files which have all the entity and property names to be used in the web layer.
    Since the database model is huge, and changes alot (government project), hard-coding EL expressions in a thousand places is a very bad idea given the code-generation/reverse-engineering approach.
    We want 100% compile-time checking for all persistent-access properties and the Faces programatic approach to Value/Method bindings gets us there, if it will somehow work.
    --any other ideas would be greatly appreciated.
    --cheers; Scott

  • How we can use jsf tags in included jsp enclosed in subview tags

    Hello everybody,
    I am developing web app by using jsf. I am including a jsp page "header.jsp" into another jsp page "main.jsp". The header.jsp page is enclosed in jsf subview tag on main.jsp page. The header.jsp contains some static html code and some jsf tags like "outputText". When i added tag library url in header.jsp then my app was not even not initiating and i was getting following exception
    ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.
    16:22:16,890 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
    at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:929)
    at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:310)
    ....Now i removed jsf tag library url from included jsp "header.jsp" so now my app is running but only static html data is being displayed but the value in the jsf tag "outputText" is not being printed in the browser
    kindly help me. i would be very thankful....

    Your question has nothing to do with Sun Java System Directory Server.
    Please use the right forum(s).
    Thanks

  • Jsf 1s phase of life cycle how knows ths components of the jsp with jsf tag

    i wish to know how faces servlet knows the jsp s view components while creaTI NG component tree at first request to input jsp which may have jsf tags.in the first phase faces servlet doesnot know input jsp with jsf tags what componnets it has. it is actually atthe response send or forward time which is the final phase when the tag ge executed and output is sent to client.i did understandin jsf life cycle in 1 st phase component tree is created at first request in 1 st phase .

    Hi,
    though a FacesContext holds the values used by a request, it doesn't mean it lives for as long as the request. The best explanation I found is from the JavaDocs
    release
    public abstract void release()
    +Release any resources associated with this FacesContext instance. Faces implementations may choose to pool instances in the associated FacesContextFactory to avoid repeated object creation and garbage collection. After release() is called on a FacesContext instance (until the FacesContext instance has been recycled by the implementation for re-use), calling any other methods will cause an IllegalStateException to be thrown.+
    The implementation must call setCurrentInstance(javax.faces.context.FacesContext) passing null to remove the association between this thread and this dead FacesContext instance.
    Throws:
    java.lang.IllegalStateException - if this method is called after this instance has been released
    Frank

  • JSP ${} expressions in JSF tag attributes

    Does anyone know why the expert group decided not to allow ${} style expressions within JSF tag attributes? I understand that a different syntax is needed to implement the 'late binding' #{} expressions used to link input controls to form beans, but not why the JSF tags actually prevent the use of immediately evaluated ${} expressions for accessing variables in the page scope in JSP 2.0.
    I know there has been a lot of discussion about this and other threads mention a security loophole that would be opened up by allowing expressions like #{blah.${someProperty}}, but I'm not sure why this sort of thing would cause a problem. Is there any way to enable this behaviour, such as editing the JSF tag library descriptors to allow runtime expressions (horrible though that sounds)? Or perhaps another JSF implementation that supports both immediately evaluated and late-binding expressions? It seems a rather unnecessary restriction that is going to cause much confusion and mistyping for all...
    Thanks in advance,
    Keith.

    Thanks Adam, I see the problem now. It's a fairly obscure loophole but serious nonetheless. Of course, this problem could also be avoided by not using request parameters within JSF tags as it doesn't affect the majority of legitimate uses for expressions.
    I have to disagree with you about mixing ${} and #{} expressions though. The majority of developers will be used to writing ${} expressions in JSTL and JSP text and so will expect them to do work the same in JSF tags. Judging by the number of posts in this forum about being unable to use page scope variables in JSF tags this issue is already confusing a lot of people.
    As a rule of thumb, "use ${} for expressions that are output to the page and #{} for binding controls to backing beans and invoking methods" (which perform clearly distinct functions) is a lot simpler and easier to learn IMHO than the current one, which is "use ${} for expressions that are output to the page except within a JSF tag, where you use #{} for the same thing and also to update form values and invoke action methods"! (OK, I'm exaggerating a little for effect, but you get the point... :-)
    I agree that mixing both types of expression in the same attribute might be a little confusing, but this is an unlikely edge case that should probably be prevented in value binding or action attributes anyway. It's more of an issue for label values where mistyping one for the other is already very common and, although not especially difficult to debug, is just another pitfall awaiting the unwary JSP developer. I'm not sure that JSP expressions would be much more difficult to debug anyway as the value and method bindings will simply not work, which is pretty obvious as soon as you try and test the thing.
    Is this something that the EG would be prepared to reconsider for the next release of JSF, or perhaps getting the security loophole addressed in the next JSP spec? In the meantime, is there any reason that developers shouldn't enable runtime expressions in the TLD file provided that they're willing to live with the consequences?
    (Sorry to harp on about it, but I've already had several complaints about this after recommending JavaServer Faces for a major development project at ingenta.com.)
    Many thanks,
    Keith.

  • Integration of JSP and xhtml in jsf project

    Can we use both jsp and xhtml in single jsf project. Actually I encountered a problem while configuring jsp and xhtml in web.xml of jsf project. The web.xml configuration file allows to use only one view handler (jsp or xhtml).By default it use jsp view handler. For xhtml view handler, we need to define following context param -:
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    Please let me know any possibility to configure both jsp and xhtml in jsf project(web.xml).
    My actual requirement is that I need to forward to new page(xhtml) from an xhtml page without using faces-config. I am not able to find any facelets tags which let me forward to new xhtml page. So I am thinking to use jsp to exploit the jsp tag called forward. But the constraint is that we can use only one view handler with jsf project.

    Can we use both jsp and xhtml in single jsf project. Actually I encountered a problem while configuring jsp and xhtml in web.xml of jsf project. The web.xml configuration file allows to use only one view handler (jsp or xhtml).By default it use jsp view handler. For xhtml view handler, we need to define following context param -:
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    Please let me know any possibility to configure both jsp and xhtml in jsf project(web.xml).
    My actual requirement is that I need to forward to new page(xhtml) from an xhtml page without using faces-config. I am not able to find any facelets tags which let me forward to new xhtml page. So I am thinking to use jsp to exploit the jsp tag called forward. But the constraint is that we can use only one view handler with jsf project.

  • Jsp+scriplet

    Am using jsp and display tag.
    Version am using is:
    <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:display="urn:jsptld:http://displaytag.sf.net/el" xmlns:c="urn:jsptld:http://java.sun.com/jstl/core">
    Here am using displaytag to display table. Am using C:forEach to iterate through each column and display it. Using c:out for displaying it along with checkbox. Till here everything works fine.
    But when i try to use Scriplet am getting error.
    Error:
    could no process the requestorg.apache.jasper.JasperException: /web/viewdata.jsp(19,2) The content of elements must consist of well-formed character data or markup.
    Can anyone help me.. Thanks in advance

    HEY THANKS.. HERE IS THE CODE..
    I tried use jsp:scriplet but yet there is an error..
    Error is:
    could no process the requestorg.apache.jasper.JasperException: /web/viewdata.jsp(19,15) Invalid standard action: scriplet
    <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:display="urn:jsptld:http://displaytag.sf.net/el" xmlns:c="urn:jsptld:http://java.sun.com/jstl/core">
    <jsp:directive.page contentType="text/html; charset=UTF-8" />
    <html>
              <link rel="stylesheet" href="../css/displaytag.css" type="text/css" />
         <link rel="stylesheet" href="../css/maven-base.css" type="text/css" />
              <link rel="stylesheet" href="../css/maven-theme.css" type="text/css" />
              <link rel="stylesheet" href="../css/site.css" type="text/css" />
              <link rel="stylesheet" href="../css/screen.css" type="text/css" />
              <head>
              </head>
              <body>
              <c:forEach var="obj" items="${col}">
                   <tr>
                   <td>     <input type="checkbox" name="initCheckBoxMulti" value="${obj.property}" class="button"/> <c:out value= "${obj.property}" />
                   </td>
                   <td></td>
                   </tr>
              </c:forEach>               
         <display:table name="sessionScope.results.rows" class="reportviewer" export="true" id="row" defaultsort="1" defaultorder="ascending"
    pagesize="40" cellspacing="0" decorator="org.displaytag.decorator.TotalTableDecorator" >
              <display:setProperty name="paging.banner.placement" value="top" />
         <c:forEach var="obj" items="${col}">
                   <c:choose>
              <c:when test='${obj.property== "Banner"}'>
                        <display:column property="${obj.property}" sortable="true" group="1"/>
                        </c:when>
              <c:when test='${obj.property== "Campaign"}'>
                        <display:column property="${obj.property}" sortable="true" group="1"/>
                        </c:when>          
              <c:when test='${obj.property== "Advertiser"}'>
                        <display:column property="${obj.property}" sortable="true" group="1"/>
                        </c:when>                              
                        <c:otherwise>
                             <display:column property="${obj.property}" sortable="true"/>
                   </c:otherwise>
                        <c:otherwise>
                             <display:column property="${obj.property}" sortable="true"/>
                   </c:otherwise>
                        <c:otherwise>
                             <display:column property="${obj.property}" sortable="true"/>
                   </c:otherwise>                              
                   </c:choose>
         </c:forEach>
              </display:table>
         </body>
    </html>
    </jsp:root>

  • Report generation using jsp

    I am developing a website using jsp on tomcat.The site required a number of online report generation option from database(mysql).
    My problem is-
    1.how to generate different types of report other than simple html tag embedded within jsp .
    2.How to store all those reports in a file(.txt or .doc).
    N.B I dont want to use any reporting tool.

    Mantosh,
    Have you seen this developer zone article which details accessing Citadel Data using COM+ and ADO?
    http://zone.ni.com/devzone/conceptd.nsf/webmain/725A6C3843F13C8786256EA600633724#6
    Also, this KB article provides more detail on how to access Citadel data using SQL commands and I think will help answer your question:
    http://digital.ni.com/public.nsf/websearch/C7D32F9A59D4637086256A7200692F30?OpenDocument
    --Paul Mandeltort
    Automotive and Industrial Communications Product Marketing

  • Javascript gives an error while added externally or within the script tag

    I have included a Javascript that will return the id of the current element that I am accessing , i am using this script along with the jsf tags.
    The code looks like this :
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
    <html>
    <head>
    <script language="Javascript">
    function focus_id()
    alert(this.id);
    </script>
    </head>
    <f:subview id="task-tree">
    <t:div style="width:170px; height:500px; overflow:auto;">
    <t:tree2
       ... >
       <f:facet name="root-facet">
          <h:panelGroup>
             <t:graphicImage alt="#{msgs.openFolderAlt}" value="/images/dtree/folderopen.gif" rendered="#{t.nodeExpanded}" border="0"/>
             <t:graphicImage alt="#{msgs.folderAlt}"value="/images/dtree/folder.gif" rendered="#{!t.nodeExpanded}" border="0"/>
             <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
          </h:panelGroup>
       </f:facet>
       <f:facet name="node-facet">
          <h:panelGroup>
             <t:graphicImage alt="#{msgs.openFolderAlt}" value="/images/dtree/folderopen.gif" rendered="#{t.nodeExpanded}" border="0"/>
             <t:graphicImage alt="#{msgs.folderAlt}" value="/images/dtree/folder.gif" rendered="#{!t.nodeExpanded}" border="0"/>
             <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
          </h:panelGroup>
       </f:facet>
       <f:facet name="node-with-action-facet">
          <h:panelGroup>
             <t:graphicImage alt="#{msgs.openFolderAlt}" value="/images/dtree/folderopen.gif" rendered="#{t.nodeExpanded}" border="0"/>
             <t:graphicImage alt="#{msgs.folderAlt}" value="/images/dtree/folder.gif" rendered="#{!t.nodeExpanded}" border="0"/>
             <h:commandLink
                immediate="true"
                actionListener="#{t.setNodeSelected}"
                action="#{node.doAction}"
                styleClass="#{t.nodeSelected ? 'rowHighlighted' : 'document'}"
                onclick="focus_id();" >
                <h:outputText value="#{node.label}"/>
             </h:commandLink>
          </h:panelGroup>
       </f:facet>
       <f:facet name="leaf-facet">
          <h:panelGroup>
             <h:commandLink
                immediate="true"
                actionListener="#{t.setNodeSelected}"
                action="#{node.doAction}"
                styleClass="#{t.nodeSelected ? 'rowHighlighted' : 'document'}"
                onclick="focus_id();" >
                <h:outputText value="#{node.label}"/>
             </h:commandLink>
          </h:panelGroup>
       </f:facet>
    </t:tree2>
    </t:div>
    </f:subview>
    </html>This code works fine and returns the element id if included inline but not
    otherwise .... Any clues that you can give me as to why this happens will be great ...

    Problem was solved.
    It was some of illegial symbols at the beginning of xml.

  • Relatiive Path problem when using JSP:include in web portlet

    Hi
    I am using Oracle Portal 9.0.2, and thus OC4J as the J2EE platform.
    I have created a JSP web portlet that is supposed to inlude a specific static html file, which name is passed to it using a portlet parameter. It works, but I had to create a symbolic link from the applicable J2EE applications's htdocs directory in order to access the content:
    /j2ee/OC4J_Portal/applications/<application>/htdocs/<portlet>/content/
    where /content/ is a symbolic link to another directory altogether.
    I can then access the content from within the portlet with a JSP include tag that looks like :
    docPath = "/htdocs/<portlet>/html/"+doc_path;
    %>
    <br>Include:
    <jsp:include page="<%=docPath%>" flush="true"/>
    I would like to access the content using the JSP include without having to use the symbolic link. Is there a way to do this. I tried using an Apache alias, but that did not work.
    Regards
    Harry

    Hi
    Thanx
    In the end we build up a static URL to the document to be included using:
    String contentLocation="content/";
    docPath = contentLocation+getAdditionalDocPath();;
    out.println("docPath="+docPath);
    String docPathAndName = portletRequest.getParameter("doc_path");
    %>
    <!--
    This java script function calls the display content page with the
    page parameter doc_path (which is in return passes it to the display
    content portlet) in order to retrieve and display specific document
    with a JSP:include tag
    -->
    <script language="JavaScript">
    function generateSectionPath(docName) {
    this.location="http://<%=portletRequest.getServerName()%>:<%=portletRequest.getServerPort()%>/pls/portal/url/page/<%=getPageGroup()%>/content?doc_path="+"<%=docPath%>"+docName;
    <script language="JavaScript">
    function generateRelativePath(docName) {
    this.location="http://<%=portletRequest.getServerName()%>:<%=portletRequest.getServerPort()%>/pls/portal/url/page/<%=getPageGroup()%>/content?doc_path="+docName;
    </script>
    <br>Include:
    <%
    if (portletRequest.getParameter("doc_path") == null) {
    out.println("Error - no doc path specified");
    } else { 
    try { %>
    <jsp:include page="<%=docPathAndName%>" flush="true"/>
    <% } catch (Exception e) {
    out.println("Error retrieving document:"+e.toString());
    } // end if
    %>
    Each link from one included HTML file to another becomes a JS function that points the browser to the portal page that includes the portlet that includes thwe JSP that has the include tag to include the html document that is to be displayed.
    The current relative path the the html document (from a predefined root in the file system that is symbolically linked to the same directory as where the including JSP lives) is stored in a session variable, and appended to the document name that is passed to the page.
    If a full document path, as opposed to just the name, is stored, that no appending is done. However, the path is stripped out and stored in a session variable.
    Ths thing is, sometimes a document name, and sometimes a path is passed to the page. Therefore the requirement to know the path when it is not available. A name only will always be passed subsequent to a request for a document with the full path specified, therefore the session variable mechanism works.
    Thanx for the input
    Harry

  • JSF Tags value and valueRef

    Hey
    Does anybody know if these two attributes (value and valueRef) mean the same thing in the JSF tag libraries???
    I am the JWSDP tutorial and some of the examples use value but this does not exist as an attribute for that tag for example
    <f:selectitem itemLabel="Pear"
    value="#{currentFruits.pearSelected}" >
    The tag selectitem does not have a value attribute! it has valueRef and itemValue.
    Ta.

    Hi
    in 1.0_final there is only value-attribute
    cheers,

Maybe you are looking for

  • Custom UI or editor for input-parameter

    I think I need to implement a custom UI editor for an input-paramenter.  My input parameter is really a HashTable. I'd like to present a dialog that allows the user to enter any number of key value pairs.  The optional "editor" element  looks promisi

  • SAXTransformerFactory.newXMLFilter has no way to setParameter!

    HI friends, When doing xslt chain transformation by filter, it seems JXAP's API SAXTransformerFactory.newXMLFilter() has no way to setParameter to transformer! Let's see this: TransformerFactory tFactory = TransformerFactory.newInstance(); //check Tr

  • Using Pro XI and formscentral

    My form which previously collected data using Tracker is now using FormsCentral since I downloaded the trial for Pro XI. The only thing is that the check box fields are not passing their data value to Formscentral just the true or  false value. Is th

  • Inbound Processing for cremas

    I am getting CREMAS idoc from SAP to my SAP system. When it comes to my system, i dont want that to create a new vendor number instead update or overwrite the exixiting vendoe number. Can anyone lemme know how i can do that

  • Playback keeps jumping forwards on scrollback

    I used scroll back to find a programme on ITV and played it back. Several errors ocucured: 1) They programme kept jumping forwards to the next ad break. I had to watch the ads then rewind to the point where it jumped forward. This happened about 8 ti