JSPDyn page using a bean

Trying to create a pretty simple JSPDyn page with a single bean.  I am using NWDS to generate the code.  I am trying to set some initial data in bean to be used on the page later, but it always comes back as NULL.  It's like the creation the generation of the page creates a new instance of bean and loses the reference I create in the controller.
Here is the code for the dynpage controller:
package com.my.test;
import com.my.test.bean;
import com.sapportals.htmlb.*;
import com.sapportals.htmlb.enum.*;
import com.sapportals.htmlb.event.*;
import com.sapportals.htmlb.page.*;
import com.sapportals.portal.htmlb.page.*;
import com.sapportals.portal.prt.component.*;
public class myTest extends PageProcessorComponent {
  public DynPage getPage(){
    return new myTestDynPage();
  public static class myTestDynPage extends JSPDynPage{
    private bean myBean = null;
    public void doInitialization(){
      IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();
      Object o = profile.getValue("myBean");
      if(o==null || !(o instanceof bean)){
        myBean = new bean();
        profile.putValue("myBean",myBean);
      } else {
          myBean = (bean) o;
      // fill your bean with data here...
      myBean.setOutput("test message");
    public void doProcessAfterInput() throws PageException {
    public void doProcessBeforeOutput() throws PageException {
      this.setJspName("myTest.jsp");
Notice I am setting the data up after the comment "//fill your bean data here".  SAP code generator inserted this comment.
and here is the bean code
package com.my.test;
import java.io.Serializable;
public class bean implements Serializable {
     private String output;
     public String getOutput( ){
          return output;
     public void setOutput( String value ){
          output = value;
and finally the jsp page
<jsp:useBean id="myBean" scope="application" class="com.my.test.bean" />
<hbj:content id="myContext" >
  <hbj:page title="PageTitle">
   <hbj:form id="myFormId" >
     The value of Output is <%= myBean.getOutput( ) %>
   </hbj:form>
  </hbj:page>
</hbj:content>
the output is:
The value of Output is null
Anyone have any idea what I am doing wrong here.
Thanks in advance.
Clark

Hi Clark,
Open the portalapp.xml and delete these two lines
        <property name="ComponentType" value="jspnative"/>
        <property name="JSP" value="pagelet/myTest.jsp"/>
Rebuild and deploy and it should work.
Thanks
Prashant

Similar Messages

  • Insert data into table from JSP page using Entity Beans(EJB 3.0)

    I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
    1. I have a table 'FRIENDS', (in Oracle 10g database).
    2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
    3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
    4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
    5. I am using JDev as editor.
    Please provide me code ASAP or link with similar example.
    Thank you.
    Anurag

    Hi,
    I am also trying that scenario. So u can
    Post the jsp form data to a Servlet which will act as a Controller.
    In the servlet invoke the business method.
    Similar kind of app is in www.roseindia.net
    Hope this would help u.
    Meanwhile if u get any optimal solution, pls post it.
    Thanks,
    Happy Java Coding.

  • Passing data from one page to another page using form bean

    hi,
    refer to above question, i had follow the sample found at weblogic sample application
    ,but unfortunately when i create my own application. The following error occur:
    [Caught exception when evaluating expression '{actionForm.note}' with available
    binding contexts [currentTag, session, pageContext, request, response, application].
    Root exception cause: com.bea.wlw.netui.script.xscript.IllegalContextStateException:
    The action form for the expression "actionForm["note"]" could not be found
    can anymore tell me what has i miss !
    {program flow -
    pageA.jsp[userinput] ->getConfirmationAction-> pageB.jsp[confirmation]
    -> protected Forward getConfirmation(TransferBean
    form) throws Exception
    return new Forward( "show_confimation" ,form);
    thanks & rgds
    cassy

    Cassy,
    If your page flow looks like this:
    first.jsp -> actionA(FooForm) -> second.jsp -> actionB()
    Then I think the problem is that there is no action form in scope as
    second.jsp is rendering. This is because the action raised by
    second.jsp is actionB, which has no form, and hence no {actionForm}.
    You have two options:
    Option A - use page inputs (available in the upcoming Service Pack 2)
    ---- JSP:
    <%-- At the top of your second JSP... --%>
    <netui-data:declarePageInput name="myPageInput" type="APageInput"/>
    <netui:label value="{pageInput.myPageInput.name}"/>
    ---- JPF:
    * @jpf:action
    * @jpf:forward name="success" path="second.jsp"
    protected Forward actionA(FooForm form)
    APageInput input = new APageInput(form.getName());
    return new Forward("success", "myPageInput", input);
    Option B - since the form is still technically in the request, use it as
    a workaround until option A is available to you.
    <netui:label value="{request.fooForm.name}"/>
    I hope this helps.
    Thomas
    Eddie O'Neil wrote:
    Cassy--
    Is there a <netui:form> tag on the page which displays this error
    (pageB.jsp?)?
    The "actionForm" binding context can only be used inside of a
    <netui:form> tag. To display data in a read-only page (no form), you
    can put the data in the request and reference it with the "request"
    binding context.
    Hope that helps...
    Eddie
    cassy wrote:
    hi,
    refer to above question, i had follow the sample found at weblogic
    sample application
    ,but unfortunately when i create my own application. The following
    error occur:
    [Caught exception when evaluating expression '{actionForm.note}' with
    available
    binding contexts [currentTag, session, pageContext, request, response,
    application].
    Root exception cause:
    com.bea.wlw.netui.script.xscript.IllegalContextStateException:
    The action form for the expression "actionForm["note"]" could not be
    found
    can anymore tell me what has i miss !
    {program flow -
    pageA.jsp[userinput] ->getConfirmationAction-> pageB.jsp[confirmation]
    -> protected Forward
    getConfirmation(TransferBean
    form) throws Exception
    return new Forward( "show_confimation" ,form);
    thanks & rgds
    cassy

  • Using JSP-Beans in Apache

    Hi all!
    I'm trying to deploy a jsp page in Tomcat 4.1.19. This page uses Java Beans to set and get various properties. I've put the class file of Java Bean in WEB-INF/classes directory and jsp page in Dir root. But whenever I run the jsp page it shows error page saying the bean name as unresolved symbol.
    Please tell me the steps that are involved in setting up a Java Bean for jsp in tomcat and also if any special lines are needed to be added to Deployment Descriptor.
    Thanx
    Varun

    sorry for tha :) maybe my english sucks to much...
    here's what sun says:
    "Note: In the section JSP Scripting Elements we mentioned that you must import any classes and packages used by a JSP page. This rule is slightly altered if the class is only referenced by useBean elements. In these cases,
    ---***you must only import the class if the class is in the unnamed package***---.
    For example, in What Is a JSP Page? (page 246), the page index.jsp imports the MyLocales class. However, in the Duke's Bookstore example, all classes are contained in packages and thus are not explicitly imported."
    as mentioned here:
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPBeans4.html#64054

  • How to use a webservice in  JSPDyn page

    hai,
       I have created one webservices but i donot how to use that webservices in JSPDyn page.
      can anyone give solution for this problem
    Rds
    Shanthakumar

    Check out the Axis user's guide at: http://ws.apache.org/axis/java/user-guide.html

  • 2 JSPDyn Pages

    Hi @ all!
    I'm trying to create a small portal application consisting of more than one JSPDyn Page.
    At the moment I have:
    -    2 JSPDynPages
    -    2 .jsp files
    -    1 Bean for communication
    Under certain conditions (successful login) I want to call another (second) JSPDynPage. But I don't know how...
    with:
    this.setJspName("CFR_logon.jsp");
    I get to the next .jsp file. But this file wants to use
    EventHandlerMethods of the first JSPDynPage. It does not
    search the method in the second JSPDynPage...
    Thank you! Regards, Christian

    Yes, You are right.
    SAP implemented a special Session, Request, Application/Context Object Model.
    If You store Your bean in a (so called) SAP component... Object. It is only valid for the actuall iView.
    So You have to store Your bean in the (normal) "J2EE" Session, Request, Application/Context Object. this can be read from all iViews.
    JSPDynPage;
    componentRequest = (IPortalComponentRequest) getRequest();          
    componentSession = componentRequest.getComponentSession();
    request = componentRequest.getServletRequest();
    session = componentSession.getHttpSession();
    session.setAttribute("myBean", myBean); // Storing the Bean in the J2EE Session
    TAKE CARE!!
    If You use the J2EE Session... You can't use the JSP Taglib for getting the Bean out of the Session. You have to initialize the objects like this:
    <%
    request = componentRequest.getServletRequest();
    %>
    Try it
    Walter

  • Open Jasper Report in new page using servlet

    Guys,
    Looks very simple but i am having problem making this process work. I am using 11.1.1.4
    This is my use case:
    - From a employee page, user clicks on a menu item to open report for current employee. I need to pass appropriate report parameters to servlet and open report into new page.
    I can successfully call servlet using commandmenuitem and set request parameters and call servlet from backing bean.... but that doesn't open report in a new page.... any way i can do this?
    Another option i tried was that using gomenuitem and setting target=blank but in that case i need to pass the parameter using servlet url which i like to avoid.(in case i need to pass many parameters in future) (also values will be set on page so i need to generate url when then click the menuitem...... so there are some hoops and loops i need to go through) I don't know a way to pass the request parameter using backing bean to servlet... i don't think it is possible.
    Those are the two approaches i tried.
    If you have any better approach...I would appreciate if you can let me know. (i have searched on internet for two days now.... for the solution)
    -R
    Edited by: polo on Dec 13, 2011 7:22 AM

    Hi,
    Hope following will useful
    http://sameh-nassar.blogspot.com/2009/10/using-jasper-reports-with-jdeveloper.html
    http://www.gebs.ro/blog/oracle/jasper-reports-in-adf/

  • How can i design a EJB application using session Beans?

    Hello,
    I am designing a Find application using EJB. Here a user is prompted a search page, where he can enter the search criteria's. Then on click of submit, the query is formed at the server side depending on what criteria's were selected. Then a jdbc query is performed and the results are returned back to the user. Here no session is maintained for the users. Can anyone suggest me how to design this application using EJB. Should i use entity beans for this or session beans will suffice? Should the jdbc query be performed in the bean itself or should it be outside in a helper class? Please kindlu suggest me the design for this application...
    Regards,
    Subbu

    Hi,
    First of all, I'm unable to figure out why you need to use EJB for this scenario. You can write a helper class to frame and execute the query.
    If you really want to use EJB, then I suggest you use a stateless Session Bean with transaction attribute as TX_NOT_SUPPORTED. From the session bean, you can call the helper class. But, by avoiding the session bean, you can eliminate remote calls, thus improving your performance. Also, check if the database & the db driver you are using supports sql caching.
    Regards,
    Raj.

  • How do I use a bean to determine which message bundle value to use?

    Is there a way to use a bean to determine which message from my message bundle I use? I want to be able to call my bean in JSF/JSP page, have the bean return a String, and use that String to pick a message from my message bundle properties file. Now I can do this:
    <h:outputText value="#{bundle.messageA}" />or this:
    <h:outputText value="#{bean.messageName}" />where I have a method on the bean like this:
    public String getMessageName(){
         if(someTest == true){
              return "messageA";
         } else {
              return "messageB";
    }I want to combine the two so my bean determines which message I pick. I want to do this because I want to keep all the text a user sees in the message bundle file. However, based on the state of the bean, I want to display different messages.
    Thanks in advance,

    Ah this way. So you want that much of nasty if statements in the bean instead? ;)
    Then make use of the fact that you also can access Map values using the brace notation. E.g.
    <h:outputText value="#{bundle[bean.messageKey]}"/>Where getMessageKey() returns the message key, e.g. 'messageA' or 'messageB' and so on.

  • Problem using a bean in JSP on Tomcat 5.0.28

    Hi,
    I'm new to JSP, I've installed Tomcat 5.0.28 and I'm able to run JSP but when I try an asp wich uses a bean it gives me this error, the directory structure is
    testingProject with the first.jsp
    testingProject\WEB-INF\classes\myPackage with the test.class
    the first.asp
    <%@ page import="myPackage.Test" %>
    <html><head><title>Test</title></head>
    <body bgcolor=white>
    <jsp:useBean id="list" class="myPackage.Test"> </jsp:useBean>
    <jsp:getProperty name="list" property="value1" />
    <%=list.value1%>
    <p>
    </body></html>
    the Test.java
    package myPackage;
    public class Test{
    String value1="testinggggggggg";
    public void Test(){
    public String getValue1(){ return value1}
    the error
    thanks in advance
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 6 in the jsp file: /first.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 5.0\work\Catalina\localhost\testingProject\org\apache\jsp\first_jsp.java:60: cannot resolve symbol
    symbol : variable value1
    location: class myPackage.Test
    out.print(list.value1);
    ^
    1 error
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)

    There are two ways of getting info from the bean.
    1) the jsp:getProperty tag, which seems correct in your code
    2) the <%= ... tag. In that case you must write a valid java expression. In your case: list.getValue1()

  • Difference between Abstract portal Component and JSPDyn page.

    Hi Experts,
    What is the difference between Abstract portal Component and JSPDyn page.
    Thanks,
    Jay.

    Hi,
    The PDK provides two methods for creating a portal component:
    Abstract Portal Component
    The Abstract Portal Component class offers a lean method for writing HTML commands to the Web client as well as for basic event handling. It is an implementation of the IPortalComponent, which is the central abstraction of the Portal Component API.
    DynPage
    The Page Processor Component, which extends the Abstract Portal Component, returns a DynPage. It provides more sophisticated event handling. Controls that produce events (such as buttons and checkboxes) have an event attribute that contains the name of the event handling method. This event handling method is invoked by the DynPage when it occurs.
    The JSPDynPage is an implementation of the DynPage and allows the use of the DynPage in combination with JSP (Java Server Pages).
    The PDK documentation and examples focus on the DynPage. Easier event handling and the separatation of content development (JSP) from application development (Java) make the DynPage a better choice for components with interaction and changing content.
    For more details, Refer thes thread,
    https://fortress.wa.gov/dop/portal/irj/portalapps/com.sap.portal.pdk.basic.portalcomponentimplementation/docs/jspdynpage.html
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0b3e9d5-b2af-2a10-20ba-9f6ce6b1a27f
    Hop it helps..
    GS
    Edited by: Sathishkumar GS on Apr 14, 2008 2:07 PM

  • Error in Java based iView when trying to use J2EE bean

    I am trying to create a iView based on Java Portal app.
    [Java portal app has dynPage based Portal App Object]
    I created a PAR and uploaded to Portal. I created iView and worked it fine in (preview).
    [iView created using "Content Administration -> Portal Content -> New From Par -> iView"]
    I deleted my iView and removed my archive (using "Java Developer -> Portal Archive Deployer/Remover").
    I changed java portal project so that I can reference a bean from J2EE app already deployed on server.
    [Edited Portalapp.xml to add a
        <property name="PrivateSharingReference" value="SAPJ2EE::service:p4, SAPJ2EE::test.myApp/myBean"/>
    This time PAR installs fine, but when I try to preview iView, get following error.
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    com/sapportals/portal/htmlb/page/PageProcessorComponent.
    Exception id: 02:36_11/08/05_0016_4991450
    See the details for the exception ID in the log file
    I removed "SAPJ2EE::test.myApp/myBean" from portalapp.xml and rebuilt PAR and rebuilt iView but I get same error as above.
    1. Where are logs located (for iView errors)?
    2. Any pointers on using J2EE bean? (I am trying to use step described in topic  "J2EE Applications Access from Portal Applications" from manuals).
    3. Do I need to reference any additional libraries to use p4?
    Thanks.

    The problem seems to be in portalapp.xml
    I created second PrivateSharingReference in it
    <property name="PrivateSharingReference" value="com.sap.portal.htmlb">
    <property name="PrivateSharingReference" value=" SAPJ2EE::service:p4, SAPJ2EE::test.myApp/myBean"/>
    I changed to be one entry only like
    <property name="PrivateSharingReference" value="com.sap.portal.htmlb, SAPJ2EE::service:p4, SAPJ2EE::test.myApp/myBean"/>
    Now iView works again....But still donot know where log is..

  • Posting huge data on to JSP page using JSTL tags

    Hi,
    I have one application where I have to post huge data (approximately 2000 rows of data) into JSP page. I am using JSTL tags and running on Tomcat 5.
    It is taking almost 20 to 25 seconds to load the entire page.
    Is it the optimal time to load or it could be improved?
    Please let me know.
    Thanks,
    --Subbu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Evnafets,
    Thank you for the response.
    Here are the tasks I am doing to display the data on JSP.
    0. We are running on Tomcat 5 and the memory size is 1024MB (1GB).
    1. Getting the data - I am not performing any database queries. The data is stored in the static cache memory. So the server side response is so quick - less than a milli second.
    2. Using Java beans to pass data to the presentation layer (JSP).
    3. 10 'if' conditions and 2 'for' loops and 2 'choose' statements are being used in the JSP page while displaying the data.
    4. Along with the above, there are 4 javascript files are being used.
    5. The jsp file size after rendering the data, is aprox. 160 kb
    Hope this information helps you to understand the problem.
    Thanks,
    --Subbu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using java bean with jsp

    hello friends,
    i'm new to jsp. i want to create an html form that accepts username and a value from four radio buttons and display back the entered name and checked radio button's value using java bean.
    i use the <jsp:setProperty id="" property="*"> method. i don't know how to access the radio buttons value from the html.
    also when i use an additional field other than username the jsp page is showing error.
    Please give me the correct method to use java bean with jsp in this circumstance.
    thank you.

    thank you, but i have a problem left. the case is like this.
    i got the jsp and bean worked fine when i have a sinle input text field.
    but when i added a second text field i recieved the following error.
    javax.servlet.ServletException: basket.newbean.getUserPass()Ljava/lang/String;
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.newform.process_jsp._jspService(process_jsp.java:69)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    where userPass is the new form element. I have made the subsequent chanes in my bean program and jsp file.
    pls hlp.

  • Using BI Bean in JSP

    Hi,
    Can anyone please provider some pointers on using BIBeans in a JSP page. There are few options in my knowledge.
    1)Using BI-Beans API for writing our own JSP tags.
    2)In Jdev(10g) there seems to be some support for Graphs through ADF.
    3)JSP and UIX tags provided BI-Graph beans.
    thanks
    Rahul

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

Maybe you are looking for

  • Not able to post material

    Hi, I am not able to post material in  MB1C.I am getting error,"posting only possible in periods 2002/11 and 2002/10 in company code ZVAN".  I have already done,OMS2 and OMS2.

  • OS X freezes when hard drive goes to sleep

    So i have been virtually PC free for about a year now and I am absolutely loving it. I love it so much I use my 12 inch iBook all of the time. It is run constantly as I am an open source developer and I do a lot of coding. Anyways, about 2 weeks ago

  • Facetime not working since upgrading to IOS6

    My facetime doesn't connect to any contacts since  upgrading to IOS6

  • How to create a Transaction code for a Report Painter Report

    Hi All, Can any one let me know the procedure as to how to create a t-code for a user defined PCA report. I have created a PCA report (copied the existing report (8a26-001) and named it as zpca and assigned the same in a new Report Group ZPCA (the gr

  • Downgrade firmware of 4.2.1 2G Ipod Touch to 4.1?

    I have an Ipod touch 2G on 4.2.1 firmware.  How can I downgrade it to 4.1 firmware?  I don't care if its legit or not, just as long as it works.