cancel
Showing results for 
Search instead for 
Did you mean: 

jspdynpages communication problem

Former Member
0 Kudos

Hi,

I have some problem with comunication between two jsp pages using bean.

i fullfill exactly what has been written in one tutorial, but maybe something is still not ok, because the data is not passed, and no error is returned.

Maybe i haven't set something in portalapp.xml?

or else...

If someone can tell me/help me, what are the most important points of setting the things, so it to work.

Thank you in advance

BR

Diana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Diana,

If you want to navigate from one JSP to another JSP then give "blank" for the value property under Component Config.

eg:

<component-config>

<property name="ClassName" value="com.intelli.DropDownComp"/>

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

<property name="JSP" value="pagelet/DropDown.jsp"/>

</component-config>

Regards,

Jhansi

Former Member
0 Kudos

Hi Jhansi,

i did what u say, and it give me error:

<b>Portal Runtime Error

An exception occurred while processing a request for :
iView : pcd:portal_content/MyFolder/Task_Comminication_PassingParams_Events/JSPCommunicationBean/processform/processForm
Component name : JspDynComp.processForm

The exception has been logged. Please inform your system administrator.
Exception id: 11:06_16/04/07_0001_7571650
See the details for the exception ID in the log file</b>

Would u be able to give advice about this error?

thank you in advance.

BR

Diana

Answers (4)

Answers (4)

Former Member
0 Kudos

hi all,

i just see that, when is loaded the iview for first time: it is this url in the browser:

http://localhost:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2f

MyFolder!2fTask_Comminication_PassingParams_Events!2fJSPCommunicationBean!2fprocessform

and when i click the button it is this:

http://localhost:50000/irj/servlet/prt/portal/prttarget/processForm/prteventname/HtmlbEvent/prtroot/...

MyFolder!2fTask_Comminication_PassingParams_Events!2fJSPCommunicationBean!2fprocessform

it seems strange, isn' it?

BR

Diana

Former Member
0 Kudos

hi ,

it seems, that there is some communication problem, it doesn't go at all to the second page. when i click the button it again in the same page.

But i don't know what is this communication problem?

BR

Diana

Former Member
0 Kudos

Diana,

Have you mentioned JSP file name in portal.xml file, like in above Jhansi has mentioned.

Just mention in portal.xml as follows

<property name="result" value="pagelet/Result.jsp"/>

regards

Anil

Former Member
0 Kudos

hi Anil,

thank you for help, i did it, but when i click the button it shows me the error,that i showed above. And if i am not removing "jspnative" , it application goes direct to the second page, instead of the first page.

I wonder, what's wrong

BR

Diana

Former Member
0 Kudos

Diana,

I think you need to clear your browser cache.

regards

Anil Dichpally

fyi; you have given points to wrong person.

Former Member
0 Kudos

Diana Dimitrova ,

Diana there are fre configuration settings and jar files to be in included to do before running JSP Dyn Pages.

Configuring NWDS:

1) Select the menu Window --> Preferences --> SAP Enterprise Portal.

2) Choose Add, and specify the properties of the portal.

3) If you want to store the password, choose Yes, I want to remember passwords for deployment. But it is recommended not to check that, it’s better to enter password each time you deploy the project.

4) If you want to set this portal installation as the default for deployment, select the checkbox in the Default field of the configuration list.

5) Click Apply.

Apart from above settings you need to set the Workbench Settings:

1) Select the menu Window -> Preferences -> Workbench

2) Choose Proxy Settings and disable the Use a Proxy Server checkbox.

Since we are developing this Application in JSP Dyn pages we need few Jar files

like htmlb_api.jar &#61664; For HTML Business Tags for java.

To Add jar’s

1) Open the project context menu and choose Properties ® Java Build Path.

2) Choose the Libraries tag.

3) Choose Add External JARs… and browse to the location of the file.

4) Usually the jar files are available in SAPIDEIDE70eclipseplugins

try above things and please let me know the status after executing the application.

regards

Anil Dichpally

Message was edited by:

Anil Dichpally

Former Member
0 Kudos

Hi Diana,

Let me know what kind of error message you are getting.

Provide the code you have written.

Bala

Former Member
0 Kudos

hi Bala,

there is no error show in the variant of the code that i will show u now, but just the communication doesn't work.

that's the code.


processForm.java

package com.sap.workshop;

import bean.DynPageNameBean;
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 processForm extends PageProcessorComponent {

  public DynPage getPage(){
    return new processFormDynPage();
  }

  public static class processFormDynPage extends JSPDynPage{
  
    private DynPageNameBean myNameContainer = null;
    private final static int INITIAL_STATE = 0;
    private final static int WELCOME_STATE = 1;
    private int state;
    private String fname;
    private String lname;
    private String email;
  
    public processFormDynPage()
    {
    	this.setTitle("Become a Jedi");
    }
    public void doInitialization(){
//      IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();
//      Object o = profile.getValue("UserNameBean");
//      if(o==null || !(o instanceof DynPageNameBean)){
//		myNameContainer = new DynPageNameBean();
//
//		myNameContainer.setFirstName(fname);
//		myNameContainer.setLastName(lname);
//		myNameContainer.setEmail(email);
//        profile.putValue("UserNameBean", myNameContainer);
//      } else {
//		myNameContainer = (DynPageNameBean) o;
//      }    
      state = INITIAL_STATE;
      // fill your bean with data here...
    }

    public void doProcessAfterInput() throws PageException {
    	InputField myFirstName =(InputField) getComponentByName("FirstName");
    	this.fname = myFirstName.getValue().toString();
    	
		InputField myLastName =(InputField) getComponentByName("LastName");
		this.lname = myLastName.getValue().toString();
		
		InputField myEmail =(InputField) getComponentByName("Email");
		this.email = myEmail.getValue().toString();    	
    	
    	IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();
    	IPortalComponentContext myContext = request.getComponentContext();
    	IPortalComponentProfile myProfile = myContext.getProfile();
    	
    	//DynPageNameBean myNameContainer = new DynPageNameBean();
		myNameContainer = new DynPageNameBean();
   		myNameContainer.setFirstName(fname);
   		myNameContainer.setLastName(lname);
   		myNameContainer.setEmail(email);
		myProfile.putValue("UserNameBean", myNameContainer);
    	
    	
    }

    public void doProcessBeforeOutput() throws PageException {
      switch (state)
      {
      	case WELCOME_STATE:
      		this.setJspName("Result.jsp");
      		break;
      	default:
      		this.setJspName("Form.jsp");
      		break;
      }
    }
    
    public void onSendButtonClicked(Event event) throws PageException{
    	state = WELCOME_STATE;
    }
  }
}
-----------------------------------------------------------------------------------------------------
portalapp.xml

<?xml version="1.0" encoding="utf-8"?>
<application>
  <application-config>
    <property name="SharingReference" value="com.sap.portal.htmlb"/>
  </application-config>
  <components>
    <component name="processForm">
      <component-config>
        <property name="ClassName" value="com.sap.workshop.processForm"/>
        <property name="ComponentType" value="jspnative"/>
        <property name="JSP" value="pagelet/Form.jsp"/>
      </component-config>
      <component-profile>
        <property name="ServicesReference" value="htmlb"/>
        <property name="ClassName" value="com.sap.workshop.processForm"/>
        <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
      </component-profile>
    </component>
  </components>
  <services/>
</application>
----------------------------------------------------------------------------------------------

Form.jsp

<%@ taglib uri= "tagLib" prefix="hbj" %>
<jsp:useBean id="UserNameBean" scope="application" class="bean.DynPageNameBean" />
<hbj:content id="myContext" >
  <hbj:page title="An easy start">
   <hbj:form id="myFormId" >
		
		<hbj:textView id="welcome_message" design="Header1" text="Please enter the following information:" />
		<hbj:gridLayout>
			<hbj:gridLayoutCell rowIndex="1" columnIndex="1">
				<hbj:label id="label_FirstName" required="TRUE" text="First Name" design="LABEL" labelFor="FirstName" />
			</hbj:gridLayoutCell>
			<hbj:gridLayoutCell rowIndex="1" columnIndex="2">
				<hbj:inputField id="FirstName" type="string" maxlength="100" />
			</hbj:gridLayoutCell>
			
			<hbj:gridLayoutCell rowIndex="2" columnIndex="1">
				<hbj:label id="label_LastName" required="TRUE" text="Last Name" design="LABEL" labelFor="LastName" />
			</hbj:gridLayoutCell>
			<hbj:gridLayoutCell rowIndex="2" columnIndex="2">
				<hbj:inputField id="LastName" type="string" maxlength="100" />
			</hbj:gridLayoutCell>
			
			<hbj:gridLayoutCell rowIndex="3" columnIndex="1">
				<hbj:label id="label_EmailName" required="TRUE" text="Email Name" design="LABEL" labelFor="EmailName" />
			</hbj:gridLayoutCell>
			<hbj:gridLayoutCell rowIndex="3" columnIndex="2">
				<hbj:inputField id="EmailName" type="string" maxlength="100" />
			</hbj:gridLayoutCell>
				
		</hbj:gridLayout>
		
		<hbj:button id="Send_Button" 
			text="Send" 
			onClick="sendButtonClicked" 
			tooltip="Submit" 
			width="100" 
			design="EMPHASIZED" >
		</hbj:button>
		
   </hbj:form>
  </hbj:page>
</hbj:content>
----------------------------------------------------------------------------------
Result.jsp

<%@ taglib uri= "tagLib" prefix="hbj" %>
<hbj:content id="myContext" >
  <hbj:page title="Successful processing">
  <jsp:useBean id="UserNameBean" scope="application" class="bean.DynPageNameBean" />
  
   <hbj:form id="myFormId" >
		<hbj:textView text="You have entered the following information" design="header1" /><br>
		<br>
		
		<hbj:textView text="Your First Name: " design="standart" />
		<hbj:textView text="<%=UserNameBean.getFirstName()%>" design="standart" /><br>
   
   		<hbj:textView text="Your Last Name: " design="standart" />
		<hbj:textView text="<%=UserNameBean.getLastName()%>" design="standart" /><br>
  
   		<hbj:textView text="Your Email: " design="standart" />
		<hbj:textView text="<%=UserNameBean.getEmail()%>" design="standart" /><br>
  
   </hbj:form>
  </hbj:page>
</hbj:content>


BR

Diana