How to add the ability to put EL expressions in Navigation Rules
I had a need to dynamically determine what page to return to in a JSF application. There has to be an easier way, but here's how I wanted to do it. I wanted to put an EL expression in my <to-view-id> nav rules in the JSF config file (e.g. faces-config.xml). This isn't allowed. So I built my own custom ViewHandler to do it.
1) Define the ViewHandler in faces-config.xml:
<application>
<view-handler>com.msd.tts.pluggable.MyDynamicViewHandler</view-handler>
</application>2) Create the class:
package com.msd.tts.pluggable;
import java.io.IOException;
import java.util.Locale;
import javax.faces.*;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.*;
import javax.faces.el.ValueBinding;
import com.sun.faces.util.Util;
* Adds ability to put EL expressions in the <to-view-id> Navigation Rules in JSF
* configuration file (faces-config.xml).
* @author Craig Peters
* @version 1.0
public class MyDynamicViewHandler extends ViewHandler {
* The original handler we are customizing.
private ViewHandler prevHandler = null;
/** Creates a new instance of MappingViewHandler. By including
* a parameter of the same type, we encourage the JSF framework
* to pass a reference of the previously used ViewHandler. This way
* we can use all the previous functionality and override only the
* method we are interested in (in this case, the getActionURL() method).
public MyDynamicViewHandler(ViewHandler prevHandler) {
this.prevHandler = prevHandler;
@Override
public String getActionURL(FacesContext context, String viewId) {
return prevHandler.getActionURL(context, viewId);
@Override
public Locale calculateLocale(FacesContext context) {
return prevHandler.calculateLocale(context);
@Override
public String calculateRenderKitId(FacesContext context) {
return prevHandler.calculateRenderKitId(context);
@Override
public UIViewRoot createView(FacesContext context, String viewId) {
return prevHandler.createView(context, viewId);
@Override
public String getResourceURL(FacesContext context, String path) {
return prevHandler.getResourceURL(context, path);
@Override
public void renderView(FacesContext context, UIViewRoot viewToRender)
throws IOException, FacesException {
String result = viewToRender.getViewId();
if (Util.isVBExpression(viewToRender.getViewId())) {
ValueBinding vb = context.getApplication().createValueBinding(viewToRender.getViewId());
result = vb.getValue(context).toString();
if (result.charAt(0) != '/')
throw new IllegalArgumentException("Illegal view ID " + result + ". The ID must begin with '/'");
viewToRender.setViewId(result);
prevHandler.renderView(context, viewToRender);
@Override
public UIViewRoot restoreView(FacesContext context, String viewId) {
return prevHandler.restoreView(context, viewId);
@Override
public void writeState(FacesContext context) throws IOException {
prevHandler.writeState(context);
}3) Use EL in navigation rules:
<navigation-rule>
<from-view-id>/CommonForm.jsp</from-view-id>
<navigation-case>
<to-view-id>#{bean.caller}</to-view-id>
</navigation-case>
</navigation-rule>The "bean.caller" method will have saved the page to go back to.
Comments are welcome. I just didn't see any other way to dynamically go back to an arbitrary page.
Thanks.
CraigRPeters wrote:
Comments are welcome.Nice stuff. But that means that navigation is hardwired in the backing bean instead of faces-config.xml. Forget this comment if you've maintained a propertiesfile/configurationfile for that.
I just didn't see any other way to dynamically go back to an arbitrary page.You can declare more than one from-outcome and/or from-action for one from-view-id.
Similar Messages
-
I have suddenly lost the ability to put events in the calendar on my iPhone. I have rebooted twice and still nothing. Does anyone have a so,union for me?
iOS: Troubleshooting Mail
http://support.apple.com/kb/ts3899
Tap Safari and attempt to load a webpage (try any webpage). If you can load a webpage, then your device has Internet access. If you are unable to load a webpage, follow these troubleshooting steps.Try to use an alternate Internet connection if available:
Try a different Wi-Fi connection
If your iOS device has an active cellular data plan, tap Settings > Wi-Fiand turn off Wi-Fi.
If the affected email account is provided by your Internet provider, see if your issue is resolved while connected to your home Wi-Fi network.*
Log in to your email provider's website to ensure that the account is active and the password is correct.
Restart your iOS device.
Delete the affected email account from your device.
Tap Settings > Mail, Contacts, Calendars.
Choose the affected email account, then tap Delete Account.
Add your account again. -
How to add the date field in the dso and info cube
Hi all.
I am new to bi 7. in the earlier version v hav to button to add the date field. but in the bi 7 der is no option so can any body tell me how to add the date field in the data targets
Thanks & Regard
KKmy prob is solved
KK -
working in Work order report, this report has different level , for example
0 level transaction
1 level transaction
in subtotal don't want to add 0 level transaction,
when I did the sub total it added all the level , so in sub total amount double up because of that
how to add the expression so I can the level 0 take out from sub total , so it does not include in sub total
can some one please help me with this
thanks in advanceHi Simon_ Hou
I tried the expr the way you suggested , it did not work getting error message, the exp I added is below
this the expression I added on sub total where is highlighted in Yellow, under Cost amount column,
I really appreciate the help
=Sum(IIF(Fields!COLLECTREFLEVEL.Value=
"0",0,Fields!CostAMOUNT.Value),"DataSet1")
please see below my QUERY, can you please help and let me know what I did wrong in my exp
SELECT PRODTABLE.PRODID, PRODCALCTRANS.COSTGROUPID, PRODTABLE.QTYCALC, PRODTABLE.PRODSTATUS, PRODCALCTRANS.COSTAMOUNT,
PRODCALCTRANS.COSTMARKUP, PRODCALCTRANS.REALCOSTAMOUNT, PRODCALCTRANS.CALCTYPE, PRODTABLE.DATAAREAID, PRODCALCTRANS.KEY3,
PRODCALCTRANS.CONSUMPVARIABLE, PRODCALCTRANS.REALCONSUMP, PRODTABLE.ITEMID, PRODTABLE.SCHEDDATE, PRODTABLE.FINISHEDDATE,
PRODCALCTRANS.KEY1, PRODCALCTRANS.TRANSDATE, PRODCALCTRANS.QTY, PRODCALCTRANS.KEY2, PRODCALCTRANS.COLLECTREFLEVEL,
PRODCALCTRANS.LINENUM
FROM PRODTABLE INNER JOIN
PRODCALCTRANS ON PRODTABLE.PRODID = PRODCALCTRANS.PRODID AND PRODTABLE.DATAAREAID = PRODCALCTRANS.DATAAREAID
WHERE (PRODTABLE.PRODSTATUS = 7) AND (PRODTABLE.DATAAREAID = N'AR1') AND (PRODTABLE.ITEMID = @itemid) AND
(PRODTABLE.FINISHEDDATE >= @Paramfromdate) AND (PRODTABLE.FINISHEDDATE <= @Paramtodate) -
How to add the Match code object for the requisitioner field in TCODE ME51N
Hi,
How to add the search help (Match code object) for the requisitioner field in transaction ME51N.
Please do the needful to me.
Regards
Rajeshdon't you think that posting your question to a microsoft developer site would be more efficient?
regards,
anton -
How to add the entries and how to delete the entries from custom Z-table?
Hi Experts,
My requirement is I need to add the entries from program to three custom z-tables . Assume as zabc1,zabc2,zabc3.
Here how to add the entries from program to Z-table.???
And one more requirement is I want to provide a deletion checkbox in selection screen . Initial it was unchecked. If I am giving tick mark then the entries should be deleted from above custom Z-tables. this all will done in backgroung job?
Could you please guide me the logic how to crack this???
Let me know if you need more Info
Thanks
SanjuHi Sanjana,
What you can do is to use the ABAP keyword INSERT or MODIFY to add or modify records to a given database table. Here are the syntax taken from SAP documentation:
*Insert Statement
INSERT dbtab
Syntax
INSERT { {INTO target VALUES source }
| { target FROM source } }.
Effect
The INSERT statement inserts one or more rows specified in source in the database table specified in target. The two variants with INTO and VALUES or without INTO with FROM behave identically, with the exception that you cannot specify any internal tables in source after VALUES.
System Fields
The INSERT statement sets the values of the system fields sy-subrc and sy-dbcnt.
sy-subrc Meaning
0 At least one row was inserted.
4 At least one row could not be inserted, because the database table already contains a row with the same primary key or a unique secondary index.
The INSERT statement sets sy-dbcnt to the number of rows inserted.
Note
The inserted rows are finally included in the table in the next database commit. Up until this point, they can still be removed by a database rollback.
*Modify Statement
MODIFY dbtab
Syntax
MODIFY target FROM source.
Effect
The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.
System fields
The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.
sy-subrc Meaning
0 At least one line is inserted or changed.
4 At least one line could not be processed since there is already a line with the same unique name secondary index in the database table.
The MODIFY statement sets sy-dbcnt to the number of processed lines.
Note
The changes are transferred finally to the database table with the next database commit. Up to that point, they can be reversed using a database rollback.
Hope it helps...
P.S. Please award points if it helps... -
Hi All,
How to add the property file..ie(default.properties) to a webdynpro project.
I urgently require the solution. Kindly get it for me.
Regards
DKHi DK,
this is described in the second Web Dynpro Java Tutorial
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/b1a3e990-0201-0010-aeb2-a2ef5bc3da8e">creating an Extended Web Dynpro Application</a>
Regards, Bertram -
How to add the library of linphone into existing project ?
How to add the library of linphone into existing project ?
How to add the library of linphone into existing project ?
-
How to add the double headings in Alv Report.
Hi All,
Plz suggest me how to add the double headings in ALv Report.
RamHi,
Try out this program....
REPORT ypm_historycard_rep.
TYPE-POOLS : slis.
DATA : it_cbm TYPE STANDARD TABLE OF mara.
DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
wa_fcat TYPE slis_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv.
START-OF-SELECTION.
SELECT *
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_cbm
where matnr = 'D80K7'.
END-OF-SELECTION.
it_layout-zebra = 'X'.
it_layout-colwidth_optimize = 'X'.
it_layout-f2code = '&ETA'.
APPEND it_layout.
DEFINE macro4fcat.
wa_fcat-col_pos = &1.
wa_fcat-fieldname = &2.
wa_fcat-tabname = &3.
wa_fcat-seltext_l = &4.
append wa_fcat to it_fcat.
clear wa_fcat.
END-OF-DEFINITION.
macro4fcat '1' 'MATNR' 'IT_CBM' 'MATERIAL NO' .
DESCRIBE TABLE it_cbm.
IF sy-ucomm = '&F03'.
MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = it_layout
it_fieldcat = it_fcat
i_save = 'A'
TABLES
t_outtab = it_cbm
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form html_top_of_page
* text
* -->TOP text
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
DATA: l_text(255) TYPE c.
DATA: text1(255) TYPE c.
DATA: t_header TYPE REF TO cl_dd_table_element ,
wa_header TYPE REF TO cl_dd_table_area.
CALL METHOD top->add_gap
EXPORTING
width = 10.
CALL METHOD top->add_text
EXPORTING
text = 'hello'
sap_style = 'HEADING'
CALL METHOD top->add_gap
EXPORTING
width = 20.
CALL METHOD top->add_text
EXPORTING
text = 'HOW ARE YOU'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 50.
CALL METHOD top->add_text
EXPORTING
text = '____________________________________________________________'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 90.
CALL METHOD top->add_text
EXPORTING
text = 'YOU CAN TRY LIKE THIS'
sap_style = 'HEADING'.
ENDFORM. "html_top_of_page
Regards
Debarshi -
how to add the report for jasper ,i am using jdeveloper tool to create project but how to add the report for the that project please help me
Make the broadcasting setting using BEx Broadcaster and schedule program RSRD_BROADCAST_STARTER in process chain for the required settings.
Regards,
Sree -
How to add the Assignment column on this post outgoing payment in f-53
Hi all,
how to add the Assignment column on this post outgoing payment in f-53?
thanks.
JooHi ,
If you want to see the assignment column in f-53 process open item screen
1. First in O7V3 check for t.code FBz2 which line layout ( 2 digit code is assigned)
2. Then in t.code O7z4s check in the line layout and if assignment field is not there then insert the field.
then check in F-53.
Hopw it will solve your problem.
Assign points if useful
Regards
Prabhat -
Please add the ability to add multiple folders to the assets folder in order to better organize large numbers of files.
Hello KDLadage
Thank you for your recommendation. I understand the challenges of managing large numbers of files on the My Files page. I also understand the need to preserve project files.
Perhaps a compromise would be to create an Archive tab under My Files. Previous versions and retired project files could then be automatically moved into this holding area when a new version is published, thus preserving the files in a separate area that is still accessible to the author.
I will submit this suggestion to our product management team to consider as a future enhancement. -
How to add the Note board web part to a page with powershell
Hi everyone,
I've been looking around everywhere but haven't seen it explicitly mentioned.
Does anyone know how to add the Note Board web part to a Team Site page, e.g. Non-publishing site, Left Zone, First webpart in the zone in powershell?
Examples like this one http://adicodes.com/adding-web-part-to-page-with-powershell/ only talk about custom web parts uploaded from a local drive.
The example here looks good - http://spcrew.com/blogs/lists/posts/post.aspx?id=21 but is it for the Page Viewer Web Part. How would you go about getting the correct name for the note board web part and configuring it?
Many Thanks,
Ashley
function main(){
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$url = "http://sp2010dev1/sites/test1"
$OpenWeb = Get-SPWeb $url
$OpenWeb
$OpenSite = Get-SPSite $url
$file = $OpenWeb.GetFile("http://sp2010dev1/sites/test1/SitePages/test1.aspx")
$WebPartManager = $file.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
Add-PageViewerWebPart "http://sp2010dev1/sites/test1" "http://sp2010dev1/sites/test1/SitePages/test1.aspx" "Body" 0 "SPCrew Site" "sp2010dev"
$OpenWeb.Dispose()
function Add-PageViewerWebPart($SiteURL, $pageUrl, $webpartzone, $index, $title, $content)
$site = new-object Microsoft.SharePoint.SPSite($SiteURL)
$web=$site.OpenWeb()
$webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$webpart = new-object Microsoft.SharePoint.WebPartPages.PageViewerWebPart
$webpart.ChromeType = [System.Web.UI.WebControls.WebParts.PartChromeType]::TitleOnly;
$webpart.Title = $title
$webpart.ContentLink = "http://www.spcrew.com";
$webpartmanager.AddWebPart($webpart, $webpartzone, $index);
$web.Close()
$site.Close()
function Get-SPSite([string]$url) {
New-Object Microsoft.SharePoint.SPSite($url)
function Get-SPWeb([string]$url) {
$SPSite = Get-SPSite $url
return $SPSite.OpenWeb()
$SPSite.Dispose()Hi,
According to your post, my understanding is that you wanted to add the Note board web part to a page with PowerShell.
The name of the Note Board web part is SocialCommentWebPart.
I recommend to use the powershell code below:
$pageUrl="http://sitename/SitePages/test.aspx"
$SiteURL="http://sitename"
$site = new-object Microsoft.SharePoint.SPSite($SiteURL)
$web=$site.OpenWeb()
$webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$webpart = new-object Microsoft.SharePoint.Portal.WebControls.SocialCommentWebPart
$webpart.title="Note Board"
$webpartmanager.AddWebPart($webpart, "MiddleZone", 0);
$web.Close()
Then the Note board web part will be added to the page.
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
How to add the REFRESH button in OOPs ALV grid
how to add the REFRESH button in OOPs ALV grid
Hi Naidu.
Check the below code:
Local Class Definition and implementation For events handeling
CLASS LCL_EVENT DEFINITION .
PUBLIC SECTION.
METHODS :TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT,
USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
ENDCLASS.
CLASS LCL_EVENT IMPLEMENTATION.
METHOD TOOLBAR.
WA_TOOL-FUNCTION = 'ZFC1'.
WA_TOOL-TEXT = 'TEST'.
WA_TOOL-ICON = '@EA@'.
APPEND WA_TOOL TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "DISPLAY
METHOD USER_COMMAND.
IF E_UCOMM = 'ZFC1'.
ENDIF.
ENDMETHOD. "USER_COMMAND
ENDCLASS. "LCL_EVENT IMPLEMENTATION
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZALV_BTON'.
SELECT * FROM VBAK INTO TABLE GT_VBAK
UP TO 30 ROWS.
**** CREATE CONTAINER OBJECT
CREATE OBJECT MY_CONTAINER
EXPORTING
CONTAINER_NAME = 'CC1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6 .
****** GRID TO CONTAINER
CREATE OBJECT ALV
EXPORTING
I_PARENT = MY_CONTAINER
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CREATE OBJECT OBJ.
SET HANDLER : OBJ->TOOLBAR FOR ALV.
SET HANDLER : OBJ->USER_COMMAND FOR ALV.
****** ALV DISPLAY
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBAK'
CHANGING
IT_OUTTAB = GT_VBAK[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
* text
MODULE USER_COMMAND_0200 INPUT.
IF SY-UCOMM EQ 'BACK'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0200 INPUT
Regards
Kumar M -
How to add the new tab in Quotation VA21
Hi,
How to add the new tab after Addition data B in line item in Quotation VA21?
Please help me for this query.
DevendraDear Devendra,
Use the program SAPMV45A & the screen number provided by SAP is 8459.If you activate this screen and include the screen in 4462.
PROCESS BEFORE OUTPUT.
* Verarbeitung vor der Ausgabe
MODULE VBAP_BEARBEITEN_VOR.
CALL SUBSCREEN KUNDEN-SUBSCREEN_8459 INCLUDING 'SAPMV45A' '8459'.
PROCESS AFTER INPUT.
* Verarbeitung nach der Eingabe
* Hier weitere Prüfungen
CALL SUBSCREEN KUNDEN-SUBSCREEN_8459.
Regards,
Anand
Maybe you are looking for
-
Making Multi clips form one video in one export in final cut pro.
I am looking to turn my video that is 45 mins in length in to 45 small 1 min clips. Can anyone tell me an easy way to export out the video in to 45 individual 1 min clips that will not need me to install more software or have to cut up the video and
-
I have all the cd artwork in iTunes, but after I burn the cd, the artwork doesn't transfer nor can I recopy any artwork onto the new burned cd. Does anyone have any answers on how to fix this?
-
I have a select statement like this: Select first_name, last_name, salary From Employee I am getting report properly with this query. But my question is : How can get total salary at the bottom of report? If I crate another region with a new SQL, I c
-
I was trying to create an index on some table SQL>create indx doc_index docs(text) indextype is ctxsys.contxt; however I always got back all these errors ORA-29855: error occured in the execution of ODCIINDEXCREATE routine ORA-20000: COnText error: D
-
Calling labview executable from teststand
I have a labview VI that I build into an exe, and I'd like to call it from my teststand sequence in the setup - other test steps need to use its capabilities in the remainder of the sequence (main). If it were just a VI, then no problem, the inputs