RAD 7 and included .jsp files - Websphere

This is a discussion on RAD 7 and included .jsp files - Websphere ; Hello, I'm having trouble in RAD 7 with what is probably a simple problem. I have two .jsp files (a.jsp and b.jsp). The file a.jsp has an include directive that includes b.jsp thusly: On a.jsp I create a String object ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: RAD 7 and included .jsp files

  1. RAD 7 and included .jsp files

    Hello,

    I'm having trouble in RAD 7 with what is probably a simple problem. I have two .jsp files (a.jsp and b.jsp). The file a.jsp has an include directive that includes b.jsp thusly:

    <%@ include file="b.jsp" %>

    On a.jsp I create a String object s. I then try to use this string object on b.jsp (without creating the object). RAD is complaining about the fact that I'm using a variable/object that has not been defined. How do I tell RAD b.jsp that my string s exists?

    My code is quite a bit more complicated than this, but basically it describes what I'm running into. Any help, guidance, or direction would be immensely appreciated.

    -jeff

  2. Re: RAD 7 and included .jsp files

    Jeff Ousley wrote:
    > Hello,
    >
    > I'm having trouble in RAD 7 with what is probably a simple problem. I
    > have two .jsp files (a.jsp and b.jsp). The file a.jsp has an include
    > directive that includes b.jsp thusly:
    >
    > <%@ include file="b.jsp" %>
    >
    > On a.jsp I create a String object s. I then try to use this string
    > object on b.jsp (without creating the object). RAD is complaining about
    > the fact that I'm using a variable/object that has not been defined. How
    > do I tell RAD b.jsp that my string s exists?
    >
    > My code is quite a bit more complicated than this, but basically it
    > describes what I'm running into. Any help, guidance, or direction would
    > be immensely appreciated.
    >
    > -jeff


    I don't think that a jsp include is like a C++ include. The jsp include
    will bring in the output of the other jsp. You probably want to save
    your string in the request in the first jsp and retrieve it in the
    second jsp?

    Mike (not to be confused with a jsp expert)

  3. Re: RAD 7 and included .jsp files

    M.Hockings wrote:
    > Jeff Ousley wrote:
    >> Hello,
    >>
    >> I'm having trouble in RAD 7 with what is probably a simple problem. I
    >> have two .jsp files (a.jsp and b.jsp). The file a.jsp has an include
    >> directive that includes b.jsp thusly:
    >>
    >> <%@ include file="b.jsp" %>
    >>
    >> On a.jsp I create a String object s. I then try to use this string
    >> object on b.jsp (without creating the object). RAD is complaining
    >> about the fact that I'm using a variable/object that has not been
    >> defined. How do I tell RAD b.jsp that my string s exists?
    >>
    >> My code is quite a bit more complicated than this, but basically it
    >> describes what I'm running into. Any help, guidance, or direction
    >> would be immensely appreciated.
    >>
    >> -jeff

    >
    > I don't think that a jsp include is like a C++ include. The jsp include
    > will bring in the output of the other jsp. You probably want to save
    > your string in the request in the first jsp and retrieve it in the
    > second jsp?
    >
    > Mike (not to be confused with a jsp expert)


    Mike,

    Thanks for taking the time to respond. I appreciate it. Actually, using the include directive as I showed in my first message should pull all the text from the included file (b.jsp) into the first file (a.jsp) at compile time. Here's the info on the include directive from Sun:

    ==========
    The <%@ include %> directive inserts a file of text or code in a JSP file at translation time, when the JSP file is compiled. When you use the <%@ include %> directive, the include process is static. A static include means that the text of the included file is added to the JSP file. The included file can be a JSP file, HTML file, or text file. If the included file is a JSP file, its JSP elements are translated and included (along with any other text) in the JSP file. Once the included file is translated and included, the translation process resumes with the next line of the including JSP file.
    ==========

    The thing is, this works perfectly in tomcat. And, I did have it working in RAD6 about a year ago, I just cannot recall how I convinced RAD6 to not complain.

    This is what I'm doing (or an extremely simplified version of it):

    a.jsp
    =====

    <% String s = "test"; %>
    <%@include file="b.jsp"%>


    b.jsp
    =====

    hello
    <%= s %>



    Now, when I call a.jsp I see this as output:

    output
    ======
    hello test


    The problem is, in RAD7, it's complaining about b.jsp such that I cannot compile or publish to a WAS server. The line <%= s > has a big white X in a red circle next to it. Hovering over it gives this message:

    "s cannot be resolved"


    I've used includes this way with success for some time. Is this just wrong? If not, how do I convince RAD that it's OK, that the object "s" actually does exist?

    Thanks!
    -jeff

  4. Re: RAD 7 and included .jsp files

    Jeff Ousley wrote:
    > Mike,
    >
    > Thanks for taking the time to respond. I appreciate it. Actually, using
    > the include directive as I showed in my first message should pull all
    > the text from the included file (b.jsp) into the first file (a.jsp) at
    > compile time. Here's the info on the include directive from Sun:
    >
    > ==========
    > The <%@ include %> directive inserts a file of text or code in a JSP
    > file at translation time, when the JSP file is compiled. When you use
    > the <%@ include %> directive, the include process is static. A static
    > include means that the text of the included file is added to the JSP
    > file. The included file can be a JSP file, HTML file, or text file. If
    > the included file is a JSP file, its JSP elements are translated and
    > included (along with any other text) in the JSP file. Once the included
    > file is translated and included, the translation process resumes with
    > the next line of the including JSP file.
    > ==========
    >
    > The thing is, this works perfectly in tomcat. And, I did have it working
    > in RAD6 about a year ago, I just cannot recall how I convinced RAD6 to
    > not complain.
    >
    > This is what I'm doing (or an extremely simplified version of it):
    >
    > a.jsp
    > =====
    >
    > <% String s = "test"; %>
    > <%@include file="b.jsp"%>
    >
    >
    > b.jsp
    > =====
    >
    > hello
    > <%= s %>
    >
    >
    >
    > Now, when I call a.jsp I see this as output:
    >
    > output
    > ======
    > hello test
    >
    >
    > The problem is, in RAD7, it's complaining about b.jsp such that I cannot
    > compile or publish to a WAS server. The line <%= s > has a big white X
    > in a red circle next to it. Hovering over it gives this message:
    >
    > "s cannot be resolved"
    >
    >
    > I've used includes this way with success for some time. Is this just
    > wrong? If not, how do I convince RAD that it's OK, that the object "s"
    > actually does exist?
    >
    > Thanks!
    > -jeff


    Have you considered making b.jsp a jsp fragment ? (b.jspf)

    Mike (really, NOT a jsp expert)

  5. Re: RAD 7 and included .jsp files

    M.Hockings wrote:
    > Jeff Ousley wrote:
    >> Mike,
    >>
    >> Thanks for taking the time to respond. I appreciate it. Actually,
    >> using the include directive as I showed in my first message should
    >> pull all the text from the included file (b.jsp) into the first file
    >> (a.jsp) at compile time. Here's the info on the include directive from
    >> Sun:
    >>
    >> ==========
    >> The <%@ include %> directive inserts a file of text or code in a JSP
    >> file at translation time, when the JSP file is compiled. When you use
    >> the <%@ include %> directive, the include process is static. A static
    >> include means that the text of the included file is added to the JSP
    >> file. The included file can be a JSP file, HTML file, or text file. If
    >> the included file is a JSP file, its JSP elements are translated and
    >> included (along with any other text) in the JSP file. Once the
    >> included file is translated and included, the translation process
    >> resumes with the next line of the including JSP file.
    >> ==========
    >>
    >> The thing is, this works perfectly in tomcat. And, I did have it
    >> working in RAD6 about a year ago, I just cannot recall how I convinced
    >> RAD6 to not complain.
    >>
    >> This is what I'm doing (or an extremely simplified version of it):
    >>
    >> a.jsp
    >> =====
    >>
    >> <% String s = "test"; %>
    >> <%@include file="b.jsp"%>
    >>
    >>
    >> b.jsp
    >> =====
    >>
    >> hello
    >> <%= s %>
    >>
    >>
    >>
    >> Now, when I call a.jsp I see this as output:
    >>
    >> output
    >> ======
    >> hello test
    >>
    >>
    >> The problem is, in RAD7, it's complaining about b.jsp such that I
    >> cannot compile or publish to a WAS server. The line <%= s > has a big
    >> white X in a red circle next to it. Hovering over it gives this message:
    >>
    >> "s cannot be resolved"
    >>
    >>
    >> I've used includes this way with success for some time. Is this just
    >> wrong? If not, how do I convince RAD that it's OK, that the object "s"
    >> actually does exist?
    >>
    >> Thanks!
    >> -jeff

    >
    > Have you considered making b.jsp a jsp fragment ? (b.jspf)
    >
    > Mike (really, NOT a jsp expert)


    Mike,

    Yes, I have tried that as well...to no avail. I have the feeling that I'm missing something obvious, or incredibly simple. That seems to be common with me. Thanks for your generous time.

    -jeff

  6. Re: RAD 7 and included .jsp files

    Jeff Ousley wrote:
    > M.Hockings wrote:
    >> Jeff Ousley wrote:
    >>> Mike,
    >>>
    >>> Thanks for taking the time to respond. I appreciate it. Actually,
    >>> using the include directive as I showed in my first message should
    >>> pull all the text from the included file (b.jsp) into the first file
    >>> (a.jsp) at compile time. Here's the info on the include directive
    >>> from Sun:
    >>>
    >>> ==========
    >>> The <%@ include %> directive inserts a file of text or code in a JSP
    >>> file at translation time, when the JSP file is compiled. When you use
    >>> the <%@ include %> directive, the include process is static. A static
    >>> include means that the text of the included file is added to the JSP
    >>> file. The included file can be a JSP file, HTML file, or text file.
    >>> If the included file is a JSP file, its JSP elements are translated
    >>> and included (along with any other text) in the JSP file. Once the
    >>> included file is translated and included, the translation process
    >>> resumes with the next line of the including JSP file.
    >>> ==========
    >>>
    >>> The thing is, this works perfectly in tomcat. And, I did have it
    >>> working in RAD6 about a year ago, I just cannot recall how I
    >>> convinced RAD6 to not complain.
    >>>
    >>> This is what I'm doing (or an extremely simplified version of it):
    >>>
    >>> a.jsp
    >>> =====
    >>>
    >>> <% String s = "test"; %>
    >>> <%@include file="b.jsp"%>
    >>>
    >>>
    >>> b.jsp
    >>> =====
    >>>
    >>> hello
    >>> <%= s %>
    >>>
    >>>
    >>>
    >>> Now, when I call a.jsp I see this as output:
    >>>
    >>> output
    >>> ======
    >>> hello test
    >>>
    >>>
    >>> The problem is, in RAD7, it's complaining about b.jsp such that I
    >>> cannot compile or publish to a WAS server. The line <%= s > has a big
    >>> white X in a red circle next to it. Hovering over it gives this message:
    >>>
    >>> "s cannot be resolved"
    >>>
    >>>
    >>> I've used includes this way with success for some time. Is this just
    >>> wrong? If not, how do I convince RAD that it's OK, that the object
    >>> "s" actually does exist?
    >>>
    >>> Thanks!
    >>> -jeff

    >>
    >> Have you considered making b.jsp a jsp fragment ? (b.jspf)
    >>
    >> Mike (really, NOT a jsp expert)

    >
    > Mike,
    >
    > Yes, I have tried that as well...to no avail. I have the feeling that
    > I'm missing something obvious, or incredibly simple. That seems to be
    > common with me. Thanks for your generous time.
    >
    > -jeff


    *bump*

  7. Re: RAD 7 and included .jsp files

    Jeff Ousley wrote:
    > *bump*


    I would expect that since nobody else has taken interest at this point
    bumping it would not be of any benefit.

    BTW, it all works fine for me. That is, the included jsp shows an error
    when verified but runs OK. However, it would not be my programming
    style to use that technique. I prefer each jsp to be complete of itself
    even though I may use the output of more than one jsp to compose a page.
    This also has the side benefit of verifying cleanly.

    Mike (just a J2EE user, NOT and expert)

  8. Re: RAD 7 and included .jsp files

    M.Hockings wrote:
    > Jeff Ousley wrote:
    >> *bump*

    >
    > I would expect that since nobody else has taken interest at this point
    > bumping it would not be of any benefit.
    >
    > BTW, it all works fine for me. That is, the included jsp shows an error
    > when verified but runs OK. However, it would not be my programming
    > style to use that technique. I prefer each jsp to be complete of itself
    > even though I may use the output of more than one jsp to compose a page.
    > This also has the side benefit of verifying cleanly.
    >
    > Mike (just a J2EE user, NOT and expert)


    Mike,

    It all works fine for you in RAD7?? If so I'd be very curious about some of your settings. It will not work for me at all in RAD7 (or a fellow developer here).

    -jeff

  9. Re: RAD 7 and included .jsp files

    > Mike,
    >
    > It all works fine for you in RAD7?? If so I'd be very curious about some
    > of your settings. It will not work for me at all in RAD7 (or a fellow
    > developer here).
    >
    > -jeff


    I am not using base RAD7 but rather another product based on it. FWIW,
    I would not use your technique since it is not verifiable without
    knowledge of where the b.jsp would be used. My solution to accomplish
    what you want would be more like this:

    a.jsp
    =====
    <%@ page language="java" contentType="text/html; charset=UTF-8" %>

    <% s.append("test"); %>

    This is a



    b.jsp
    =====
    <%@ page language="java" contentType="text/html; charset=UTF-8" %>

    <%= s %>


    There are probably more elegant ways of accomplishing this but I am no
    expert, just a tinkerer...

    Mike

  10. Re: RAD 7 and included .jsp files

    M.Hockings wrote:
    >> Mike,
    >>
    >> It all works fine for you in RAD7?? If so I'd be very curious about
    >> some of your settings. It will not work for me at all in RAD7 (or a
    >> fellow developer here).
    >>
    >> -jeff

    >
    > I am not using base RAD7 but rather another product based on it. FWIW,
    > I would not use your technique since it is not verifiable without
    > knowledge of where the b.jsp would be used. My solution to accomplish
    > what you want would be more like this:
    >
    > a.jsp
    > =====
    > <%@ page language="java" contentType="text/html; charset=UTF-8" %>
    >
    > <% s.append("test"); %>
    >
    > This is a
    >
    >
    >
    > b.jsp
    > =====
    > <%@ page language="java" contentType="text/html; charset=UTF-8" %>
    >
    > <%= s %>
    >
    >
    > There are probably more elegant ways of accomplishing this but I am no
    > expert, just a tinkerer...
    >
    > Mike


    Mike,

    I understand. Like I said, this worked in RAD6 just fine. And, I too would probably not code in this fashion. However, there is a significant 3rd party component of my project that is coded this way. It's important that it work. Either way, I fully believe this to be a bug in RAD7.

    -jeff

  11. Re: RAD 7 and included .jsp files

    Jeff Ousley wrote:
    >
    > Mike,
    >
    > I understand. Like I said, this worked in RAD6 just fine. And, I too
    > would probably not code in this fashion. However, there is a significant
    > 3rd party component of my project that is coded this way. It's important
    > that it work. Either way, I fully believe this to be a bug in RAD7.
    >
    > -jeff


    If you are up to date with the RAD update manager and you are an
    entitled customer and you think it is a bug then why not contact RAD
    support ?

    Mike

  12. Re: RAD 7 and included .jsp files

    Jeff Ousley wrote:
    Either way, I fully believe this to be a bug in RAD7.
    >


    If it was working inf RAD 6 and now it doesn't in RAD 7, go to

    http://www-306.ibm.com/software/support/probsub.html

    and open a problem report, this newsgroup is not a formal support channel.

    Juanma Martinez

  13. Re: RAD 7 and included .jsp files

    you can write your code within the jspf file..
    then u can try it..
    I think u will be aware of jspf files..
    if not it will contain the pure java code within
    <%
    java code;
    %>
    then import same
    with
    <%@ include file="/if_package/a.jspf"%>
    I think it will work....

+ Reply to Thread