cancel
Showing results for 
Search instead for 
Did you mean: 

Page refreshing after HTMLB event

Former Member
0 Kudos

1. I have dynpage, e.g. url - .../prtroot/com.mycomponent

2. I fire HTMLB event - button press.

3. After handling event browser contains url - .../prteventname/HtmlbEvent/prtroot/com.mycomponent

That is why, after page Refresh (from browser popup menu) event fired second time.

I think, this problem can be solved by using page redirection. I.e. after handling event - send redirect to base page. But I didn't know, how to solve problem correcly.

Please, help.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Guys!

Thanks a lot for your answers, but you talk about another things. In both cases (before and after button click) I need to display the same page. Problem is that in the second case (i.e. then I already clicked to button and page refreshed) then I clicking to browser Refresh button, it trying to send POST data again to server. I don't want browser to send POST data then I clicking refresh button, I want just to refresh page.

Form is working in infinite loop:

1. User entering data and posting it to server

2. Page refreshing and resetting all data in input fields

At the moment problem occurring at the second step, when page should be refreshed. During refresh browser trying to send data to server again. But I just want to refresh page.

I hope now its clear.

Former Member
0 Kudos

hi egor,

so far i understood is u want to fill one jsp and set the same data to that jsp . for that requirement if you use htmlb u can simply write code like this

type="submit".... onClick="someMethod"

http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/e0a341354ca309e10000000a155106/frameset.htm

refer this example..

and if you dont want to use htmlb you have to write java script to handle the button event. onClick only works with htmlb..

IPortalRequestEvent event = componentRequest.createRequestEvent("jca");

// create component URI

IPortalComponentURI uri = componentRequest.createPortalComponentURI();

uri.setPortalRequestEvent(event);

String action = uri.toString();

this code is used to call the method in jspDynPage that is for hadling button events.

hope this will help..

regards..

rajesh

Former Member
0 Kudos

Hi Egor,

Why do u want to refresh the browser with Refresh button? Refreshing automatically happens after u click on the button. Browser refreshing by default performs the last event again. Since u have submitted the form to the server on clicking the button, refreshing will redo the same.

U can write the logic to clear or save the data in the htmlb components in the form. to clear data from all the inputfields or dropdowns, write code in the onClick method of the button itself(in case u r not binding the htmlb component with any bean object). If u want the data to be present after button is clicked, use bean and bind it to the htmlb component.

Hope this helps.

Regards,

Harini S

Former Member
0 Kudos

Morning!

First of all, I don't use JSP, it’s just a simple Dynpage, based on HTMLB.

Ok, I'll try to make things clear. Step by step I'll describe the things happening inside my component. After that I'll describe the problem.

1. Component showing

2. User entering data and clicking "Save" button, data delivering to server

3. Component automatically refreshing and input fields are resetting

4. At the moment we are at the following URL: /irj/servlet/prt/portal/<b>prteventname/HtmlbEvent</b>/prtroot/com.company.Component

5. Now user can enter new data to input field and make post it server. No problems.

But, except input fields, component showing different information, which can be changed externally - by other components. After data changed, such external component calling refresh function of the my component (by JavaScript functions).

The problem is then external component trying to refresh the component, browser trying to post data to server again. This is not a problem - I know workaround, the problem is browser shows to user a message box "Do you want to send a POST data to server again?". I just don't want to user see this message box!

I know that I can solve my problem by redirecting user to source page of my component (request.createPortalComponentURI().toString()), in this case page refreshing will not caused data posting to server.

I don't know how to make such redirection right after event. I suppose I need to add some redirection code to onClick event of inside my component.

I hope, my situation is clear now.

detlev_beutner
Active Contributor
0 Kudos

Hi Egor,

> hope, my situation is clear now

I have to admit - it is not, at least not for me.

Anyhow, I will try to guess what could be a workaround for you. I think the main problem is that you are refreshing the URL. That for example would work in any case if you put the component as an iView within the portal framework, embedded (and not URL isolated). So I think you approach is alreay wrong.

If this "refreshing" event is called by another component (via EPCF?), why not submitting your form again, using for example the button you are already using plus some hidden input field ("refresh=true"), so that now it is a submit of your form to the server, signalling that the roundtrip is for refreshing reasons?!

Hope it helps

Detlev

Former Member
0 Kudos

Hi Egor,

Redirection can solve the problem if used inside doProcessBeforeOutput since after any event, it is called and hence refreshing takes place. You can use redirection in the doProcessBeforeOutput by setting some constants. Say first time, i=0. After first time, i++ is done. Hereafter u can redirect to some other page.

doProcessBeforeOutput(){

i=0;

if(i==0){

first page

i++;

}

else

page to be redirected

}

Regards,

Harini S

Former Member
0 Kudos

HI,

Put the post data you want to send to the server in the button click event, so that it is not triggered on page loading.

If you put the post logic in doProcessBeforeOutput it will be called when the page loads.

Message was edited by: Kirupanand Venkatapathi