Jspdynpages
hi
i have created a testjspdynpages and this is my first
application , so while deploying the application it is
asking for server configuration
alias
host
port
login
description
i have given some ABC for alias and host as message
server host and port as 5xxxxxx , login as portal user
description as ABC and password as portal pwd
above i have mentioned and also in the
windows->preferences Enterprise portal the same details but iam facing a problem as cannot be deployed
check the server connection ,
can any help me out plz? its a urgent issue ?
hi
server is up , and about the
paramaters that i have given are correct and
its given an exception as
uanble to connect to the server or check the
sap-log file , and there is nothing in the
log file
i have not selected default column in the
windows-prefences , i have given my own data
still its showing up the exception
any work around ?
Similar Messages
-
Hiding table columns in a table view in JspDynpage
hi,
i have a situation where i need to hide a particular column in a tableview.
thanksHi,
What senthil has given is for dynpage not for jspdynpage
If u r using jspdynpage
<hbj:tableView
id="myTableView1" >
<%myTableView1.setColumnName("columnName",2);%> /2-->col.no/
<%myTableView1.setColumnInvisible("columnName");%>
</hbj:tableView >
u should set column name first using setColumnName
Regards,
Tamil K -
Fetching data in R/3 via portal application(JSPDYNPage)
Hello Everyone,
I want to fetch data in R/3 server via portal application(JSPDYNPAGE) & display that data as an output of the portal application in TABLEVIEW format. Can anyone guide me on this (I:e-How to connect to R/3 server via portal component & fetch data & display the same). any similar application developed for a reference will be of great help.
Thanks,
ChetanHi Chetan,
I hope you know how to create a JSP Dyn Page, anyway I will explain it briefly.
Open NWDS->File->New->Create a portal application project->Specify the project name
right click on the project->New->Create a new portal application object->Portal component->Select JSP dyn page-(By default it creates class and all)->this is available under description on the right column-
Now goto the Java page->see the functions->attach zip and jar files(HTMLB plugin)
->Right click on the project->goto properties->Java build path->Add external jars->Select com.sap.portal.htmlbbridge.zip and htmlb.jar
This is how JSP page is created.
Now we want to do establish connection with R/3. That I will discuss in the next session.
Award points if this was helpful......
All the best for you
Regards,
Arun Jacob. -
Export to Excel & Download in JSPDynpage
Hi All,
I have developed one JSpDynpage application in which I am displaying the custom portal activity report on portal page. I . I have used normal HTML code in JSP file. Now I have to export this data in Excel sheet & Download it.
For this I have gone through these steps.
1) As per the few suggestions on SDN , I have created seperate AbstractPortalComponent for this functionality.
2) I have followed prakash's blog i.e. Create an excel file from JAVA using HSSF api
3) Included all needful POI jar files mentioned in the blog.
But still i am getting error - java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
This class exists in JAR file when i checked. Error is looking simple, but not getting resolved.
Also please suggest me -
1) How to call this AbstractComp. from JSP file , when user click on a link on portal page.
2) what shoud be the additional code for download functionality?
Any sample code will be more helpful
Regards,
VishalHi Vishal,
I am facing one problem with customization of portal activity report.
We made some changes to the existing report par file and deployed from NWDS to dev system. When we previewed the existing iview in Dev portal system the changes reflected and once we exported the PAR file to QA system and previewed the iview from portal, there is no data coming to portal.
Can you please let us know what could be the reason for this?
Thanks
Manas -
Error while using jsp scriptlet or expression with JSPDynpage default jsp
Hi everyone,
I am getting the following error while trying to use any kind of jsp scriptlet or expression within the default jsp page that is created with JSPDynpage application:
Portal Runtime Error
An exception occurred while processing a request for :
iView : Navroz_JSPDynPage_JCo_BAPI_FLCUST.FlightCustJSP
Component Name : Navroz_JSPDynPage_JCo_BAPI_FLCUST.FlightCustJSP
Error occurs during the rendering of jsp component.
Exception id: 08:50_05/10/06_0032_17543050
See the details for the exception ID in the log file
For example if I try to use even simple syntax like:
<% if(true) { %>
display htmlb tableviewcomponent
<% } %>
or
<hbj:tableView
id="myTableView"
model="flightCustomer.model"
design="ALTERNATING"
headerVisible="true"
footerVisible="true"
fillUpEmptyRows="true"
navigationMode="BYLINE"
selectionMode="SINGLESELECT"
headerText="Flight Customer List"
onNavigate="Navigate"
visibleFirstRow="<%=flightCustomer.getVisibleFirstRow()%>"
visibleRowCount="5"
rowCount="16"
width="500 px"
/>
here also the <%=flightCustomer.getVisibleFirstRow()%> line gives the above mentioned error. If I remove such scriptlets or expression then it works fine.
What could be the problem. Are jsp scriptlets or expressions incompatible with portal applications?hi Navroz,
check this
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90e8e837-cc15-2a10-8db1-a87e2d29e9c9
Re: Defining HTMLB tags in jsp file of JspDynPage component
Re: JSPDynPage does not work in EP6.0
bit more
JspDynPage with Client Side Eventing and Database
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b3c1af90-0201-0010-c0ac-c8d802d264f0
let me know u need any further info
bvr -
Getting error in consuming google webservices from JspDynPage
Hi All,
Getting following error while consuming google webservices from JspDynPage
An exception occurred while processing a request for :
iView : GoogleSer.google
Component Name : GoogleSer.google
Could not find portal application com.company.global.enterprise.portal.wsdl.webservices.service.
Code :
MyGoogle googleService =
(MyGoogle) PortalRuntime.getRuntimeResources().getService("com.company.global.enterprise.portal.wsdl.webservices.service.MyGoogle");
GoogleSearchResult result = googleService.doGoogleSearch("google", "SAP", 0, 10, false, "", false, "", "", "");
ResultElement[] results = result.getResultElements();
if(results != null) {
response.write("<br> Search Result Size " +results.length );
for (int i = 0; i < results.length; i++) {
response.write((i + 1) + ": " + results);
Thanks
RudraHi,
I am still having the same problem, however the scenario in which I am getting varies.
I am getting this exception:
"com.sap.engine.services.webservices.jaxm.soap.accessor.NestedSOAPException: IOError while working with the message."
Some users when trying to login into the portal are getting blank screen and for some the portal launcher page is loading fine and could go to the Home Page.
When I view the logs I am seeing the Nested Soap Exception.
Any Ideas??? Starting the J2EE engine also did'nt help.
Thanks in advance.
Madhavi -
Accessing the bean in JSPDynPage of PAI event
Hi friends,
In the PAI event of JSPDynpage component iam accessing the bean thru the following stmt.
dynpagebean myNameContainer=(dynpagebean)myProfile.getValue("MyNameBean");
What string have to pass in the getValue() method?
Iam giving the input in the first page.and storing this value in bean.accessing the value stored in bean to display it in the second page.but its giving error while requesting the second page.can anybody please help me?
with regards
sireesha.Hi
dynpagebean myNameContainer=(dynpagebean)myProfile.getValue("MyNameBean");
Here the string to be passed in getValue method shoild be the id of the bean that you see in jsp:useBean tag.
you can set the attributes of the bean using its setter methods:
e.g.I have a setter method which sets the attribute Name in my bean with type as string.
myNameContainer.setName("ABC");
now I put the bean in profile as follows:
myProfile.putValue("myBean",myNameContainer);
Now you can access the bean in both the JSPs by using jsp:useBean tag.
Here you will have to remove
<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="pagelet/<jspname>.jsp"/>
properties in component config in order to be able to access both the JSPs.
You can also use IPortalComponentContext instead of IPortalComponentProfile since the getValue and putValue methods of IPortalComponentProfile are depricated.
Regards,
Ajay -
Where is the jspdynpage in .par file for masthead
I have a project in NWDS with .par file for masthead.
In the dist folder I found the jsp files but where will I get the jspdynpages in this project.
I want to add the code to connect to R/3 in this dynpage for lightheaderiview.jsp
Please help.Hi Anzar,
If you describe the scenario then probably you might get more helpful answers. You can write a custom module JSP which will use JCO adapters to fetch the data you need from the backend systems.
Thanks,
GLM -
Best practice for connecting to SAP backend from JSPDynPage
Hi,
Can anyone help clear up some confusion I have over connecting to SAP from Java?
We have a number of JSPDynPage portal applications on EP7 Ehp1 that connect to SAP ECC6.
We currently use 2 methods to call remote functions on the ECC system.
1) Enterprise connector and JCo Client Service
This method has the advantage of automatically generated proxy classes and typed access to function module parameters. It is also more closely aligned to Web Dynpro from a design time point of view
However it also has a number of disadvantages in that it does not support table APPEND structures and requires regeneration for every change to the ABAP structures involved even if the field that has changed is not being referred to. In addition the use of the JCo client service means that the connection pooling must be handled ourselves explicitly
2) Connector Framework - SAP System Connector
This method has the advantage that connection management is handled by the framework. It also has the advantage that fields are referred to by name so if an ABAP structure changes then the remote call will not fall over as long as the named fields are still available.
However this method is more cumbersome because no proxy classes are generated and function module parameters are referred to generically so errors are not picked up by the complier.
Given the limitations of the above 2 methods, what is the recommended approach?
In the book u2018Inside Web Dynpro for Javau2019 Chris Whealy says the following about the Adaptive RFC Layer:
u2018Any Java program running in the AS Java u2013 not just Web Dynpro u2013 can make use of the Adaptive RFC layeru2019
Has anyone been able to use the Adaptive RFC layer from a NON-WebDynpro java application?
Any thoughts on the above would be most welcome.
Thanks,
Denis.Hello,
The recommended way is with JCA Connector.
Adaptive RFC is included from NW7.1,
See "Creating an Adaptive RFC2 Sample Application without using Web Dynpro"
in the SAP HELP of NWCE7.1 or NWCE7.2.
Seems to be based in JCo 3.0 and Java5 so it will not work in NW70.
For older Versions like EP 5 there is also a JCo ClientService available.
Regards
Johannes -
Event handling in Portal IView of JspDynpage
Hi All,
I have created the portal iview with jspdynpage.Can any body tell whether event handling can be performed from the portal iview which is created from the jspdynpage?
Regards,
V Karthihi
check this threads
Event handling in portal through sap netweaver.
From creation of JSP page to iView at Portal
Thanks -
hi
all,
i am trying connect sql server in my jspdynpage application
i got error like this
Portal Runtime Error
An exception occurred while processing a request for :
iView : jdbc.jdbcjspdyn
Component Name : jdbc.jdbcjspdyn
The exception was logged. Inform your system administrator..
Exception id: 12:13_15/05/07_0001_11442750
See the details for the exception ID in the log file
here i past my code
package com.sap;
import java.sql.Connection;
import java.sql.*;
import com.sapportals.htmlb.page.*;
import com.sapportals.portal.htmlb.page.*;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
public class jdbcjspdyn extends PageProcessorComponent {
public DynPage getPage() {
return new jdbcjspdynDynPage();
public static class jdbcjspdynDynPage extends JSPDynPage {
public void doInitialization() throws PageException {
IPortalComponentRequest request1 =
(IPortalComponentRequest) this.getRequest();
HttpServletRequest req = (HttpServletRequest) this.getRequest();
try {
Class.forName(
"com.sap.portals.jdbc.sqlserver.SQLServerDriver");
String url =
"jdbc:sap:sqlserver://10.2.2.74;DatabaseName=TRAINING";
Connection con = null;
con =
DriverManager.getConnection(
url,
"SPADURI",
"netweaver");
Statement st = con.createStatement();
String sql =
"SELECT * FROM registration where fname='Pankaj'";
ResultSet rs = st.executeQuery(sql);
while (rs.next()) {
jdbcbean j = new jdbcbean();
j.setFname(rs.getString(1));
req.setAttribute("jdbcbean", j);
} catch (Exception e) {
System.out.println("Error" + e);
} finally {
public void doProcessAfterInput() throws PageException {
public void doProcessBeforeOutput() throws PageException {
this.setJspName("jdbcjsp.jsp");
my bean
package com.sap;
import java.sql.ResultSet;
import java.util.*;
import java.io.Serializable;
import com.sapportals.htmlb.table.DefaultTableViewModel;
//import com.sapportals.htmlb.table.TableView;
import com.sapportals.htmlb.table.TableViewModel;
public class jdbcbean implements Serializable
{ private String fname = "";
private String lname = "";
private String phoneNumber = "";
private String message = "";
public String getFname() {
return fname;
public String getLname() {
return lname;
public String getPhone() {
return phoneNumber;
public void setFname(String string) {
fname = string;
public void setLname(String string) {
lname = string;
public void setPhone(String string) {
phoneNumber = string;
my jsp
<%@ taglib uri= "tagLib" prefix="hbj" %>
<%@ page import="java.text.SimpleDateFormat" %>
<jsp:useBean id="jdbcbean" scope="session" class= "com.sap.jdbcbean" />
<hbj:content id="myContext" >
<hbj:page>
<hbj:form id="employeeInfoForm" >
<%jdbcbean=(com.sap.jdbcbean)request.getAttribute("jdbcbean");%>
<%jdbcbean.getLname();%>
<%jdbcbean.getFname();%>
<%jdbcbean.getPhone();%>
</hbj:form>
</hbj:page>
</hbj:content>hi
lakshmikanth
i created jdbc system -
>
in that i specify the system alias -
>\
through the system alias connecting the database
here i past my code see it
public class CJdbcDAO extends CDAO {
private IConnection conn = null;
public static String JDBC_SERVICE_ALIAS = "TJDBC";
public CJdbcDAO(IPortalComponentRequest request) throws Exception {
super(JDBC_SERVICE_ALIAS, request);
storeConnection();
public IConnection getConnection() throws Exception {
if (conn == null) {
storeConnection();
return conn;
public void releaseConnection() {
if (conn != null) {
try {
conn.close();
} catch (ResourceException e) {
e.printStackTrace();
private void storeConnection() throws Exception {
try {
IConnectorGatewayService service =
(IConnectorGatewayService) PortalRuntime
.getRuntimeResources()
.getService(
IConnectorService.KEY);
if (service == null) {
throw new ConnectorException("Service not available in PortalRuntime");
ConnectionProperties props =
new ConnectionProperties(
request.getLocale(),
request.getUser());
conn = service.getConnection(serviceAlias, props);
} catch (Exception e) {
throw new Exception(e); -
hi everybody, I am trying to display some data from RFC on a JspDyn Page, I have prepared the project but the data from RFc is not displaying.... the code is
MyJspPage.java:-
package com.ust.jca;
import javax.resource.cci.MappedRecord;
import javax.resource.cci.RecordFactory;
import com.sapportals.connector.connection.IConnection;
import com.sapportals.connector.execution.functions.IInteraction;
import com.sapportals.connector.execution.functions.IInteractionSpec;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.JSPDynPage;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.ivs.cg.ConnectionProperties;
import com.sapportals.portal.ivs.cg.IConnectorGatewayService;
import com.sapportals.portal.ivs.cg.IConnectorService;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.connector.execution.objects.language.IFunction;
import com.sapportals.connector.execution.structures.IRecordSet;
import com.sapportals.connector.execution.structures.IRecordMetaData;
import com.sapportals.connector.execution.structures.IStructureFactory;
import com.sapportals.connector.metadata.functions.IFunctionsMetaData;
import java.util.Vector;
public class MyJspPage extends PageProcessorComponent {
public DynPage getPage() {
return new MyJspPageDynPage();
public static class MyJspPageDynPage extends JSPDynPage {
private RfcBean myBean;
public void doInitialization() {
public void doProcessAfterInput() throws PageException {
public void doProcessBeforeOutput() throws PageException {
myBean = new RfcBean();
((IPortalComponentRequest) getRequest())
.getServletRequest().setAttribute("myBean",myBean);
IPortalComponentRequest request =
(IPortalComponentRequest) this.getRequest();
// fill your bean with data here...
try {
//Alias is the name of the alias you defined in portal for SAP system
getSAPdata(getConnection(request, "P35"));
} catch (Exception e) {
e.printStackTrace();
this.setJspName("MyJspPage.jsp");
private IConnection getConnection (IPortalComponentRequest request,String alias)
throws Exception
IConnectorGatewayService cgService = (IConnectorGatewayService) PortalRuntime
.getRuntimeResources().getService(IConnectorService.KEY);
ConnectionProperties cp = new ConnectionProperties(
request.getLocale(),request.getUser());
return cgService.getConnection(alias, cp);
private void getSAPdata(IConnection client) throws Exception {
try
/* Start Interaction * */
IInteraction interaction = client.createInteractionEx();
// call the BAPI_MDDATASET_CREATE_OBJECT
IInteractionSpec interactionSpec = interaction.getInteractionSpec();
interactionSpec.setPropertyValue("Name", "ZHRESS_FIRSTDAY_SERVICE");
RecordFactory recordFactory = interaction.getRecordFactory();
MappedRecord input = recordFactory.createMappedRecord("input");
com.sapportals.connector.metadata.functions.IFunction function = client.getFunctionsMetaData().getFunction("T_ZHRESS_FIRSTDAY");
IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();
//input.put("P35", request.getUser().getUniqueName());
input.put("SERVICEID","7");
input.put("YYUSER" , "EMP");
input.put("YYMOD","DIS");
MappedRecord importParams = recordFactory.createMappedRecord("input");
IStructureFactory structureFactory = interaction.retrieveStructureFactory();
IRecordSet table = (IRecordSet) structureFactory.getStructure(
function.getParameter("T_ZHRESS_FIRSTDAY").getStructure());
MappedRecord exportParams = (MappedRecord) interaction.execute(interactionSpec, input);
//myBean.setCW1((String) exportParams.get("CW1"));
//myBean.setCW1(((Integer) exportParams.get("T_ZHRESS_FIRSTDAY")).toString());
//myBean.setCW1((String) exportParams.get("T_ZHRESS_FIRSTDAY"));
IRecordSet exportTable = (IRecordSet) exportParams.get("T_ZHRESS_FIRSTDAY");
exportTable.beforeFirst(); // Moves the cursor before the first row.
while (exportTable.next()) {
String column_1 = exportTable.getString("PERNR");
String column_2 = exportTable.getString("ZDOJ");
myBean.setCW1((String)exportParams.get(column_1));
myBean.setCW2((String)exportParams.get(column_2));
//System.out.println(" COMPANYCODE_LIST-COMP_CODE = " + column_1);
//System.out.println(" COMPANYCODE_LIST-COMP_NAME = " + column_2);
myBean.createData(exportTable);
client.close();
catch(Exception e){}
@param ex
@param string
private void printException(Exception ex, String string) {
// TODO Auto-generated method stub
@param string
private void logMsg(String string) {
// TODO Auto-generated method stub
RfcBean.java:-
package com.ust.jca;
import java.io.Serializable;
import com.sapportals.connector.execution.structures.IRecordSet;
public class RfcBean implements Serializable {
private String CW1;
private String CW2;
@return
public String getCW1() {
return CW1;
@return
public String getCW2() {
return CW2;
@param string
public void setCW1(String string) {
CW1 = string;
@param string
public void setCW2(String string) {
CW2 = string;
@param exportTable
public void createData(IRecordSet exportTable) {
// TODO Auto-generated method stub
MyJspPage.jsp:-
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean id="myBean" scope="request" class="com.ust.jca.RfcBean" />
Hello World
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:textView
text="<%=myBean.getCW1()%>"
id="tv1"
design="HEADER2"
encode="false">
</hbj:textView>
<br>
<hbj:textView
text="<%=myBean.getCW2()%>"
id="tv1"
design="HEADER2"
encode="false">
</hbj:textView>
</hbj:form>
</hbj:page>
</hbj:content>Hi Sanjyoti:
JCo is one of the connectors for SAP backend through any Java/JSP/Servlet based applications. You need to have the SAP JCo libraries (Jar files) with you to connect to the SAP R/3 system, ofcourse along with the connection parameters.
Here is the sample scenario where you are connecting SAP RFCs/BAPIs with JSPs:
1: first you need to manage required JCo jar files and import it into your project lib folder. this is to have the JCo api at runtime to your application
2: import the library path into your JSP page
3: write a custom method to connect to SAP with connection parameter
4: you should have an idea of which Remote_Func_Module you are connecting and the input and output attributes
5: Execute the functional module and display the results and close the connection parameters.
Its almost like connecting to a RDBMS in a general scenario.
For more information about SAPJCo:
http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/content.htm
For example program1 to connect:
http://help.sap.com/saphelp_nw04/helpdata/en/6a/14e13d8ee4535ee10000000a114084/content.htm
For example program2 to connect:
http://help.sap.com/saphelp_nw04/helpdata/en/9d/14e13d8ee4535ee10000000a114084/content.htm
For example program a BAPI:
http://help.sap.com/saphelp_nw04/helpdata/en/de/e6c9255044b241a9401a3a1b7009a9/content.htm
For Tools & Services of SAPJCo:
https://websmp101.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000463649
If you still want already working program, I can mail it your email id.
Thanks,
MS -
Warning message due to JSPDynpage
Hi All,
We have a scenario where in the jspdynpage we have only hyperlinks and One of the hyperlink is pointing to the standard uwl iview as follows
[http://portalhostname:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fevery_user!2fgeneral!2fiViews!2fcom.sap.netweaver.bc.uwl.iviews!2fcom.sap.netweaver.bc.uwl.uwl_iview?sap-config-mode=true|http://portalhostname:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fevery_user!2fgeneral!2fiViews!2fcom.sap.netweaver.bc.uwl.iviews!2fcom.sap.netweaver.bc.uwl.uwl_iview?sap-config-mode=true]
We are on CE7.1 and whenever I click on this hyperlink of jspdynpage, the uwl iview opens but with a warning msg at the header of the UWL as follows
"Another administrator is currently customizing this application. If you want to customize, please restart the application later and try again"
Same UWL iview when I open thru Home ->Work->UniversalWorklist , it does not show this warning message.
Is it bcoz of any session object inthe jspdynpage? any pointers will be of great help.
one note & Observation
assume that all the users are logout from the portal now any user first logged into the portal then that warnong message is not displayed at the header level of the UWL iView which we are accessing thru the hyper link from the JSPDynpage . but second user onwards any number of users are logged into the portal and click on the hyperlink in the JSPDynpage and it goes to UWL Iview where it is showing the above mentioned warning message at the header level. it is happening the same for the second user, third user and all users consequently but this warning message is not displayed for the very first logged in user.
Can anybody replys then it would be great help to us . <<text removed>>
when we access those links directly from the browser it is not giving that above specified warning message but this warning message is getting displayed when we access those hyperlinks from JSPDynpage .it seems there is some session related problem or something related to that. pls help.
Thanks
Bindu
Edited by: Hima Bindu on Apr 22, 2009 6:40 AM
Edited by: Matt on Apr 22, 2009 3:46 PM - please do not offer rewardsHi Michael
Excellent !! .our issue has been resolved.
Thank you very much & Thanks a lot for your help.
Can you please tell me what the reason due to with ?sap-config-mode=true in the URL...??
can you please give me the reason why this warning message is disappeared by removing the ?sap-config-mode=true.
Thanks
Bindu -
How to include .js files into JSPDynPage
I have created a startArcWebExplorer.js and saved it into the dist/scripts/ folder of my portal project. In my .jsp file I added the line
<script src="/irj/portalapps/PAFDPortal/scripts/startArcWebExplorer.js" type="text/javascript"></script>
What is the correct way to include a .js file in a JSPDynPage? Is there an easy way to use a relative path like ../../scripts/startArcWebExplorer.js or something similar?
When I preview the page in a portal iView, if the code is inline it works, however if I move it to the .js file it is does not work.
Thanks in advanceHi Mathieu,
the path described sounds good and should work. If it doesn't, please check the file system (did you deploy you PAR as "PAFDPortal.par"?!).
Anyhow, the hardcoded name of course isn't that nice, you should use the generic method getWebResourcePath() on the PortalComponentRequest, see http://www.szif.cz/irj/portalapps/javadocs/runtime/com/sapportals/portal/prt/component/iportalcomponentrequest.html#getwebresourcepath() for details.
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance! -
Problem with PAI (Process After Input) in JSPDynpage
Hi All,
I am implementing a file upload functionality through JSPDynpage. When I browse the excel file and try to upload it, it gives this error :
com.sapportals.htmlb.page.PageException: Eventhandler- "upload_file" or "onUpload_file" not found!
at com.sapportals.htmlb.page.DynPage.doProcessCurrentEvent(DynPage.java:168)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:115)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
This is my component :
public class FileUploadUtility extends PageProcessorComponent {
public DynPage getPage(){
return new FileUploadUtilityDynPage();
public static class FileUploadUtilityDynPage extends JSPDynPage{
private fileUpload fileUploadBean = null;
protected IPortalComponentRequest request;
protected IPortalComponentResponse response;
protected IPortalComponentSession session;
protected IPortalComponentContext context;
protected IPortalComponentProfile profile;
protected String userId;
private final static int INITIAL_STATE = 0;
private final static int OUTPUT_STATE = 1;
private final static int ERROR_STATE = 2;
private int state = INITIAL_STATE;
public void doInitialization(){
request = (IPortalComponentRequest) this.getRequest();
session = ((IPortalComponentRequest)getRequest()).getComponentSession();
context = request.getComponentContext();
profile = context.getProfile();
IUserContext userContext = request.getUser();
userId = userContext.getUserId();
System.err.println("berry + Getting userID " + userId);
fileUploadBean = new fileUpload();
session.putValue("fileUploadBean", fileUploadBean);
//uploadUtility();
public void uploadUtility(){
String mimetype;
String resourceName;
String repository;
FileInputStream sourceFileInput = null;
IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();
/* IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.wdUser.getSAPUser(); */
IUser epUser=(IUser)request.getUser().getUser();
System.err.println("epUser - " + epUser);
ResourceContext ctx = new ResourceContext(epUser);
repository = "/Folder1/Folder2";
RID rid=RID.getRID(repository);
System.err.println("getting RID :- " + rid);
IPageContext context = PageContextFactory.createPageContext(request,response);
// PageContext context = PageContextFactory.createPageContext(request, response);
Event event=context.getCurrentEvent();
if(null!=event)
String event_name=event.getAction();
if(null!=event_name && event_name.trim().equalsIgnoreCase("upload_file"))
//FileUpload fileUpload = (FileUpload)context.getComponentForId("fileupload");
FileUpload fileUpload = (FileUpload)context.getComponentForId("fileupload");
if(null !=fileUpload && null!=fileUpload.getFile())
mimetype = fileUpload.getFile().getContentType();
resourceName = fileUpload.getFile().getFileName();
//sourceFileInput = new FileInputStream(fileUpload.getFile().getFile().getAbsolutePath());
try {
sourceFileInput = new FileInputStream(fileUpload.getFile().getFile().getAbsolutePath());
} catch (FileNotFoundException fnf) {
System.err.print("FileNotFoundException Occured " + fnf.toString());
Content content = new Content(sourceFileInput, mimetype, -1L);
//IResource resource = (ResourceFactory.getInstance().getResource(rid, ctx));
IResource resource = null;
try {
resource =(IResource) (ResourceFactory.getInstance().getResource(rid, ctx));
} catch (ResourceException resexp) {
System.err.print("Resource Exception Occured for IResource" + resexp.toString()); }
ICollection aCollection=(ICollection)resource;
//IResource newResource = aCollection.createResource(resourceName, null, content);
try {
IResource newResource = (IResource) aCollection.createResource(resourceName, null, content);
} catch (NotSupportedException e2) {
System.err.print("Not Supported Exception Occured" + e2.toString());
} catch (AccessDeniedException e2) {
System.err.print("Access Denied Exception Occured" + e2.toString());
} catch (ResourceException e2) {
System.err.print("Resource Exception Occured for ICollection" + e2.toString());
}//end of catch
}//end of innermost if
}//end of 2nd if
}//end of 1st If
}// end of uploadUtil
public void doProcessAfterInput() throws PageException {
uploadUtility();
public void doProcessBeforeOutput() throws PageException {
this.setJspName("File_Upload.jsp");
Kindly help with expert suggestions :I put this
public void onUpload_file (Event event) {
uploadUtility();
In my FileUploadUtilityDynPage.java and its still throwing the same error.
{0}#1#com.sapportals.htmlb.page.PageException: Eventhandler- "upload_file" or "onUpload_file" not found!
at com.sapportals.htmlb.page.DynPage.doProcessCurrentEvent(DynPage.java:168)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:115)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
I've also imported import com.sapportals.htmlb.event.*;
No relief!! -
Passing value from JSP to JSPDynPage onclick of link
Hi,
I have extracted a value in the JSP page and i want to send this value back to the JSPDynPage on click of a link(the link is dependent on the value).
How can i do that?hi Sujoy,
you can pass values by using beans and display the passed data in a new jsp page.
firstly create a jsp page,that accepts user data,say for example i am placing a text box and a button,
next,create a jspdyn page---
private final static int INITIAL_STATE = 0;
private final static int FINAL_STATE = 1;
private int state = INITIAL_STATE;
private final static String BEAN_KEY="nameBean";
public void doInitialization(){
IPortalComponentRequest request=(IPortalComponentRequest) this.getRequest();
IPortalComponentContext ctxt=request.getComponentContext();
displayNameBean mybean = new displayNameBean();
ctxt.putValue(BEAN_KEY,mybean);
public void doProcessAfterInput() throws PageException {
InputField myInputField = (InputField) getComponentByName("user_name");
if (myInputField != null) {
IPortalComponentRequest request=(IPortalComponentRequest) this.getRequest();
IPortalComponentContext ctxt = request.getComponentContext();
displayNameBean mybean1=(displayNameBean)ctxt.getValue(BEAN_KEY);
mybean1.setName(myInputField.getValueAsDataType().toString());
public void doProcessBeforeOutput() throws PageException {
switch (state){
case INITIAL_STATE:
this.setJspName("loginPage.jsp");
break;
case FINAL_STATE:
this.setJspName("successloginPage.jsp");
break;
public void onButtonClick(Event event) throws PageException {
state=FINAL_STATE;
finally display this value in a new jsp page as follows--
<jsp:useBean id="nameBean" scope="application" class="NewProject.bean.displayNameBean" />
<%@ taglib uri= "tagLib" prefix= "hbj"%>
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:textView
id="welcome_note"
design="HEADER2">
<%
welcome_note.setText
(nameBean.getName());
%>
as simple as that!!
regards
SwarnaDeepika
P.S:Please reward points for helpful answers.
Maybe you are looking for
-
Report to identify the requisitionsu2019 coverage
Hi, This is a requirement of a report to identify the requisitionsu2019 coverage expressed in production days according to the production schedule horizon. Once a requisition is created either manually or automatically by the MRP, this report should
-
I have an XML data file that I want to use to populate a pdf fill-out form. There is enough data in the file to populate several forms. Is there a way of moving each set of data from this XML file into a seperate pdf fill-out form?
-
What is the best practice to transfer the mail data from 1 Lion server to the other Lion Server. We are upgrading from a macmini 2008 model intel with a running lion server to a new imacmini server. The data needs to be transfered from a FW disk to a
-
No sound in arch linux (tried all fixes i know of)
Hey guys im having trouble getting my sound to work in arch. I am using an onboard sound card, ac'97. The motherboard is an asus a8n-sli premium and in modprobe.conf it recognizes it as snd-intel8x0. I know a lot of people seem to have this problem f
-
Sales order ATP check - stock transport order
Hi, When the sales orders is created it performs availability check on stock transport order as per the settings and confirms quantity. However, when the stock transport order carries a batch which has a restricted status, the sales order still confi