My portlet displays a form at the end of there is a 'calculate' button. After the form is submitted, the result of the calculation is shown. Let's further assume I don't want ajax here, not all of the time at least.
The problem is now that the whole page is reloaded when pressing the submit/calculate button. The new page is shown on top of it, meaning the horizontal scrollbar position is on top. My portlet might as well be farther down the page and not initially become visible.
My suggestion is to add what I'd refer to as anchor to the action url of the form so that the browser knowns more specifically which part of the next page to show.
as an example, instead of
http://localhost:8080/whatever
the url would be
http://localhost:8080/whatever#portletnamespace_myform
Inside the result HTML page there is a following tag:
<a name="portletnamespace_myform"></a>
This invisble anchor will then be shown on top of the browser window or the scrollbar would be at bottom most.
I already have the solution working. In fact, it was quite easy but it required to change portletfaces bridge impl.
-> Does anyone have another idea how to elegantly solve the original problem?
-> Would it be of common interest to share this tiny extension into sources?
BTW: I still don't fully understand how to build urls with JSF that have anchors (#). Whereas <f:param> tags go into the query string and there can be many of them, I haven't heared so far of anything such to define the #-part. I you ever have done this, I'd be happy to learn how. For me it does not work to append it to the view id.
Por favor, faça login para denunciar.