Simple Example of PDK Servlet and PreferenceStore
I'm currently using Portal 10g, Release 2. Unfortunately, there are no newly updated PDK samples available for this version, but I've referenced the previous Portal examples and haven't been able to find a simple example that walks through the entire process of establishing/registering a store, storing preference data, and reading preference data from a PDK Servlet.
If anyone has examples that illustrate the following, it would be greatly appreciated:
1. How to create a File-based PreferenceStore for an PDK HttpServlet
2. How to associate a preference store with the Portlet (when using the PortletRequestRender.getProviderInstance().getPreferenceStore(), I get null)
3. How to store a preference value in the store
4. How to read a preference value in the store
Note: I have been able (with far too much code given a "development kit") to use the PDK to create a File-base PreferenceStore and store values. Unfortunately the read operations look for the .dat file in a path that consists of the path that I established in the store and appends it with a value of /df/. As a result, the preferences can't be read.
Thanks for any opinions/advice on this.
John
Hi John,
You could try looking up at any sample portlets on the Portal Integration website: http://www.oracle.com/technology/products/ias/portal/point.html
All the JPDK based portlets use file preference stores.
1. How to create a File-based PreferenceStore for an
PDK HttpServlet
2. How to associate a preference store with the
Portlet (when using the
PortletRequestRender.getProviderInstance().getPreferen
eStore(), I get null)You need to use the following code:
// Get access to the PortletRenderRequest
PortletRenderRequest pReq = (PortletRenderRequest)
request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
// Get access to the user's preference store for this portlet
NameValuePersonalizationObject data = (NameValuePersonalizationObject)
PortletRendererUtil.getEditData(pReq);
// Get access to the Edit Defaults data which would be applciable to all users (who have not yet customized that attribute)
NameValuePersonalizationObject editData = (NameValuePersonalizationObject)
PortletRendererUtil.getEditDefaultData(pReq);
3. How to store a preference value in the store
4. How to read a preference value in the storeLook at the APIs for NameValuePersonalizationObject at http://www.oracle.com/technology/products/ias/portal/html/javadoc/apidoc/index.html
>
Note: I have been able (with far too much code given
a "development kit") to use the PDK to create a
File-base PreferenceStore and store values.
Unfortunately the read operations look for the .dat
file in a path that consists of the path that I
established in the store and appends it with a value
of /df/. As a result, the preferences can't be
read.
Thanks for any opinions/advice on this.
JohnI hope this helps ..
thanks,
Harsha
Similar Messages
-
What forum might be useful in solving this issue:
Simple Examples of data connectivity and transfer of data from an .asp.vb to javascript in an .aspx fileThey'll help you here in the Microsoft ASP.net forums.
http://forums.asp.net/
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights. -
Simple example of connecting SAP and VB
Hi Experts
Can anyone help me providing material or simple example program of connecting SAP and VB for data transfer.
Its being a tough task for me, pls help me out.
Thanks in advance.
Regards
RajaramForm VB.NET appliaction you have two ways to connect to SAP system and execute BAPI. Either through webservices or by using NCo. Choice depends upon you appliaction requirement.
For starting with NCo go through
http://help.sap.com/saphelp_nw04s/helpdata/en/a9/4a57c1bac80e4e977d8cd9b3ecab89/frameset.htm
OR
THIS IS ANOTHER WAY TO LOGIN TO SAP THROUGH VB TRY THIS.
Logon with the SAPLogon control, Use an RFC call from the SAP Function
Control, and get the results with the SAP Table Factory Control. . .
You must have SAPGui's FULL install on your machine for this to work (Or at
least SAPLogon and the RFC toolkit)
This VBScript example might help, it calls RFC_READ_TABLE in sap, and emails
the results back to a user from a selected query (In this case uses that are
locked out.
This should show you how this could work in practice.
Thanks,
Will
' Email Locked out SAP users details to user in a .csv file through MS
Exchange / CDO
Dim ctlTableFactory, RFC_READ_TABLE, eQUERY_TAB, tblOptions, tblData,
tblFields, funcControl, objConnection, ctlLogon
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set ctlLogon = CreateObject("SAP.LogonControl.1")
Set funcControl = CreateObject("SAP.Functions")
Set ctlTableFactory = CreateObject("SAP.TableFactory.1")
Set objWindowsScriptShell = CreateObject("WScript.Shell")
Set objConnection = ctlLogon.NewConnection
Set filOutputobjFileSystemObject.CreateTextFile("E:\SAP Scripts\LockedUsers.CSV", True)
objConnection.ApplicationServerobjWindowsScriptShel l.RegRead("HKLM\Software\AccantiaEDI\SAPServer")
objConnection.SystemobjWindowsScriptShell.RegRead(" HKLM\Software\AccantiaEDI\SID")
objConnection.SystemNumber = "00"
objConnection.ClientobjWindowsScriptShell.RegRead(" HKLM\Software\AccantiaEDI\SAPClient")
objConnection.Language = "EN"
objConnection.UserobjWindowsScriptShell.RegRead("HK LM\Software\AccantiaEDI\SAPSAPUser")
objConnection.PasswordobjWindowsScriptShell.RegRead ("HKLM\Software\AccantiaEDI\SAPSAPPassword")
booReturn = objConnection.Logon(0, True)
If booReturn True Then
'MsgBox " Cannot log on! "
'MsgBox booReturn
filOutput.WriteLine "ERROR CALLING LOGGING INTO SAP - FAILED LOGINS
UNKNOWN"
Stop
Else
'MsgBox " Logon OK."
funcControl.Connection = objConnection
Set RFC_READ_TABLE = funcControl.Add("RFC_READ_TABLE")
Set strExport1 = RFC_READ_TABLE.Exports("QUERY_TABLE")
Set strExport2 = RFC_READ_TABLE.Exports("DELIMITER")
Set tblOptions = RFC_READ_TABLE.Tables("OPTIONS") '
Set tblData = RFC_READ_TABLE.Tables("DATA") '
Set tblFields = RFC_READ_TABLE.Tables("FIELDS") '
strExport1.Value = "USR02"
strExport2.Value = ","
tblOptions.AppendRow
tblOptions(1, "TEXT") = "LOCNT > 0 OR UFLAG = 128"
tblFields.AppendRow
tblFields(1, "FIELDNAME") = "BNAME"
tblFields.AppendRow
tblFields(2, "FIELDNAME") = "LOCNT"
tblFields.AppendRow
tblFields(3, "FIELDNAME") = "UFLAG"
If RFC_READ_TABLE.Call = True Then
If tblData.RowCount > 0 Then
filOutput.WriteLine "UserName,FailedLogins,LockedFlag"
' MsgBox tblData.RowCount
For intRow = 1 To tblData.RowCount
filOutput.WriteLine tblData(intRow, "WA")
Next
Else
filOutput.WriteLine "NO FAILED LOGINS OR LOCKED USERS"
End If
Else
filOutput.WriteLine "ERROR CALLING SAP REMOTE FUNCTION CALL -
FAILED LOGINS UNKNOWN"
End If
End If
Set filOutput = Nothing
MailProfile = "MS Exchange Settings"
Set objSession = CreateObject("MAPI.Session")
LogonOK = objSession.Logon(MailProfile)
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = "SAP Users Report - Locked Users + Failed Logins"
strSetMessage = "There are " & tblData.RowCount & " users that are
either locked due to failed logins, or have at least 1 failed login attempt
on system " & objWindowsScriptShell.RegRead("HKLM\Software\Accant iaEDI\SID")
& vbcrlf &
reward if useful -
Simple example of a profile and publication setup
Post Author: cbaumann
CA Forum: WebIntelligence Reporting
Hi
I am using Windows 2000 Server with Business Objects XI Release 2, SP3, english.
I am trying to create a profile and publication to test some scenarios what's the best way to use it. I did not really found a good docu or description, how to set it up. Has anybody a good explanation, maybe using this beach universe ?
I can then try to map this to my universe and see, how to use it.
thanks, ChrisJonWat wrote:
If, for example, you wanted to write in some data and add the time it was added, then sending to Oracle something like:
INSERT INTO MyTab(datacolumns,DateAdded)
VALUES (datavalues, SYSDATE)
where the data values are bound variables from your app, might be the best way to go about it.
Rather than
(Execute) MyInsertProc(datavalues)
where the InsertProc actually does the insertI'd disagree actually; if you've got code occuring on the database then it's much easier to optimize it if the code is all in one place - ie. in a package/procedure/function somewhere in PL/SQL.
I'm with Tom Kyte in that I prefer everything to go through transactional API's - that is, if you're intending to add a new user, have a procedure that calls the inserts into the various tables, updates, etc, rather than having the front end call each insert itself.
If the system is trying to do bulk uploads, well there are better methods of doing that (SQL*Loader or external tables) than row by row single inserts.
This thread is an interesting read, but specifically, Tom's answer here is relevant. -
I need a simple example of shopping cart(newbie)
Has any one come across a simple example of shopping cart and the process
behind it i.e. from jsp to ejb. So far I have looked at the buybeans example
and it still is not clear the approach that was used.
I would be greatful for any assistance thank you
Kenneth A-AdjeiTake a look at:
http://java.sun.com/docs/books/tutorial/servlets/overview/example.html
"Ken Adjei" <[email protected]> wrote in message
news:3960a901$[email protected]..
Has any one come across a simple example of shopping cart and the process
behind it i.e. from jsp to ejb. So far I have looked at the buybeansexample
and it still is not clear the approach that was used.
I would be greatful for any assistance thank you
Kenneth A-Adjei -
Deployment of simple JSP to Oracle Servlet Engine
Hi
Anyone there tried to deploy a simple JSP running against OSE.
Please advice where can I get more information for this.
ThanksYes I have tried it with simple examples like data access and calling EJB. In-session EJB calls do not work but if your JSP is deployed in another Oracle JVM like 9iAS then EJB calls work.
There are two manuals you can refer:
JSP Developers guide at http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83720/toc.htm
AND
Java Tools reference guide at http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83727/toc.htm
null -
I want simple example of UTL_FILE package
I want simple example of UTL_FILE package , and please I want this example be complete as possible as you can ( i mean - as I understand - we suppose make Create Directory statement at beginning and so on ... ) .
even if you know any links for simple examples for UTL_FILE package .... I will be so grateful to post it .Maybe something like this?
http://www.oracle-base.com/articles/9i/GeneratingCSVFi
les.phpthanks Jens Petersen .... it's good one. -
Simple authentication and authorization with a servlet and a filter
Could somebody point me to code example that do simple authentication/authorization using one servlet and one filter? (without Spring, Struts, JSF or any framework)
I’m having a lot of problems with that, apparently, easy task.
These are the rules:
- A simple login page
- Two roles (admin, registered).
- If the user loged is an admin, redirect to his entry page (private/admin/index.jsp).
- If the user loged is of role registered, redirect him to his entry page (private/registered/index.jsp).
- If it’s not a valid user, redirect again to login page.
- Admin’s users cannot go to private/registered/ area.
- Registered users cannot go to private/admin/ area.
- Non authenticated user cannot go to private/ area
Thanks a lot in advance!
Edited by: JLuis on 25-ago-2010 15:27AccessControl.java:
package com.tlsformacion.security;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tlsformacion.utils.Log;
public final class AccessControl extends HttpServlet {
private static final long serialVersionUID = 5741058615983779764L;
private static final String USERNAME_ATTR = "username";
private static final String PWD_ATTR = "password";
private static final String LOGIN_PAGE_ATTR = "login_page";
private static final String ROL_ATTR = "role";
private boolean isAuthentic = false;
private String role = null;
private String loginPage = null;
public AccessControl() {
super();
public void init(ServletConfig config) throws ServletException {
loginPage = config.getInitParameter(LOGIN_PAGE_ATTR);
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside doGet");
doAccessControl(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside doPost");
doAccessControl(request, response);
private void doAccessControl (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside doAccessControl");
doAuthentication(request, response);
if (isAuthentic) { //Authentic user
doAuthorization(request, response);
} else { //User NOT authentic
doRejection(request, response);
private void doAuthentication(HttpServletRequest request, HttpServletResponse response) {
debug("Inside doAuthentication");
String requestedURI = request.getRequestURI();
if (requestedURI.contains("/AccessControl")) { //Comes from login page
debug("Comes from login page");
String username = request.getParameter(USERNAME_ATTR);
String pwd = request.getParameter(PWD_ATTR);
role = getRole(username, pwd);
if (role != null) {
isAuthentic = true;
request.getSession().setAttribute(ROL_ATTR, role);
} else { //Doesn't comes from login page
debug("Doesn't comes from login page");
if (isInSession(request)) {
debug("Rol is in session");
isAuthentic = true;
} else {
debug("Rol is NOT in session");
private void doAuthorization(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside doAuthorization");
String requestedURI = request.getRequestURI();
debug("requestedURI: " + requestedURI);
if (requestedURI.contains("/AccessControl")) { //Comes from login page
goHomePage(request, response);
} else if (requestedURI.contains("/private/" + role)) { //Trying to access his private area
goRequestedPage(request, response);
} else { //Trying to access other roles private area
goLoginPage(request, response);
private void doRejection(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside goRejection");
role = null;
goLoginPage(request, response);
private void goHomePage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside goHomePage");
String homePage = "private/" + role + "/index.jsp";
goPage(request, response, homePage);
private void goLoginPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside goLoginPage");
goPage(request, response, loginPage);
private void goRequestedPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
debug("Inside goRequestedPage");
String contextPath = request.getContextPath();
debug("contextPath: " + contextPath);
String requestedPage = request.getRequestURI().replace(contextPath + "/", "");
goPage(request, response, requestedPage);
private void goPage(HttpServletRequest request, HttpServletResponse response, String page) throws IOException, ServletException {
debug("Inside goPage ...trying to go to: " + page);
//Option A
response.sendRedirect(page);
//Option B
//RequestDispatcher requestDispatcher = request.getRequestDispatcher(page);
//requestDispatcher.forward(request, response);
private boolean isInSession(HttpServletRequest httpRequest) {
boolean inSession = false;
role = (String)httpRequest.getSession().getAttribute(ROL_ATTR);
if (role != null && !role.equals("")) {
inSession = true;
return inSession;
//PENDIENTE: mock method!
private String getRole(String username, String pwd) {
String role = null;
if (username.equals("admin") && pwd.equals("admin")) {
role = "administrator";
} else if (username.equals("regis") && pwd.equals("regis")) {
role = "registered";
return role;
private void debug(String msg) {
Log.debug(msg);
}Proyect Folder Structure:
WebContent
login.html
private
administrator
index.jsp
registered
index.jspBasically, the problem is that if you try to log as admin/admin (for example) the servlet AccessControl executes infinitely
Edited by: JLuis on 26-ago-2010 8:04 -
I have been looking all over for a simple "hello world"
example, on how to connect to a database, and pass a param, and
return a dataset. I would like one that does not use components.
(Actionscript only). That uses ColdFusion 7.x and Flash 8. Can
anyone point me to one?Thanks Craig, I saw that example, but it was meant for Flash
MX, and according to the Flash 8 documentation, the NetServices is
now deprecated. Anyway, I posted my question on another site and
some supplied me with a simple example. Here is the url if anyone
is interested...
sample -
Need Simple Example of Notifier and Occurance
hi friends
i need to know the exact funtion of notifiers and occurances. So can you send me the simple example for both..
Thanks in advance...Open your example finder (help..find examples...") and search for these two terms.
I recommend looking at "General Notifier example.vi" and "Generate Occurrences.vi".
Is there anything in the online help that is not clear? What are you trying to do?
Message Edited by altenbach on 09-26-2008 11:22 PM
LabVIEW Champion . Do more with less code and in less time . -
Explaination and a simple example on TagExtraInfo class anyone ??
Hi Guys,
Could anyone please explain the concept of TagExtraInfo class and give a simple example with code. This one is really urgent !!
Thanks
RasmeetIs this a genuine forum topic ? Or are we seeing the birth of some new encrytion algorithm here.
Assuming its the former,...
Have you seen http://java.sun.com/j2ee/tutorial/doc/JSPTags5.html#68067 -
Servlets and Application Beans
Hi I'm reviewing some sample code that was originally done as a JSF application. I however will not be doing a JSF application but rather a simple Model 2 architecture using servlets. I'm trying to confirm what the equivalent to an application managed and session beans in JSF would be in a servlet environment. For example the following xml in a JSF app...
- <managed-bean>
<managed-bean-name>jpaResourceBean</managed-bean-name>
<managed-bean-class>oracle.toplink.jpa.example.inventory.services.impl.JPAResourceBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
- <managed-bean>
<managed-bean-name>inventoryService</managed-bean-name>
<managed-bean-class>oracle.toplink.jpa.example.inventory.services.impl.ManagedInventoryBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
- <managed-property>
<property-name>jpaResourceBean</property-name>
<value>#{jpaResourceBean}</value>
</managed-propert
Would that simple be using the servlet context and session variables? Any other tips on the right way to do this?
Thanksfsa3 wrote:
I'm trying to confirm what the equivalent to an application managed and session beans in JSF would be in a servlet environment.JSF application scoped beans are stored as ServletContext attributes and JSF session scoped beans are stored as HttpSession attributes. So do the same in a servlet and you're fine. -
An simple Example for beginer ...
Hi:
I want to generate a pdf-file from somefile.xml and somefile.xsl using fop. And it doesn't work. Could somebody provide a simple example, how to do it? It would be very nice.
Thanks a lot.Here is my code-example:
import java.io.*;
import org.apache.fop.apps.*;
import org.xml.sax.*;
import java.util.logging.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestClass extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
PrintWriter pw = new PrintWriter(new FileOutputStream("C:/Temp/logFile.log"));
String xmlFileName = "C:/xml/xmlfile.xml";
String xslFileName = "C:/xsl/xslfile.xsl";
ServletOutputStream outStream = response.getOutputStream();
ByteArrayOutputStream arr = new ByteArrayOutputStream();
try
XSLTInputHandler in = new XSLTInputHandler(new File(xmlFileName), new File(xslFileName));
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(arr);
InputSource inputSource = in.getInputSource();
XMLReader xmlReader = in.getParser(); // Error! Unknown Source !!!
driver.render(xmlReader, inputSource);
catch (Exception ex)
ex.printStackTrace(pw);
pw.close();
response.setContentType("application/pdf");
response.setContentLength(arr.size());
arr.writeTo(outStream);
outStream.flush();
}Any idea? Thanks. -
Trying to create a simple example. Need Help!
I'm trying to create a very simlpe examlpe using Swing components to illustrate a MVC architecture.
I have a JFrame containing a JTree and a JButton.
What I'd like to happen is when I click the JButton the JTree model is changed in some fashion and the the view is refreshed due to the models change.
If anyone out there has a simple example of any MVC architecture involving Swing components I'd love to see it.
ThxSure, look at any of the Sun tutorials. For example, look in your API documentation for JTree; it has a link to a tutorial about how to use JTree.
-
Looking for a simple example of the Minimax algorithm in java
Hey everyone,
I'm currently working on a Gameboy emulator program as a pet project, and for one of the game's I'd like for the enemy AI to use the Minimax algorithm, but I don't have any experience with it (or recursion in general, for that matter). Could anyone maybe post a simple example of how this algorithm works?WTF? I'm sure you can find plenty of examples on google. It's on you to take the time to go through them, study them, and, if you still don't understand something, post a clear, concrete question that indicates what you read and what you didn't understand about it.
As is, you're essentially treating folks here as your research flunkies and saying, "Give me an example that's better than all the ones already easily available to me. Read my mind to know why I didn't like them."
Maybe you are looking for
-
I returned my headsett because it stopped charging after a few months. Today i received my new wow headsett and i was happy again How ever it wont connect .. it shows up in my system and it works a few minutes, then it shuts down. I need to restart t
-
Tips and Tricks to make STP 2 run faster?
I'm working with STP 2 for the first time and it runs very slow despite my new computer. I don't remember having this problem in Pro Tools with a much slower computer. I'm wondering what I can do to improve the performance... When a multitrack projec
-
Font Management Software for PC
Hi folks, I'm new to the adobe forums so excuse me if this question is redundant. I was wondering if anyone here knows of something like font suitcase for windows that lets you activate and deactivate fonts but a less expensive/free version Help i
-
MobileMe iPhoto galleries not syncing after password change
After changing the MobileMe Password iPhoto does not recognize the properly configured MobileMe Account anymore. All other Applications with MobileMe Upload/Sync/Publishing capability (iMovie, Aperture, MobileMe-Sync) still work flawless. After tryin
-
Brightness very high in video store purchases?
I use iTunes only to buy music and just now decided to try a video, I have the player installed for Windows 7. For some reason, the videos I download seems to have a very high brightness setting. Since the iTunes player doesn't seem to have a way of