Variables defined in JSP include files.
hi..
i was wondering how to access the variable defined in a JSP include file from the page where it is included.
If you are thinking of scriptlets, then you would do it in the same manner that you would access variables local to your jsp. A word of caution - jsp pre-compilation may not work.
A neater solution would be store it as an attribute in 'page' scope.
cheers,
ram.
Similar Messages
-
In my experimental photo album page I originally defined the
styles in a
separate .CSS file. However this appeared to be incompatible
with the
requirement to have the session_start (); statement at the
start of the file, so
I then defined the styles locally. Now I have found that a
style which gives
padding to the right of an image no longer works in IE6,
although Dreamweaver
shows the expected result.
I have made two very simple test files to demonstrate this:
http://localhost/Corybas/Cydalba/Test/Test_page_8[1
http://localhost/Corybas/Cydalba/Test/Test_page_8[2
In Test_page_8[1].htm styles are defined by the include file
../Spl2.ccs, which
is included using the following statement in the head:
<link href="../Spl2.css" rel="stylesheet" type="text/css"
/>
The include file reads:
/* Test.css for Cydalba project */
.img_left { float:left; border:none; padding-left:0;
padding-bottom:0;
padding-top:0; padding-right:10px; }
p { font-family: "Times New Roman", Times, serif; color:
#f00000;
margin-bottom: 0.25em; margin-top: 0px; border: 0; }
In Test_page_8[2].htm styles are defined locally, using the
following lines at
the start of file:
<style type="text/css">
/* Test.css for Cydalba project */
.img_left { float:left; border:none; padding-left:0;
padding-bottom:0;
padding-top:0; padding-right:10px; }
p { font-family: "Times New Roman", Times, serif; color:
#f00000;
margin-bottom: 0.25em; margin-top: 0px; border: 0; }
</style>
With IE6 Test_page_8[1] gives the expected padding between
the images and the
adjacent text, but Test_page_8[2] does not. The para
definition appears to work
correctly in both cases.
Can anyone explain this?
ClancyHi Rob,
I am making a wild guess here...the reason could be that the internal tables or variables declared as part of Global data (if any) must be refreshed in your FM code.
Regards,
Sumant. -
Jsp( %@ include file )
suppose
abc.jsp
<% ! x=4 ; %>
xyz.jsp
<%@ include file = "abc.jsp" %>
< % x=4; %>
< % System.out.println ' x' =+x %>
what will happen ?sorry zodak,
i cant close my eyesWell, maybe you could turn off your monitor?
Anyway, do people misspell my name as an insult? because they can't type? I don't understand. It is 5 letters. (I don't know why it intrigues me but they always switch the a and the o) -
Hi;
I'm using Tomcat 3.2.
I am trying to use the path "../common/copyright.html" for an include
path. It isn't working.
For some reason it seems you can't "go backwards" with a file path
with Tomcat 3.2/JSP include file paths.
Is there a way around this or does anyone know anything about it?
( I read the specs, they weren't of much help and I couldn't find
much be searching google.)
Thanks in advance
SteveTry using the full (or absolute) path. If that does not work, then talk to Tomcat developers. If it does, then look at where the JSP pages lies in relation to the path you are trying to use the "../" method on.
Example:
JSP path: www.you.com/jsp/pages/hello.jsp
Include path: ../jsp/pages/open.jsp
This will cause an error becuase the path of the JSP page does not exist within the include path. -
On make: variable not found in include file (it's in including page)
JDeveloper 10.1.2.1.0 build 1913
I'm new to JDeveloper and finally have things set up correctly but when I try to make/run my app (java/beans/jsp) I get the "variable not found" error;
Error(25,16): variable subActionName not found in class includes.vendorSubsidiaries
since the variable is defined in the including page.
I found this thread from 2 years ago:
JSP Static Include in JDeveloper
that was exactly the same....but had no resolution.
Hopefully over the last 2 years someone knows the answer to this dilemna.
thanks.Hi,
I was able to make xerces.jar available in OC4J 9.0.3 but now I got problem with JMS.
I got the following exception:
java.lang.ClassCastException: com.evermind.util.CharString
at com.evermind.server.jms.JMSExpressionParser.processParts(JMSExpressionParser.java:49)
at com.evermind.parser.ExpressionParser.parseParts(ExpressionParser.java:449)
at com.evermind.parser.ExpressionParser.parse(ExpressionParser.java:121)
at com.evermind.server.jms.MessageSelector.<init>(MessageSelector.java:23)
at com.evermind.server.jms.MessageSelector.getSelector(MessageSelector.java:54)
at com.evermind.server.jms.LocalQueueConnection.receive(LocalQueueConnection.java:56)
at com.evermind.server.jms.EvermindQueueSession.receive(EvermindQueueSession.java:241)
at com.evermind.server.jms.EvermindQueueReceiver.receiveNoWait(EvermindQueueReceiver.java:85)
at com.nrx.job.JobManager.receive(JobManager.java:167)
at com.nrx.repository.appServer.SearchServlet.service(SearchServlet.java:120)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Unknown Source)
I don't get this exception if I use Oracle XML parsing classes. They use crimson.jar.
Thanks a lot,
Andrei. -
Lets say I have a container,
<div id="mindmapcontainer">and within this container, I have a jsp include
<%@ include file="mindmap.jsp"%>and within the parent page there is a flash map. I have manipulated the css in such a way that this container (and its include file) will not show unless the user clicks on a country (using visibility hidden/visible). I understand that the external file loads on the server side when the parent page loads,despite it being hidden.
Now the problem is, I'm missing some fancy effects that is shown only when the external jsp first loads. Is there any way I can make it reload onClick?
I'm using ammap and js-mindmap btw.nope using window.location.reload() will reload the entire page.and i dont want that because it will get me back to my flash map screen and not the mindmap screen.thanks for your answer anyway.is there is a way to make it reload a div only or a jsp include?
-
Using variables defined in an include or another program
Hi,
i'm trying to use some declarations in my program which are defined in an include or another program.
1. I need to create a class whose definition is in an include
2. i need to declare a variable like this
v_temp TYPE l_temp , l_temp is a structure defined in an include .
I'm trying to use the declarations in another program or an include in my program. however, i dont want to use 'include' statement
your help would be appreciated.
Thanks,
Kranthi.Hi Kranti,
If u write the declarationin some other include or program n use it in other program, without using INCLUDE.. how would the complier understand where the declaration has come from?? U need to specify to the compiler the path of declaration and hence the include is included..
If u dont intend to use INCLUDE, declare a data element in ABAP dictionary and use it in ur program..
I dont think its possible to do it the way u have suggested..
BTW, why arent u in favour of using the INCLUDE.. is it because it has a lot of declarations..
Regards,
Tanveer.
Please mark helpful answers -
Structure of jsp:include file?
When using the jsp:include action, what should the format of the included file be, ie, what tags, if any, should exist in the file that is to be included? Should it just be the raw source?
Further to this, if I want to encapsulate all code for a common function into a file that I'm going to be using in an include call, what if it uses a javascript file - can I include the reference to that in the file too?I understand the difference between the 2 options, I'm wondering more about the structure of the file that would be 'included' in either case and how I would specify the inclusion of a javascript (.js) file in the file - should there be html, head, body, etc tags in it or is it raw code?
My scenario is that we use 'bubble help' in our web app to display tips to the users, so I want to encapsulate all the code for the bubble help in a single file that I will just include on all the pages that need it, hopefully the reference to the Javascript file would be in there as well -
Jspf (jsp include file) not recognized
It looks like weblogic doesn't recognize the jspf extension as belonging to "fragments
of JSP code that will be incorporated using a static include" as recommended by
the JSP 1.2 spec. That means that such included files are treated as static text,
not compiled.
Does anyone know how to teach wls about this extension?
Ray
Nothing in the JSP Specification indicates that jspf extensions should be used for
static includes, it only address the naming convention. I think it's relevant to
point out that a dynamiclly included jspf-ragment is not a top level page.
In Tomcat 4.x this is achived by adding a servlet mapping from *.jspf to the jspservlet
in the default web.xml file.
Where can I add an extra mapping from *.jspf to whatever *.jsp is mapped to in Weblogic
6.1sp1?
Thanks // Torben
Robert Patrick <[email protected]> wrote:
>..jspf files are pieces of a jsp and are never inteneded to be translated
>
>into a JSP outside the context of another JSP file. Therefore, .jspf
>files should only be included using static includes (like #include in
>C/C++). A dynamic include means that the included page is compiled and
>
>executed as a stand-alone JSP and its output is included in the output
>stream of the including JSP.
>
>Hope this helps,
>Robert
>
>Ray Schnitzler wrote:
>
>> What about dynamic includes? Should I expect them to be treated as jsp?
>>
>> "Alex Worden" <[email protected]> wrote:
>>
>>>If you statically include any file into a top-level .jsp file, its contents
>>>will be treated as JSP. That includes .jspf files. So, this is supported
>>>since WLS5.1 !
>>>
>>>Why are you not seeing this behavior I wonder? Static includes are just
>>>in-lined into the including page and compiled as JSP code....
>>>
>>>Can you send me an example that doesn't work for you?
>>>
>>>Thanks,
>>>
>>>Alex
>>>
>>>
>>><[email protected]> wrote in message news:[email protected]...
>>>
>>>>WLS 6.x supports the JSP 1.1 spec. ( see below). For JSP 1.2 see WLS
>>>>
>>>7.x
>>>see
>>>
>>>>below) . The JSP 1.2 final release is very new and I am sure keeping
>>>>
>>>up
>>>with the
>>>
>>>>constantly evolving space is difficult for any product.
>>>>--------------------
>>>>
>>>>http://e-docs.bea.com/wls/docs61/jsp/intro.html
>>>>http://e-docs.bea.com/wls/docs70/jsp/intro.html#49347
>>>>---------------------------
>>>>"Ray Schnitzler" <[email protected]> wrote:
>>>>
>>>>>It looks like weblogic doesn't recognize the jspf extension as belonging
>>>>>to "fragments
>>>>>of JSP code that will be incorporated using a static include" as
>>>>>
>>>recommended
>>>
>>>>>by
>>>>>the JSP 1.2 spec. That means that such included files are treated
>>>>>
>>>as
>>>
>>>>>static text,
>>>>>not compiled.
>>>>>
>>>>>Does anyone know how to teach wls about this extension?
>>>>>
>>>>>Ray
>>>>>
>>>>>
>>>
>>
>
-
Variable interplay between include files and parent files?
How can I define a variable in a parent file which is then
used in some
logic in an include file? For example, if I have -
<?php
$foo = 1;
?>
<?php require_once('foo.php'); ?>
and in foo.php, I have -
<?php if ($foo == 1) { echo "FOO"; } ?>
it doesn't seem to work. Am I testing improperly, or what?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================Mine, too. But when you don't know what you are doing,
sometimes the 'proof
of concept' tests you design are a bit off-kilter, doncha
know? I can only
guess that i was suffering from that.
I'll verify that I correctly reported this and post back....
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Gary White" <[email protected]> wrote in message
news:[email protected]..
> On Wed, 9 May 2007 20:26:02 -0400, "Murray *ACE*"
> <[email protected]> wrote:
>
>>Yeah - of course, I changed everything about it, too!
>
>
> I'm still bewildered by what caused the problem. If I
have two files,
> first (includevar.php) like this:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "
http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
> <title>Variable in an Include Test</title>
> <meta http-equiv="imagetoolbar" content="no">
> </head>
> <body>
> <p><?php
> $x='This is $x defined in includevar.php';
> include 'foo.php';
>
> print "$y";
> ?></p>
> </body>
> </html>
>
> And foo.php like this:
>
> <?php
> $y='This is $y defined in foo.php';
> print "foo.php says $x<br>\n";
> ?>
>
> The output I get is:
>
> foo.php says This is $x defined in includevar.php
> This is $y defined in foo.php
>
> Clearly, the variable defined in the parent file is
recognized in
> foo.php and the variable defined in foo.php is
recognized in the parent
> file. Hence my bewilderment.
>
> Gary -
Using variables in jsp:include
Hello,
I'm still working wih the JSP 1.2 specs and I want to use a variable in my jsp:include.
For example <jsp:incude page="${vUrl}/>
Where vUrl is defined as
<c:url value="/doesnotmatter" var="vUrl"/>
Something like that ...
I also tried to nest a <c:out> withing my <jsp:include> tag but without success.
Thanks in advance ...u can do it like this:
<jsp:include flush="true" page='<%=path%>' /> -
Jsp taglibs in include files not detected, throws errors, no code insight
I have a jsp which is included in all the other jsp. it looks something like this
taglibs.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
test.jsp
<%@ include file="/jsp/menu/taglibs.jsp"%>
<html>
<head>
<title>Tours</title>
</head>
<body>
<form:form commandName="testCommand">
<form:hidden path="tour.firstname" id="tour.firstname" />
and so on.
I am having 2 problems
1. the jsp editor show errors all over the place saying
element path not expected
element commandName not expected etc.
2. no code insights.
but if i include the taglib def in test.jsp it dosn't show any error and also provides code insights. but seldom do people include all taglibs in all jsps.
is there a way for Jdeveloper to show code insights in jsp pages which includes a jsp or like xml schemas could be added at some place(tools-pref-xml schemas) and when used anywhere, would provide code insights.am not sure, try with this
<jsp:include .../> -
JSP tag spanning @include files
Weblogic 5.1 sp 9
Windows 2000
inc1.inc:
<x:customtag>
inc2.inc:
</x:customtag>
body.jsp:
<%@ include file='inc1.inc' %>
...[body stuff here] ...
<%@ include file='inc2.inc' %>
hitting this page gives:
java.lang.RuntimeException: Could not parse embedded JSP code:
weblogic.utils.ParsingException: Could not complete parsing, unmatched tags:
customtag
at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1079)
at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1057)
at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1050)
Why is this not valid? Other JSP engines allow this. Doesn't the @include
directive just pull in code at .java source generation time?
Thanks,
j
This does look like a bug. I have tried it too with SP6. Contact support with
the same problem. [email protected]
Shiva.
Jason Collins wrote:
> Weblogic 5.1 sp 9
> Windows 2000
>
> inc1.inc:
> <x:customtag>
>
> inc2.inc:
> </x:customtag>
>
> body.jsp:
> <%@ include file='inc1.inc' %>
> ...[body stuff here] ...
> <%@ include file='inc2.inc' %>
>
> hitting this page gives:
>
> java.lang.RuntimeException: Could not parse embedded JSP code:
> weblogic.utils.ParsingException: Could not complete parsing, unmatched tags:
> customtag
> at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1079)
> at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1057)
> at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1050)
> ...
>
> Why is this not valid? Other JSP engines allow this. Doesn't the @include
> directive just pull in code at .java source generation time?
>
> Thanks,
> j
-
%@ include file= ... does not work properly in Portal
I am devloping a portlet based on a jsp that uses some <%@include ..> tags. I have
a problem in that variables declared and used in one jsp is not visible in a jsp
that is included later on. Also, the scope of the page import tag of the main
jsp does not cover the included jsp's.
<%@ page import="javax.servlet.* ......>
<%@ include file="variables.jsp" %> // Classes imported above are not recognised
in this jsp
<%@ include file="code.jsp" %> // Variables declared and used in variables.jsp
are not visible here
The exact same code runs very well in a Tomcat container (as pure jsp, not portlet)
Can anybody help here please?Geir -
I have the same problem. If you do solve it, please post it to this thread.
Thanks
Kunal
"Geir Willumsen" <[email protected]> wrote:
>
I am devloping a portlet based on a jsp that uses some <%@include ..>
tags. I have
a problem in that variables declared and used in one jsp is not visible
in a jsp
that is included later on. Also, the scope of the page import tag of
the main
jsp does not cover the included jsp's.
<%@ page import="javax.servlet.* ......>
<%@ include file="variables.jsp" %> // Classes imported above are not
recognised
in this jsp
<%@ include file="code.jsp" %> // Variables declared and used in variables.jsp
are not visible here
The exact same code runs very well in a Tomcat container (as pure jsp,
not portlet)
Can anybody help here please? -
Calling custom tags in jsp with jsp:include
Hi,
I have a large jsp file , which uses jstl fmt tags for labels.
Since the size of jsp was too big iand i was unable to compile it because of 64 kb class size limit,
I removed the tag lib defination from the jsp file and put it in another jsp file. and used jsp:include to include this file inside the first jsp.
It is compiling successfully but labels r not showing up.
but when i use <%@include to include second jsp in the first one i get the labels properly.
I cannot use <%@include as this starts giving me compilation error related with jsp class file size beyond 64 kb.
Pls suggest why jsp:include is not working.
thanks,
PramodHi Anil,
Ur suggestion was good but could not solve my problem.
I have put a small sample code to illustrate the problem.
labeldemo.jsp:
<%-- <%@ include file="WDCComInitLabelsjunk.jsp" %> --%>
<jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tablebg">
<tr class="headtd">
<td colspan="4"><span class="headtext"><fmt:message key="Cash_Management"/> </td>
</tr>
<tr> hi </tr>
</table>
</fmt:bundle>
WDCComInitLabelsjunk.jsp:
<%@ page language="java" %>
<%@ page contentType="text/html"%>
<%@ page import="com.tcs.wdc.core.*" %>
<%@ page import="com.tcs.wdc.core.login.*" %>
<%@ page import="com.tcs.wdc.core.service.navigation.*" %>
<%-- Include tag library --%>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%-- Get language from IDCUserSession & set it in session --%>
<%
/*SessionManager sm = new SessionManager(session);
IDCUserSession ius = sm.getIDCUserSession();*/
session.setAttribute("language","nl_NL");
%>
<%-- Set the locale for the language obtained --%>
<fmt:setLocale value="${language}" />
<fmt:bundle basename="labels" />
If i uncomment the <%@ include file="WDCComInitLabelsjunk.jsp" %> tag in the code above it is working fine ,
but it is not working with <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
pls suggest.
Thanks,
Pramod
Maybe you are looking for
-
How can I recover ONLY contacts from a backup in iTunes?
I had to change my company email in my iPhone 4 mail box, in this change I also brought the contacts from the new exchange group, which I though would only bring the email contacts. It happens that it substituted my phone contacts and now I don't hav
-
HELP-My 23 inch ACD will no longer turn on.
Have tried unplugging the monitor, turning computer off and on - nothing seems to work. Monitor was occasionally going blank then when I unplugged and plugged back into the transformer it would come back on. It seems to happen when the computer goes
-
After upgrading from SL to Lion server all my websites point to the default welcome page
No matter what I do all of my websites now point to the default "Welcome" site. All my sites are setup with the appropriate directory but this doesn't seem to matter. How do i get Lion Server Web services to actually serve my websites?
-
SMS-Not iMessage- issues in iOS7
When I send a text message, non-iPhone users receive it multiple times. Not an issue for me, but my friends are complaining that they get the same message 6 times. I have an iPhone 5c and it's fully updated (7.0.3). Is anyone else experiencing this i
-
I constantly get the following error message: The backup disk image "/volumes/data/jameskehoe.sparsebundle" is already in use. This Time Machine/Time Capsul worked perfectly before I left on a four month trip. Upon returning to my domicle it will not