Evaluating actions in jsp:import Fragments
Greetings,
I'm using JSP fragments for the first time and encountered some surprises where the fragment did not evaluate as expected. The fragment evaluates fine when it is a block of JSP code, but if I put the same code into a separate JSP file and include it, the block does not get processed in the same way. For example:
<my:tagFoo foo="bar">
<jsp:attribute name="content">
<jsp:include page="MyPage.jsp" flush="false"/>
</jsp:attribute>
</my:tagFoo>
Some strings get substituted as expected, but control statements like <c:forEach ...> remain literal text and are never processed. I've tried the "MyPage.jsp" in a non-fragment context and verified that it works fine. Is there a way to get the tag with the jsp:invoke part to fully process the included page?
If I put the same fragment block into a separate tag (my preferred approach), other errors get thrown at control statements during the jsp:invoke.
Any help appreciated!
-Daniel
Thanks, for the response! I kept reducing the code in the "my:tagFoo" tag that called the invoker until it was minimalistic -having the essential headers and just the jsp:invoke line with an echo of the content generated. I did try changing the "body-content" to the other valid values but it didn't help, perhaps a line is missing?
<%@ tag body-content="empty" %>
<%@ attribute name="content" fragment="true" required="true" %>
<%@ attribute name="foo" required="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="my" %>
<jsp:invoke fragment="content" var="output"/>
<xmp>
${output}
</xmp>
Similar Messages
-
Jsp import package error after upgrading to jdk1.4.2_08 and tomcat 5.0
I am trying to upgrade the jdk and tomcat from 1.3/3.3 to 1.4/5.0.
My jsp imports worked fine prior to the upgrade, but now I get the following:
Jun 6, 2005 10:01:17 AM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Error compiling file: /C:/Tomcat/work/Catalina/localhost/Print//org/apac
he/jsp\BillingPrompt_jsp.java [javac] Compiling 1 source file
C:\Tomcat\work\Catalina\localhost\Print\org\apache\jsp\BillingPrompt_jsp.java:11
: package com.adware.print.database.inquire does not exist
import com.adware.print.database.inquire.*;
^
1 error
A fatal error has occured for user: Unable to compile class for JSP
Generated servlet error:
C:\Tomcat\work\Catalina\localhost\Print\org\apache\jsp\BillingPrompt_jsp.java:11
: package com.adware.print.database.inquire does not exist
import com.adware.print.database.inquire.*;
The package in the import statement "import com.adware.print.database.inquire.*" actually has no classes in it. The classes are contained in "import com.adware.print.database.inquire.controller.*". If I change the import statement everything works. The problem is that I have 100s of jsps. If there is a work-around outside of changing the import statements, that would be best.
Can anyone help? Thanks.do you know what url is being looked up? the message is complaining that the url is starting with the string "an]", which seems pretty bogus.
-
JSP import fails unless Jars are included in the PAR
Hello,
We have a simple EP6 iView for displaying the Universal Worklist entries (UWL) using a JSPDynPage.
We import the UWL library symbols and compile/use them in the Java code without problems (e.g. import com.sap.netweaver.bc.uwl.Item; )
The following entry is made in the portalapp.xml file to make sure the UWL symbols are found at runtime:
<property name="ServicesReference" value="SAPJ2EE::library:tckmcbc.uwl~api"/>
The problem occurs when we try to import the UWL symbols into our JSP with this code:
<%@ page import="com.sap.netweaver.bc.uwl.Item" %>
The UWL symbols are just not found. Here are the exception headers:
#1#com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Resource
Component : pcd:portal_content/MikesFolder/com.lds.mlp.MikesTest1
#1#com.sapportals.portal.prt.servlets_jsp.server.compiler.CompilingException: Error occurs during the rendering of jsp component
Caused by: com.sapportals.portal.prt.servlets_jsp.server.compiler.CompilingException: D:/usr/sap/EP1/JC00/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/web-inf/portal/portalapps/mikestest1/work/pagelet/_sapportalsjsp_helloiviewpage.java:22: package com.sap.netweaver.bc.uwl does not exist
import com.sap.netweaver.bc.uwl.Item;
^
1 error
Now if I add the bc.uwl.service.api_api.jar into PORTAL-INFlib everything is fine. However this seems like such a 'hack'. We really shouldn't be distributing a system file in our PAR.
This person seems to have had the same problem with the system mail jars ( JSP MAIL ERROR ).
Can anyone please shed some light on this problem? Do we really have to distribute the system jars to make this JSP import work properly?
Thanks & Cheers,
Mike Pastor
"always generous with points"Hi,
This is exactly the portalapp.xml of the sap application com.sap.netweaver.bc.uwl.par
check out the difference between this and yours?
Dont miss out on anything important here. I think it should work.
If you are still facing problem only while using in jsp I have a cure.
Write a clean java class in your app which queries the apis in this jar.
Also add sharing reference to this application in your portalapp.xml. Query your class in your jsp rather than the "standard jar"
<?xml version="1.0" encoding="utf-8"?>
<application>
<registry>
<entry path="/runtime/hooks/deployment/UniversalWorklistDeploymentHook" name="UniversalWorklistDeploymentHook" type="service"/>
</registry>
<application-config>
<property name="startup" value="true"/>
<property name="releasable" value="true"/>
<property name="ServicesReference" value="SAPJ2EE::library:tckmcbc.uwl~api,SAPJ2EE::service:webdynpro,com.sap.portal.runtime.system.inqmy, com.sap.portal.ivs.connectorservice,com.sap.portal.ivs.systemlandscapeservice, urlgenerator, com.sap.portal.usermapping, usermanagement, com.sap.portal.runtime.application.rfcengine,com.sap.portal.runtime.config,knowledgemanagement"/>
<property name="PreservedConfigPaths" value=""/>
<property name="Vendor" value="sap.com"/>
<property name="SecurityArea" value="NetWeaver.KMC"/>
</application-config>
<components/>
<services>
<service name="com.sap.netweaver.bc.uwl" alias="UniversalWorklistService">
<service-config>
<property name="className" value="com.sap.netweaver.bc.uwl.core.portal.UWLPortalService"/>
<property name="classNameFactory" value=""/>
<property name="classNameManager" value=""/>
<property name="poolFactory" value="0"/>
<property name="startup" value="true"/>
<property name="SafetyLevel" value="low_safety"/>
</service-config>
</service>
<service name="UniversalWorklistDeploymentHook">
<service-config>
<property name="className" value="com.sap.netweaver.bc.uwl.core.portal.UWLDeploymentHook"/>
<property name="classNameFactory" value=""/>
<property name="classNameManager" value=""/>
<property name="poolFactory" value="0"/>
<property name="startup" value="true"/>
<property name="SafetyLevel" value="low_safety"/>
</service-config>
</service>
</services>
</application> -
Workshop 8.1: Page Flow Action and jsp:include
Hi everybody.
Can i use jsp:include to "include" a page flow action ?
I've tried it, but odd things are happening: The resource got included, but fragments of html source "around" it are been lost.
Any ideas ?
Thanks in advance.Hi Daniel
There are 2 ways you can acheive this.
1) Using something called Pageflowscoped form for this. This will let you use arrays for checkbox group.
The main part will be that you need to define a member varaible of the form at the pageflow level there by the data will not be lost
2) Using Request scoped form like you have now but need to modify the getter method to populate the "searchResult" object.
public List getSearchResult() {
if( null == searchResult){
System.out.println(" Pouplate the searchResult here. ");
searchResult= new ArrayList();
//populate the default values.
return this.searchResult;
More info at:
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conReqScopedVsPageScopedBean.html
I have a sample with pageflowscoped bean and requestscoped bean that I can send you if you provide your email address.
Unfortunately we cannot attach files in the newsgroup.
Thanks
Vimala -
"Failed to perform requested action" error while importing table in P.Layer
HI
I have encountered an error while importing the table into physical layer of the repository. When I select the table and click the 'move the selected' button it is throwing this error "Failed to perform requested action". I didn't understand what does it mean, even it is not giving any error code but when I try to import other tables it is working fine. Please help me to solve this if someone has any idea. Thanks.Hi Srinivas,
I think you want to do JDBC lookup.. you must have created the JDBC receiver communication channel. As your communication channel is correct and still you are getting Table not found error.. Check following steps.
- Check that your Communication channel is activated and working fine.
- Check that the ID which you are using in JDBC receiver is having proper authorization to import the table definition.
Just check with all authorization.
I think the problem is with insufficient authorization to User ID used on JDBC communication channel.
Thanks,
Bhupesh. -
Jsp :: Importing Classes
I have followed a jsp tutorial with regards to a simple set of scripts.
I have stored a class in the /cyb/WEB-INF/NameHandler folder that is called NameHandler.class
When I call the import statement in the index.jsp file:
<%@page import="hello.NameHandler"%>
I get the following error:
"Only a type can be imported. hello.NameHandler resolves to a package"
After some research, I have ensured that the NameHandler is compiled, and stored in the apprpriate WEB-INF/Classes/NameHandler directory within the tomcat system.
Does this have anything to do with the tomcat's classpath directive?
I am using a windows xp platform.
Edited by: Cyberconian on Feb 11, 2009 4:49 AMHi,
Your class name is NameHandler and you are trying to import the class in your JSP page as hello.NameHandler.
Syntax of page directive to import the class in JSP looks fine (still use spaces, like <%@ page import="java.util.*" %>). Please make sure hello.NameHandler (hello is the package) class is available in WEB-INF/classes directory of your context root.
Thanks,
Mrityunjoy -
Hey, I got confused with all import statement with jsp.
Here is my problem.
Folder structure:
C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\webapps\ROOT\WEB\S\A
This folder contains a.jsp.
JSP code:
<%@ page
language="java"
import="java.sql.*, MyPackage.DataBase"
errorPage=". . ."
contentType="text/html; charset=windows-1251"
%>
<%
Connection connection = null;
Statement statement = null;
DataBase dataBase = new DataBase( connection, statement );
%>
...Error message that I get:
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\work\Catalina\localhost\_\org\apache\jsp\WEB\S\A\a_jsp.java:7: package MyPackage does not exist
import MyPackage.DataBase;
^
An error occurred at line: 104 in the jsp file: /WEB/S/A/a.jsp
Generated servlet error:
C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\work\Catalina\localhost\_\org\apache\jsp\WEB\S\A\a100_jsp.java:147: cannot resolve symbol
symbol : class DataBase
location: class org.apache.jsp.WEB.S.A.a_jsp
DataBase dataBase = new DataBase( connection, statement );
^
...How do I import that class so I can use it?
Do I need to use useBean?
What do I need to do?
ThanksDataBase class does not extend java.sql.
I put this into my jsp page
import="java.sql.*;"
import="MyPackage.DataBase;" Here is the error message
Generated servlet error:
C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\work\Catalina\localhost\_\org\apache\jsp\WEB\S\A\a_jsp.java:7: 'class' or 'interface' expected
import MyPackage.DataBase;;
^
1 error
... -
JSP import Statement importing a Class File giving ERROR
Hey guys,
There is a problem to which I dont know the reason,
Consider the code below:
<%@ import Converter, ConverterHome %>
It gives me a Compile Time error of this type:
'.' Required in import Converter ;
but when i put these classes in a package suppose "converter"
and the above import statement like this :
<%@ import converter.Converter,converter.ConverterHome%>
It gives me no error
So whats the reason behind this? Cant I compile a JSP program by refrencing classes without in any package?
please Reply
Thanks in advance..So whats the reason behind this?
Cant I compile a JSP program by refrencing classes without in any package?No, I do not beleive you can, is you are using Java 1.4. In 1.4, you can only reference classes in the Default Package (none) from other classes in the default package. If you are in a package, then you can not import from the default package. And this is for ALL java classes, not just JSP and Serlets. Since the JSP servlet would be part of a package (which depends on the server you are using) you will need to put your classes into packages to import them... -
I'm very new to Netweaver, java and JSP, so please forgive me for what is hopefully a very simple question.
I've created a simple JSP page that needs 2 external JAR files to run.
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="org.apache.commons.ssl.PKCS8Key" %>
I've included these 2 JARS in my class path of my Web Project:
commons-codec-1.3.jar
not-yet-commons-ssl-0.3.10.jar
They get included in the WAR file under web-inf-->classes and the EAR file has the WAR in it when I deploy it. However, I'm getting a syntax error when I run the JSP:
package org.apache.commons.codec.binary does not exist
import org.apache.commons.codec.binary.Base64;
package org.apache.commons.ssl does not exist
import org.apache.commons.ssl.PKCS8Key;
Can someone please explain to me how I'm supposed to include these JAR files correctly?
Thanks,
JeffHi,
the JAR-Files should be located under WEB-INF/lib.
If the lib directory does not exist create it manually using the resource perspective of NWDS. Then copy or better move the JAR Files to the location WEB-INF/lib. After that correct the JAVA Build Path so that the JARs are found in the new location.
If your imports work in NWDS you should be able to build WAR and EAR. Redeploy the EAR and your JSPs should work without errors
Cheers -
JSP import self made Package that imports another self made package!
I also posted under JSP section.
I really need an answer please.
Quite new to JSP & java. Not sure about how to use import properly for my problem below:
Using Tomcat4.12 & jdsdk1.4 on WinXP
So I create a package - lets call it p1.
For all java files that belong to this packge I put on the top line of code:
package p1;
All files of package p1 are put in Tomcatdir\webapps\myapp\WEB-INF\classes\p1
everything complies & the packge runs fine - theres a servlet in it & I'm happy.
Now I create a new package to go with my webapp. Lets call this p2.
However there is a java file in p2 that uses a class from p1 package.
So in that file I put:
import p1.theclassname;
However this will not work because this line refers to:
Tomcatdir\webapps\myapp\WEB-INF\classes\p2\p1
so it will not find the class. Because its in:
Tomcatdir\webapps\myapp\WEB-INF\classes\p1
Anyway I can make it comple by moving files about & making a more complex dir structure & more complex package names - but this cant b the propler way to do it?????
Anyway with my quick fix to this problem I cause a new porblem - in my jsp files that use both packages I cant import the classes I needas the are all complied in packages that are now in the worng place on the hard drive!
I also tried doing this by just having p1 where it was to start with & then instead of making p2 - I'd just complie it in the classes folder & have it import p1. This works fine until I try to import the classes in JSP - I tried things like:
<%@ page import=".*" %>
but it doesnt work unless its in a packge like
<%@ page import="p2.*" %>
but if its in a package then the sturcture to the other packge is all wrong again!!!!!!!!
I hope someone knows what I'm going on about.
Please help me.you are answer izzaman's problemYes
he has solve already,
right?Well, I wasn't sure if he really solved it, or just found an ugly workaround, so I wanted to make sure it wasn't the latter.
can you help me to clear me doubt also. I'm new
to Java. my problem has been posted earlier....I don't know specifically how to fix your problem. It's probably a classpath issue, though it may also be some simple oversight like a misspelling or something. It's hard to say without more details. If it is a classpath issue, then whatever izzaman did may also work for you. I haven't done much with servlets and JSP lately, and when I have, I've never had classpath problems, so I don't know what kinds of issues are common there.
I would suggest starting a new thread for your problem. That's generally what you should do anyway, and it will get more notice if it's in its own thread. Don't put it in Adanced Language Topics though. Put it in the JSP forum or Java Programming.
Good Luck! -
Pls help! How to put JSP import statement...
Hi, I just created a simple iView JSP that imports htmlb classes and now I'd like to import my own java classes onto it. For example, in my other projects, my JSP's have <%@ page import="project28.practice.contextClass" %> on top of the page. I currently have a file called practice.jar
If I want to put this import statement into my simple iView JSP and use it, what would I have to do/configure?, do I have to transform it into a .par file? Or can I transport the jar file to the portal? Any changes on NetWeaver?
I am new to this so any detailed help or suggestions are greatly appreciated!
Thanks again,
BaggettHi Detlev, thank you for your response! I'd like to include more details of my situation right now: I have 2 projects on NetWeaver:
Project#1: Java Web application Project. (jar files, WEB-INF, WEB-INF/web.xml, JSP's...)
Project#2: Portal Application Project. (JSPDynPage, sap plugins, PORTAL-INF/portalapp.xml, JSP)
I'd want my JSP file in Project#2 to call some classes from the jar files of Project#1.
From my understanding, to do this I need to make a .par file out of Project #1 and then upload the par file to my SAP EP6.0 so that my future JSP's can import classes from it. Am I correct?
I am confused right now as to how to really do this. On Netweaver, I am getting a Error when I try to do: File --> New --> Project --> Portal Application --> Create a Portal Application Project > I then enterProject Name: TestProject28, Project root folder: c:\TestProject\webapps\project1
--> "ERROR: Invalid project description, Reason:An error has occured while trying to create the project structure"
If possible can you please provide detailed instructions on how to configure or build a par file out of my java web application stated above?
Thank you so much for your time and help!
Baggett -
i just installed tomcat 4.1.18 and pretty much copied over all my applications and did the configurations in the server and web files...the only problem i noticed was that importing classes not part of the java libraries throws a jsp init() exception.
is the syntax still the same:
<@page import ="java.util.*,MyJavaBean" %>
in this case it complained about the MyJavaBean as an unrecognizable object, however it is in the WEB-INF/classes folder for this app. This syntax works for tomcat 4.0.1Hi,
As I know in Tomcat 4.1.x you have put your classes into packages. Putting the classes into WEB-INF/classes directory is not enough. You should try the following:
1. create a directory test under WEB-INF/classes directory and put your MyJavaBean class into this directory.
2. add the following line to the top of your MyJavaBean.java
package test;
3. Compile as : javac test/MyJavaBean.java
Try this...
nurettin -
JSP import directive does not work
We are using WebLogic 5.1. We have a problem with our
JSPs. The jsp compiler could not find the Connection class
until we said java.sql.Connection.
We had a valid import statement! We had
<%@ page import="java.sql.*" %> and this page worked
perfectly under Resin.
Does Weblogic not implement the JSP spec correctly?
Please help-- urgent!
Thanks,
Brian Williams
Try to put flush="true" behind the page attribute, maybe it'll work now.
for example: <jsp:include page="<%= inludeName%>" flush="true">
Greetz
Tom
"rl" <[email protected]> schreef in bericht
news:[email protected]..
> Hello,
> I'm new to weblogic.
>
> I got an jsp page wich shuold open another .
>
> I use the following command:
>
> <jsp:include page="<%= inludeName %>"/>
>
> This don't work.
>
> What can I do , that this will work?
>
> MfG,R.Lenz
>
>
-
Using FDM Import Action script to import data from ERPI table "tdataseg_t"
Hi Experts
I have extracted data from EBS using ERPI and loaded into the intermediate table "tdataseg_t"
I am trying to use Import Action script within FDM to extract data from "tdataseg_t" table (where ERPI extract data is stored) as i could not use the normal import script.
Requirement : I have to restrict the custom 2 dimension based on Account dimension.
Dim Account
Account = ???? ( i am struck here)
If Account = 1000 to 5000 Then
Custom2 = Right( product , 5)
End If
but , I could not find the exact syntax to call the Account dimension from the "tdataseg_t" table.
Please Advise
Thanks
Sak
Edited by: user12292415 on Feb 26, 2012 1:19 AMHello,
Importing data via a manual script defeats the purpose of ERPi. As it will not provide you an audit trail, drill-through/drill-back, etc.
Your best bet is to use the default settings by the software. Just because it returns more records than you want is not a bad thing. You can conditionally change/alter the information either in an EventScript inside of FDM or by mapping the un-needed information to IGNORE.
Thank you, -
Unable to compile class for JSP: import ...
Hi everybody!
I've tried to change from Servlet to JSP. The Servlet used a package und compiled fine under NB 4.1.
When the JSP is compiled on the Server (Sun Java System Application Server Platform Edition 8 2004Q4 Beta) the following error occurs:
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] D:\Programme\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\NR_Java4Web1\org\apache\jsp\DisplayingDatabaseRecords_jsp.java:44: illegal start of expression
[javac] import de.conus.util.DBUtil.*
[javac] ^
Do I have to place the classfile manually on the server?
Thanks for your help,
MichaelAll import-statements where of the same kind. I had to place trhe classfiles
at the application server under lib\classes. Now it works
Thanks
Maybe you are looking for
-
My iPod touch is downloading and updating apps very slow more than an hour.
My iPod touch 4th gen 32gb verson 4.3.1 is downloading and updating apps very slow more than an hour. I just got it a day ago and I backed up all my apps music and pictures and videos from iTunes. Few months ago I had an iPod touch but I lost it and
-
How does it work if I purchase music on iPhones? Will the songs be transfered from iPhone to my computer when I sync? Or will the music download from iTunes to my computer when I open iTunes on the computer? Is the song quality the same regardless if
-
% of Total, no hierarchy
I'm trying to create a calculated measure showing % of Total Net Sales, something like Rank or TopCount but showing % Value. I tried "parent" but since I do not have hierarchy in the dimension , it gave 100% for every dim value. a - how to do it for
-
"No new virtual tiles can be allocated" on Windows 7
I get a error when opening the filter gallery: in dutch: "U kunt niet meer virtuele tegels toewijzen." this is the same as the english "No new virtual tiles can be allocated" as administrator everything works fine, but then I cannot to my network dri
-
Error on FMFMOAFNP1000001 table during Client Copy
Dears, we are trying to run a Remote Parallel CLient copy from FNP-100 to FNQ-200. The copy fails reporting this error : "FMFMOAFNP1000001 CA-GTF DDIC Error (See SE14)" We check both in source and target system and this table does not exist.Is not vi