Scope of Java Bean in portal pages
Hello All,
My objective is to share information between different portal pages using java bean.
I have portal page (say page1) having a portlet which is a jsp (say jsp1). In JSP1, I have following use bean tag( please see, the scope is Application)
<jsp:usebean id='userSession',scope='application',class='...'>
(As per my understanding of 'application' scope, this java bean will be visible to all the JSPs in the current browser session.)
I set some of the properties of the bean after this.
Now, from my 2nd portal page (say page 2) having exactly one portlet which is again a jsp (say jsp2), I try to access the same javaBean using the use bean tag.
<jsp:usebean id='userSession',scope='application',class='...'>
When I try to access the properties of the bean, none of them are available.
It looks like the original instance of the bean is lost and new instance is created.
Don't Java beans behave in the same way inside and outside the Portal environment ?
If I can't use java beans, could you please suggest any other way where I can share some data between Portal pages.
Thanks very much in Anticipation.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Naresh Kumar ([email protected]):
Hello All,
My objective is to share information between different portal pages using java bean.
When I try to access the properties of the bean, none of them are available.
It looks like the original instance of the bean is lost and new instance is created.
Don't Java beans behave in the same way inside and outside the Portal environment ?
If I can't use java beans, could you please suggest any other way where I can share some data between Portal pages.
Thanks very much in Anticipation.<HR></BLOCKQUOTE>
I have the same problem.
Why Portal behaviour is not transparent with Javabeans ?
G.Grimoldi
null
Similar Messages
-
WD Abap and WD Java in same portal page
Hi to all,
I need the following:
I have a portal page with somes WD Java iviews, the first wd Java send a parameter to the others wd Java. I need add one iview in this page with a new WD Abap application and send the same parameter (from the wd java to the new wd abap).
Can anybody helps me?
Thanks a lot for your help.Hi,
You can use portal eventing.
The API exists for both WDJ & WDA and if the iviews are in the same page it will work.
Regards,
Omri -
Need help in countdowntimer in java bean for jsp page
hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx
hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx
-
Using java beans in jsp using tomcat
hi i have made a form to enter user first name and last anme with html and then i have made a value javabean in which i want to store the information filled bu user. i want to display the information stored in java bean in jsp page i have made the full application and i have made class file of java bean as well as jsp file but when i try to run this web application in tomcat i am getting class not found exception.
could anybody tell me that where i should store the bean class in tomcat and do i need to make any package in which i have to place my java bean file plz tell me complete procedure along with code if possiblewhew thats a lot of questions... All of this is pretty basic stuff. I would recommend you take a look at the web services tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
lets see.
Starting a package name with com is just a generic standard which is followed.
It is most correct when creating commercial packages to create packages like com.companyName.project
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
You should not need a page import directive unless you are using classes in scriptlets: ie <% %> tags in your JSP. Your jsp:useBean tag will automatically import necessary classes - you don't need to import classes for beans specifically
<jsp:useBean id="myClass" scope="session" class="com.myPackage" />
Your directory structure should be something like this
webApplicationRootDirectory
- page1.html
- page2.html
- page3.jsp
- page4.jsp
- WEB-INF
- web.xml
- classes
- com
- myPackage
- myClass.classerrrm. Thats about it I think. -
hi,
I tried to my best to call java beans from JSP page but it generate error that "unable to load class....", please help me that in which directory jsp file and bean *.class file reside, currently my setting are as follows.
Note: I am using tomcat server and my jsp and servlet files are running seccessfuly, there is any special change in classpath for java beans? if any please tell
My jsp file is in tomcat-->webapps-->jsp--><my file>
My bean (*.class) file-->webapps-->Root-->web-inf-->classes--><my file>
Pleae help me for the above problem.
Mubashar ([email protected])According to J2EE standards:
The web appl directory structure should be:
WebAppRootDirectory
|
|---html, jsp, images etc
|
|---WEB-INF---
|---classes--
|---lib
|
|
1) Make sure WEB-INF is in capital letters
2) Place all ur beans in classes dir or sub-directory in
classes
3) In Tomcat place WebAppRootDirectory in webapps
directory
[email protected] -
How to call java bean from jsp
hi
How to call a java bean from jsp page..
Is any other way to call javabean from jsp page apart from this sample code...
<jsp:useBean id="obj" class="com.devsphere.articles.calltag.TestBean"/>
thnx in advanceIf you also use servlets, you can attach beans to the request or session and use them directly in your JSP's. So if you do:
request.setAttribute("name", yourBean);and then forward to a JSP, you can reference the bean like:
${requestScope.name} -
Easy way adding javascript to portal pages?!?
Hi,
I know (because I've tested it) that I can put some java script into portal pages. It's easy to use them as javascript functins, but if I try to use tag to get some data from base... it's doesn't work and generate some errors...
Please help me!
Krzysiek
nullI know that easier is adding script functions as portal functions/procedures... but HOW can I add characters like " ' " inside htp.p(' '); ??? Is it POSSIBLE or NOT? maybe some other characters are required before (if I dont want to use this inside ' ' as oracle variable, but javascript variable ???
Krzysiek -
Navigation Panel using Java Bean Base API
Hi,
I would like to know how do I add the standar navigation panel to my map using the oracle.lbs.mapclient.MapViewer object. I have try different forms which include adding a tile theme layer but its not working. I'm not using the JS API since I want to have an applet.
Thanks in advance.
SusanaHi,
in MapViewer's web page there is a link to some demos. There you can find a few examples of how to use the Java bean with jsp pages.
If you want to implement a simple java (desktop) application, the following code contains the basic information that you need to start the MapViewer object, set the display parameters, and then add some information to generate a map image. In this example, a base map is used to generate the map.
String url = "http://localhost:7001/mapviewer/omserver";
try
MapViewer mapViewer = new MapViewer(url); // creates MapViewer object
mapViewer.setDataSourceName("mvdemo"); // sets the data source (must exist in Mapviewer server)
mapViewer.setMapTitle("MVDEMO base map");
mapViewer.setAntiAliasing(true);
mapViewer.setImageFormat(MapViewer.FORMAT_RAW_COMPRESSED);
mapViewer.setDeviceSize(new Dimension(600,475));
mapViewer.setCenterAndSize(-116.65,38.92,19.2); // sets the map area
mapViewer.setBaseMapName("DEMO_MAP");
System.out.println(mapViewer.getMapRequestString()); // this prints the current map request to be issued
boolean response = mapViewer.run(); // executes the request
if (response)
Image img = mapViewer.getGeneratedMapImage();
// do something with the image in your Java application
}catch(Exception ex)
ex.printStackTrace(System.err);
}The API java doc (see APIs link in MapViewer's web page) contains a more detailed description of the methods that can be used with the Java bean API. -
Java Bean scope when used with the JPDK
Portal 3.0.9.8.4 and Jserv
When using JSPs with Java Beans and the JPDK I have noticed problems when setting the scope attribute of the useBean action to something other than "page". For example, <jsp:useBean id="provider" scope="session" class="MyClass" /> causes a java.lang.ClassCastException when there are more than two JSP portlets than attempt to access the ProviderSession object.
Does anyone know what value the JSP scope should be set to when you want the JSPs read/write to the ProviderSession?The behavior you report is an expected one as your keys of objects on session are not unique to the two portlet instances. Two portlets with the same session object (may have been deployed on the same Portal page), are sharing the same object put on session, thus resulting in thread conflicts. What you need to do is to generate unique keys for objects stored for each portlet instance.
For example, instead of having the id as "provider", you should have it as <portlet instance name> + "provider".
You are not experiencing the same behavior in "request" or "page" scope, as in these scopes, the objects are not shared across portlet instances.
Please let me know if my interpretation of your issue is wrong.
Regards,
Abhinav -
An error in jsp page useBean when i try to include the java bean package?
Hi Sir,
I am using import com.project.ShowData in java beans inorder to connect to the jsp.
The jsp code goes like this:-
<%@ page import="com.project.ShowData" %>
<jsp:useBean id="jspuser1" class="com.viman.ShowData" scope="session"/>
<jsp:setProperty name="jspuser1" property="*"/>
Here the error is showing as cannot resolve symbols in com.project.ShowData.But i have given the same in java beans like this:-
Package com.project;
//import of package goes here
public class ShowData
//code goes here
It seems that all are correct here.I have done few programs using this without any problem.But suddenly it is giving a problem like this.What is the problem here?It is quite Urgent.Thank u.
Regards,
m.ananthuGreetings,
Here the error is showing as cannot resolve symbols in com.project.ShowData.But i have given the
same in java beans like this:-Seeing the actual error would be more helpful. ;)
Regards,
m.ananthu Regards,
Tony "Vee Schade" Cook -
Using Java Beans in Java Server Pages
Can we not use a method of Java Bean in a Java Server Page ?
I am trying to retrieve the user email from a java bean method "getUserEmail". I am instantiating the class, but when I try to use that in JSP tags, I am getting an error.
<jsp:useBean class = "formjavabean.application" id = "applicationId" scope = "session" />
<%@ page import="java.io.*, java.lang.*" %>
<%!
String user = applicationId.getUserEmail() ;
String f3 = "ftn03" ;
String f3not = "ftn03 file not uploaded";
...........I am failing in debugging that, can anyone help plz ?Here is my whole code in parts:
First the head section:
<head>
<title> Fastran </title>
<jsp:useBean class = "formjavabean.application" id = "applicationId" scope = "session" />
</head>JSP part in the body section :
<%@ page import="java.lang.*, java.io.*" %>
<%!
private String f3 = "ftn03";
private String f3not = "ftn03 file not uploaded";
private String f7 = "ftn07";
private String f7not = "ftn07 file not uploaded";
private String f9 = "ftn09";
private String f9not = "ftn09 file not uploaded";
public String checkFile3()
File ch3 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn03") ;
if (ch3.exists() == true)
return f3 ;
else
return f3not ;
public String checkFile7()
File ch7 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
if (ch7.exists() == true)
return f7 ;
else
return f7not ;
public String checkFile9()
File ch9 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn09") ;
if (ch9.exists() == true)
return f9 ;
else
return f9not ;
%>Java Script in the body section, using methods defined in the JSP part:
<script type="text/javascript">
function validate_file ( )
var file3 = "<%= checkFile3() %>" ;
var file7 = "<%= checkFile7() %>" ;
var file9 = "<%= checkFile9() %>" ;
if ( file3 != "ftn03" || file7 != "ftn07" || file9 != "ftn09" )
alert("Please upload the required file") ;
return ("fastran.jsp") ;
else
return ("processForm.jsp") ;
function validate_upload ( )
valid = true;
if ( document.val_file.filefield.value == "")
alert("Please select a file for upload") ;
valid = false;
return valid;
</script>Finally the form and button part of the page, in the body section:
<form name = "val_file" method="post" action="upload.jsp" name="submit" enctype="multipart/form-data" onSubmit = "return validate_upload();">
Upload Files: <input type="file" name="filefield" >  <input type="submit" name="submit" value="Upload"><br>
<font color = "Red"><h5>(ftn03,ftn07, and ftn09)</h5></font><br><br><br>
Files on the server :<br><br>
<font color = "Green"><h5>
<%= checkFile3() %><br>
<%= checkFile7() %><br>
<%= checkFile9() %><br>
</h5></font>
<br><br><br><br><br><br><br><br><br>
<input type=button onClick="location.href='logintest.jsp'" value='Home'> <input type=button onClick="location.href=validate_file()" value='Proceed' ><br>
</form>Now try this:
Change <%! to <%, or try using bean method as:
String userEmail = applicationId.getUserEmail() ;..........and that is my problem. I would really appreciate any help, thanks -
Scope of a java class in JSP page
Hi
If I use a java bean using the
<jsp:useBean
id="beanSomeName"
scope="page|request|session|applicaton
I can specify the scope of of the bean after which I can assume it is Garbage Collected.
However if I just create a new Java Class in a jsp bean ( I inherited this code ) what will be scope of this java class. When will it be Garbage collected.
Is it Page scope?
Thanks
bib/-If you do
<% MyClass c = new MyClass(); %>
and don't do anything else to store it in the request or session than it is like page scope.
if you do
<%! MyClass c = new MyClass(); %>
it is more like application scope. -
Application scope java beans not behaving....
I am using WL 5.1, sp8, on NT....
I am running jsp code that declares java beans of application scope....
However, it doesn't appear to be resolving the application scope
properly, it seems to instantiate a new Bean each time I go to
a new page within the same application....
One thing I am not clear on, is whether I have properly configured
the WebApp....I have just been assuming that all pages within
the same path sub-directory are of the same application, but that
doesn't appear to be working....
I haven't found any weblogic.properties settings for defining WebApps,
that will share application scope, etc....
I assume there is a simple answer here, I appreciate any help...
Thanks,
Jason Rosenberg
Jason,
WLS 5.1.0 is up to service pack level 12 now, which you should go to
http://support.bea.com/welcome.jsp and login to download from the "Supports
Download" section. Note that you need to be a paying customer to see this
section. After applying sp12 you should take a look at our web app docs
here http://bernal.beasys.com/release/docs51/classdocs/webappguide.html for
instructions on setting up a web app and registering it in wls 5.1.
"Jason Rosenberg" <[email protected]> wrote in message
news:[email protected]...
> I am using WL 5.1, sp8, on NT....
>
> I am running jsp code that declares java beans of application scope....
>
> However, it doesn't appear to be resolving the application scope
> properly, it seems to instantiate a new Bean each time I go to
> a new page within the same application....
>
> One thing I am not clear on, is whether I have properly configured
> the WebApp....I have just been assuming that all pages within
> the same path sub-directory are of the same application, but that
> doesn't appear to be working....
>
> I haven't found any weblogic.properties settings for defining WebApps,
> that will share application scope, etc....
>
> I assume there is a simple answer here, I appreciate any help...
>
> Thanks,
>
> Jason Rosenberg
>
>
>
>
>
>
>
-
Make sure that your bean is implementing the serializable interface and that
you are accessing the bean from the session with the same name.
Bryan
"Sandeep Suri" <[email protected]> wrote in message
news:[email protected]..
Hi, I have quick question about use of USEBEAN tag in SP2. When I
specify a scope of SESSION for the java bean, it does not keep the
values that I set for variable in the bean persistent.Thanks,Sonny
Try our New Web Based Forum at http://softwareforum.sun.com
Includes Access to our Product Knowledge Base! -
Calling Portal Service using result as Java Bean Model impossible?
Hello folks,
we try to achieve to call a portal service (working) which gives as a result a list of object of type com.foo.Report. We want to make use of this class as a model class, so we have the class as a model node in the context. The class itself is part of the service DC.
Unfortunately at run time it gives us a NoClassDefFound Exception of com.foo.Report.
As the com.foo.Report is part of the same DC as the service, it is no option to add the PAR public part to the used DCs of the WD DC because then there is this type conflict when we call the service (service look up). Or am I wrong and this is the way to do it? I mean I struggled quite a while to get the service look up right and needed to remove all the PAR/lib used DCs from the used DCs of the WD Project, when I got it working this Model error came up. I also tried to put the Model class in a separate DC but that caused the same error.
how is it possible to call a Portal service from WD and using it's return vale as a Model class
our system iis 7.0.17
best
StefanHi,
Refers the following docs..
EJBs in Web Dynpro Application Using Wrapper Class
Here Java Bean Model used in web dynpro.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00be903b-8551-2b10-c28a-8520400c6451
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c
Accessing database table using EJB and web dynpro
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70929198-0d36-2b10-04b8-84d90fa3df9c
Oracle Connectivity with EJB using WebDynpro Application
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdjava/oracle%2bconnectivity%2bwith%2bejb%2busing%2bwebdynpro%2bapplication
Hope it will help u.
thanks
Abhilasha
Maybe you are looking for
-
ITunes says I purchased an album but it wont let me download it
I bought an album on on my laptop for my old iPod. Now I have an iPod touch and i went into the purchased items on the itunes app and it didnt have the album i was looking for in it. I then searched for it in the search bar and it still says i purcha
-
I spent my SG$39.90 to purchsed a new version of mac lion 10.7.2. But sadly, after installed i could not open my webcam or facetime.It is very frustrating and making me very upset due to this situation.If i know like this i would never purchased the
-
Bring back the Refresh button in Dreamweaver (Was: Dreamweaver CC "simplifying")
Is anyone else flabbergasted that Adobe removed the refresh button from Dreamweaver CC? All for the purpose of "simplifying" the workspace? Sorry, that's just stupid! I don't see how removing ONE button at the top (which wasn't obtrusive, in the way
-
Oracle 11 RPD: Create 2 Logical Tables Based on 1 Physical Table
Hello, I have a date dimension table in the physical layer. From that I need to create 2 date dimension tables in the BMM layer. One is for order date and the other is for shipped date. There is a ship_date_key and an order_date_key in my fact table
-
Why apple say get our free apps w includes iphoto?
Iphoto imovie should be free apps acording with apple site.when i went ti app store to get them guess what 4.99€ ***?