Skip to Content
author's profile photo Former Member
Former Member

Cannot get simple JSPDynPage to WORK :(

Hi,

I've been struggling with JSPDynpages for a little while now. Basically I just want some sort of semblance to the classical J2EE structure where I click a button and I go on to my next JSP. Here is my JSPDynPage code:

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 testForm extends PageProcessorComponent {

public DynPage getPage(){

return new testFormDynPage();

}

public static class testFormDynPage extends JSPDynPage{

private static int INITIAL_STATE=0;

private static int NEXT_STATE = 1;

public int state = INITIAL_STATE;

public void doInitialization(){

}

public void doProcessAfterInput() throws PageException {

}

public void doProcessBeforeOutput() throws PageException {

if (state == INITIAL_STATE) {

this.setJspName("testForm.jsp");

}

else {

this.setJspName("testForm2.jsp");

}

}

public void onClick(Event event) throws PageException {

state = NEXT_STATE;

}

}

}

Here is testform.jsp:

<%@ taglib uri= "tagLib" prefix="hbj" %>

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId"

method="POST"

action="./testForm2.jsp"

target="_blank">

Press this button to go to the next JSP.

<hbj:button id="formButton"

text="OK"

design="EMPHASIZED"

onClick="onClick"

width="100"

>

<% myFormId.setDefaultButton(formButton); %>

</hbj:button>

</hbj:form>

</hbj:page>

</hbj:content>

And here is testForm2.jsp:

<%@ taglib uri= "tagLib" prefix="hbj" %>

<hbj:content id="myContext2" >

<hbj:page title="PageTitle2">

<hbj:form id="myFormId2" >

This is the next JSP.

</hbj:form>

</hbj:page>

</hbj:content>

Both JSPs reside in the pagelet folder of my PAR. I've created an iView from the PAR by selecting "New From Par" in the Content Studio of EP6. When I preview the iView, I see the first formTest.jsp. When I click the button, I expect to be fowarded to formTest2.jsp but instead another window opens with formTest.jsp (since i have target=_blank).

What am I missing?

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2005 at 11:19 PM

    Hi Vu,

    remove "method, action, target" in <hbj:form> just have <hbj:form id="myFormId" > try with the same program. Are u trying to view from content studio? Try deploying it in portal using Component Manger, and run the iview from Conponent Inspector.

    Thanks,

    Praveen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2005 at 04:50 PM

    Hi Vu,

    Life cycle of PageProcessorComponent .

    when your class testForm is invoked , first time doInitialization (this will called only once) is executed followed by doProcessBeforeOuput.In this method you can call the firstJSP(testForm) page to be dispalyed. In that JSP for FORM control you dont need to specify any property like action or method. instead say onclick = "submit" for Button control which will call the doProcessAfterInput followed by OnSubmit method where the state is changed and followed by doProcessBeforeOuput where the state is checked and directed to the corresponding JSP.

    Hope this helps.

    Sujatha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2005 at 06:53 PM

    Hi Praveen,

    Ok, I'm reverting back to a simple example that still doesn't work for me. It's the JSPDynPage Example that prints out "May the force be with you..."

    I get null values in the first and second JSP. It seems like the bean is just not communicating with the JSP. I have copied exactly what the example code has. I build my project in NWDS and then deploy via NWDS. I then go to the Content Studio and select new from Par and create a new iView to launch my DynPage.

    When I click the button , I get, "The force is with you null".

    Without this fundamental communication working, I cannot move on.

    Thanks!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2005 at 06:19 AM

    I had a problem with the jsp not talking to the bean. When you create a JSPDynPage with NWDS it always puts in the jspnative line. To resolve it I removed the line

    <property name="ComponentType" value="jspnative"/>

    from the portal-app.xml file.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hey Warren!

      This is the answer to the problem that I have been struggling with all afternoon! If I could, I would reward you!

      Vu, I think you need to award this guy, please.

      Thanks a mil!

      Martin

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.