Best approach to using command link from within a custom component
I have created a navigation component "Menu" , used as follows:
<custom:menu />The contents of menu are stored in an xml file and the Menu component delegates the rendering to a custom renderer, which basicaly writes out html links. (Actually, the component does a lot more, but I'm simplifying to get to the point.).
Sometimes, I need to render a command link instead of a regular html link. I don't want to re-invent the wheel here, so I want to delegate this to the standard command link components.
Approach 1: create child components within the Menu component constructor, e.g.
HtmlCommandLink c = new HtmlCommandLink();
MethodExpression e = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().
createMethodExpression(FacesContext.getCurrentInstance().getELContext(),
"#{registrationEditor.enterSubmission}",
String.class,
new Class[] { });
c.setActionExpression(e);
c.setValue("TestLink");
c.setTransient(true);
getChildren().add(c);Approach 2: delegate to the CommandLinkRenderer within my custom renderer, e.g.CommandLinkRenderer delegate = new CommandLinkRenderer();
HtmlCommandLink link = new HtmlCommandLink();
ExpressionFactory elFactory =
FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
MethodExpression actionExpression =
elFactory.createMethodExpression(context.getELContext(), c.getExpression(), String.class, new Class[] {});
link.setActionExpression(actionExpression);
link.setParent(component.getParent());
link.setValue(c.getLabel());
delegate.encodeBegin(context, link);
delegate.encodeChildren(context, link);
delegate.encodeEnd(context, link);Is either of these a respectable approach - they feel a little hackish. If so, which do you prefer. If not, what do you recommend?
Thanks
Richard
I think either is a fine approach and not at all hackish. I prefer the second, although I couldn't tell you why (just a gut feeling). That said, I haven't tried either so there may be hidden problems. My main concern would be what happens when the request is submitted from the page, that the Restore View phase is done correctly so that the proper event is fired.
Similar Messages
-
Changing state of application from within a custom component
Hello, I have several custom components all of which are included in the parent application.
When I try to change state from a custom component, I get an error saying "undefined state: state name". How do I change the state of the application from within a custom component ? All the states are defined in the parent application.@linrsvp,
If you are using Flex3 try Application.application.currentState = "somestate";
If you are using Flex4 try FlexGlobas.topLevelApplication.currentState = "somestate";
Don't forget to import the corresponding namespaces for the above.
Thanks,
Bhasker -
Navigation from within a custom component ???
Hi All
I am working on a new project in Flex 4 and i have a Viewstack on my main page. Then i have 6 custom components in the viewstack, the first being the home page. In this homepage custom component i have linkbuttons which i want the user to click on to navigate the viewstack ..
So what would be the best way to do this ?
<fx:Script>
<![CDATA[
]]>
</fx:Script>
<mx:ViewStack id="vs" width="800" height="1000">
<s:NavigatorContent width="100%">
<v:VHome id="vHome" />
<v:VHome id="vAbout" />
<v:VHome id="vShop" />
<v:VHome id="vProducts" />
<v:VHome id="vSupport" />
<v:VHome id="vContact" />
</s:NavigatorContent>
</mx:ViewStack>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%">
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Spacer height="10" />
<s:Panel title="Welcome" width="100%">
</s:Panel>
<s:HGroup>
<s:Panel width="397" height="200">
<MX:LinkButton />
</s:Panel>
<s:Panel width="397" height="200">
<MX:LinkButton />
</s:Panel>
</s:HGroup>
<s:HGroup>
<s:Panel width="397" height="200">
<MX:LinkButton />
</s:Panel>
<s:Panel width="397" height="200">
<MX:LinkButton />
</s:Panel>
</s:HGroup>
<s:HGroup>
<s:Panel width="397" height="200">
<MX:LinkButton />
</s:Panel>
<s:Panel width="397" height="200" >
<MX:LinkButton />
</s:Panel>
</s:HGroup>
</s:Group>
Many ThanksIf I am understanding this correctly, you have three choices.
1. Do something like ViewStack.selectedIndex(id of tab in viewstack), but not sure if selectedIndex is correct but whatever the method name is.
2. Fire an event and set up listeners
3. Go with a framework and use its notifications or event system
If this is a production app I suggest fighting the urge to go the easy route and use a framework as before you know it you will in the middle of spaghetti code. -
Using transitions and effects within a custom component
I have created a custom mxml component page within my
application with an id=Theatre2. When the appropriate button is
clicked in the main application Theatre2 opens by fading in. Within
Theatre2 there are two main canvas containers with
id=theatreLeftMain and theatreRightMain. Within theatreRightMain,
there are several canvas containers with id=aboutus, curriculum,
photos, awards0708 and awards0607. They are stacked on top o of
each other and present via the appropriate button click. I want
these several canvas containers to each “fade in” when
the appropriate button is clicked . I have tried both transitions
and effects but I haven’t been able to get them to work on
these several internal canvas containers. The Theatre2 component
page fades in great. Suggestions as to what to use to fade in these
several containers would be greatly appreciated(effect or
transition? where to put the code? code to use?). Thanks Joe
KerenickI found this component, with available source:
http://www.tink.ws/blog/pairedstackeffect-fade-squash/
Tracy -
What is the best way to call a report from within a report
What is the best way to call a report from within a report(master / Detail concept)
A type of drill down report
Oracle Database 10g
Forms 10.1.2.0.2
Report Builder 10.1.2.0.2Hi
Have a look in this link, certainly you will get fix, if not just post a comment on blog, will get reply soon
http://windows7bugs.wordpress.com/?s=oracle+10g+bug -
Problem using jsp:include from inside a custom tag
Hi, All !
I have a problem using <jsp:include> from inside a custom tag. Exception is:
"java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
could not do this. Is it a bug, since in the 1.1 spec is said: "The
BodyContent is a subclass of JspWriter that can be used to process body
evaluations so they can retrieved later on."
My code is:
<wfmklist:items>
<jsp:include page="item.jsp" flush="true"/>
</wfmklist:items>
This is an area of contention with WL. It is not so tolerant with regards to
the spec. I spent several days recently trying to convince it to accept the
specification in regards to bodies and includes and it appears to have
successfully rebuffed my efforts.
Frankly, this is very disappointing. It appears that some shortcuts were
taken on the way to JSP 1.1 support, and the result is a very hard-coded,
inflexible implementation. As I have not seen the implementation myself, I
hate to assume this, however one could posit that the term "interface" was a
foreign concept during the implementation, other than as some annoying
intermediary reference requiring an immediate cast to a specific Weblogic
class, which in turn is apparently required to be final or have many final
methods, as if being optimized for a JDK 1.02 JIT.
I am sorry that I don't have any positive suggestions other than to use a
URL object to come back in an execute the necessary "include" directly. You
lose all context (other than session) and that can cause its own problems.
However, you can generally get the URL approach to work, and you will
hopefully avoid further frustration.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
Tangosol: How Weblogic applications are customized
"Denis" <[email protected]> wrote in message
news:[email protected]...
> Hi, All !
> I have a problem using <jsp:include> from inside a custom tag. Exception
is:
> "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
>
> Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
> could not do this. Is it a bug, since in the 1.1 spec is said: "The
> BodyContent is a subclass of JspWriter that can be used to process body
> evaluations so they can retrieved later on."
>
> My code is:
> ...
> <wfmklist:items>
> <jsp:include page="item.jsp" flush="true"/>
> </wfmklist:items>
> ...
-
WebLogic Server 7.0: Including another JSP from within a custom tag
Hi all,
has anyone made experience with including (ie. processing) a dynamic
resource (JSP) from within a custom JSP tag?
Using the following code inside doEndTag():
pageContext.include("/templates/blub.jsp");
throws a ServletException (Note: the JSP is a part of the web app
which is deployed as war). Does it make a difference if the web
application is warred up into and therefore include cannot resolve the
specified relative URL?
[Tomcat 4.1.10 doesn't have problems for that matter]
The full stack trace is:
javax.servlet.ServletException: java.lang.NullPointerException
at com.foo.taglibs.template.InsertTag.doEndTag(InsertTag.java:55)
at jsp_servlet._models.__index._jspService(__index.java:774)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
TIA,
niko.
Try the same code from an exploded web app.
Niko Schmuck wrote:
> Hi all,
>
> has anyone made experience with including (ie. processing) a dynamic
> resource (JSP) from within a custom JSP tag?
>
> Using the following code inside doEndTag():
>
> pageContext.include("/templates/blub.jsp");
>
> throws a ServletException (Note: the JSP is a part of the web app
> which is deployed as war). Does it make a difference if the web
> application is warred up into and therefore include cannot resolve the
> specified relative URL?
> [Tomcat 4.1.10 doesn't have problems for that matter]
>
> The full stack trace is:
>
> javax.servlet.ServletException: java.lang.NullPointerException
> at com.foo.taglibs.template.InsertTag.doEndTag(InsertTag.java:55)
> at jsp_servlet._models.__index._jspService(__index.java:774)
> at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
> at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
> at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
> at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
> at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
>
> TIA,
> niko.
Rajesh Mirchandani
Developer Relations Engineer
BEA Support
-
Retrieve data from AD from within a custom sharepoint 2010 webpart
Hi,
I have a requirement to retrieve user data from AD and display from within a custom built webpart.
I am using the PrincipalContext class etc to get the info from AD, i have sucesfully done this in a console program without having to specifiy a username/password.
In the webpart i have successfully retrieved the data by hard coding my domain username/password.
Any ideas what i could do to get the webpart to retrieve information from AD without having to specify username/password?
thanks cjmHi C.J,
I wrote an example of this using credentials stored in the Secure Store in the TechNet Wiki. The article is here: http://social.technet.microsoft.com/wiki/contents/articles/20110.sharepoint-retrieving-credentials-from-the-secure-store-application-using-c.aspx
There's an example in the above article about building a webpart that connects to AD using the credentials.
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
Add task to notification from within the customer enhancement
Is there a function module that will add a task to a notification from within a customer exit? I've tried to use a BAPI within QQMA0014 (Save Exit) , but this interferes with the processing of the notification. The imported internal task table for the exit can be manipulated, but I am not sure how, or what, needs to be present and would prefer using a function module.
Thanks,
Brian BaschBrian,
I would activate the change document for the custom fields which will act as a trigger for a custom event(Even better than creating a generic event based on create / change notification) that would be tied to a simple single step standard task pointing to a create Task FM. I would use the exit on SAVE to update the custom fields for the task(You will have to enhance your BAPI to update the custom fields if you don't want to use this exit).
Regards
Narasimhan -
How to use a Webservice (deployableproxy) within a portal component?
hi,
i need to know how to use a webservice using a deployable proxy within a portal component?
i've created the proxies and they work (with servlets).
i know how to use them in servletes (context lookup, jndi mapping, application references) but i cant find a way to use them in a portal component.. tried the context lookup way but cant figure out which jndi mapping to use.
any help?
thanks in advance,
constantini've found this document:
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/cb2e29578c0262e10000000a11466f/frameset.htm
but it doesn't help...
i should add a privatesharing resource...
<property name="PrivateSharingReference" value="SAPJ2EE::rh21.de/pca~wsproxy"/>
which works
this is my code
public void doContent(IPortalComponentRequest request,IPortalComponentResponse response) {
try {
Context context = new InitialContext();
WSPhonebook obj = (WSPhonebook) context.lookup("/wsclients/proxies/rh21.de/pca~wsproxy/de.rh21.wsproxy.phonebook.WSPhonebook");
WSPhonebookViDocument phonebook = (WSPhonebookViDocument) obj.getLogicalPort("Config1Port_Document", WSPhonebookViDocument.class);
} catch.....
now the lookup works (i guess, no messages about that anymore), but i catch ClassNotDefFoundError-Exceptions, but the classes are there, i can strg+click them in the editor, they are in the used dc's etc.
any help? its quite uurgent :/ -
Problem with using database link from oracle 7 to oracle 9i
Hi To Every One
I have two oracle database oracle 7.3.4.0.1 and oracle 9i 9.2.0.1.0.
and the tns alias to connect to oracle 9i database is oracle9i and tns
alias to oracle 7 database is oracle7.I have no problem in connect to
these database using these tns aliases from either database.The tns
alias for oracle 7 is available in tnsnames.ora file of oracle9i and
tns alias for oracle 9i is available in tnsnames.ora file of oracle 7.
So there is no connection problem from each other.Connection is
working fine for each other but the problem with database links is
like this
Problem:
when i create database link from oracle9i user or public database link
from oracle9i for oracle7 user like this
SQL ORACLE9I >CREATE DATABASE LINK ORACLE7 CONNECT TO <ORACLE7USER>
IDENTIFIED BY <PASSWORD> USING 'ORACLE7';
OR
SQL ORACLE9I >CREATE PUBLIC DATABASE LINK ORACLE7 CONNECT TO <ORACLE7USER>
IDENTIFIED BY <PASSWORD> USING 'ORACLE7';
The links get created sucessfully but when i write command like
SQL ORACLE9I> DESC <ORACLE7USER_NAME>.<ORACLE7USER_TABLENAME>@ORACLE7
I RECEIVE A ORACLE ERROR LIKE
ORA-12663 SERVICE REQUIRED BY CLIENT IS NOT AVAILABLE ON THE SERVER.
OR IF MY COMMAND IS LIKE
SQL ORACLE9I> SELECT <FEILD_NAME> FROM
<ORACLE7USER_NAME>.<ORACLE7USER_TABLENAME>@ORACLE7;
I RECEIVE AN ORACLE ERROR LIKE
ORA-01002 FETCH OUT OF SEQUENCE.
ORA-02063: preceding line from ORACLE7
BUT IF I CREATE A LINK FROM ORACLE7 USER FOR ORACLE9I USER
IT WORKS FINE.
PLZ HELP ME WHAT IS THE PROBLEM THAT THE LINK FOR ORACLE 7 IS NOT WORKING WHEN
IT IS BEING CREATED FROM ORACLE9I.
Thank u.Oracle 9.2.0 does not support connectivity to Oracle 7. The newest version that will support this is 9.0.1.
-
How to change the Portal Password using a link from Web dynpro application
Hello Everybody,
I have a requirement to change the user password from a web dynpro application which is available on a mobile device. Firstly User will log into the portal through a mobile device and after getting authenticated user will be redirected to the mobile application. Within this mobile application there will be a link to change the login password(Portal login). Can somebody tell me how can i change the portal login password from a link available within the mobile application. Looking forward for a suitable reply.
Thanks to all,
Regards,
Saby.Hi Maksim,
Thanks for your reply..but i would also like to know can we directly use the Change Password Iview "persoUserPassword" from the portal. Can i directly Pass the URL of this iview from the portal to a "Change Password" link in the web dynpro application, so that when the user click this link he should be able to see this Iview on his/her mobile device and should be able to change the password from there. But i dont know whether this iview will appear properly on the mobile device or we have to have a custom web dynpro application for this purpose...Please reply with a suitable answer.
Thanks in advance.
Regards,
Sarabjeet Singh. -
Re-use message mapping from within java mapping?
Hi there,
I have a question regarding java mapping. What I would like to do is to re-use an existing message mapping from within java mapping.
Technicaly, message mapping is perfomed by com.sap.aii.mappingtool.tf3.AMappingProgram.execute, right? I would like to call that mapping program for a specifc message mapping from within my java mapping.
Pseudo java code would look like this:
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
com.sap.aii.mappingtool.tf3.AMappingProgram.execute(in,out,'SomeMessageMapping');
SomeMessageMapping is a message mapping that is defined in the integration repository.
Is it possible? If so, could you provide me with some details?
Thank you and best regards,
WolfgangHi Wolfgang,
very interesting idea?
I would activa a dummy message mapping. than I would have a look in the file directory of the java-stack and try to find out the name of the *.class or *.jar file.
On the other hand you could generate a tpz-transport-file an unpack this file, to explore the name of the *.class or *.jar
Unfortunately I do not have access to the file system. So I can't explore the name.
Regards Mario -
Best way to use basic data from another DB?
Hi, I have a database where I need to use basic information such as (Table Person and other Human Resources tables) My database needs those tables, should I create those tables in my model too? and through scripts fill that information? or there is a direct way to do it, such as a trigger or something. Can you give different solutions with different database engines? such as Oracle, mysql or MSSQL or just one thanks a lot!
diego10 wrote:
I see I need to be specific, Well from MSSQL to Oracle
You could have a process on MSSQL to push data to Oracle. In this case, MSSQL is just another client to the oracle database, using MSSQL "linked server". This could be a scheduled batch process or a trigger. (I'm assuming MSSQL has triggers).
You could have a process on Oracle pull data from MSSQL via a db_link in the Oracle database. Obviously a trigger would not be useful, because there would be no triggering event on the Oracle database.
You could create a view in the oracle database that selects from MSSQL via a db_link. This would avoid trying to keep duplicated data in sync, but would not allow the app in Oracle to actually maintain the data, just view it when needed.
The best solution will depend on the specific needs. -
Best approach for transition to IFRS from US GAAP
Hi SAP Gurus,
I have gone through some of SAP presentations and also 2 EcoHub sessions on IFRS.
I understand the SAP's suggestion to use of Parallel ledger as best approach.
Can any one clear below my queries?
1. Assuming current SAP system is in ECC 6.0 with classical ledger and we are trying to migrate to SAP GL. It is suggested to migrate to SAP GL first (lets say by 2010) and plan for adopting IFRS as one of parallel ledger (Non Leading) as a separate project (lets say from 2012). For the years 2012 & 2013 we will have reporting both in US GAAP & IFRS. Till here it is clear. I am not sure how we can drop reporting in US GAAP from 2014 when it is set as leader ledger while migrating to SAP GL.
Is there a way to migrate the IFRS non leading ledger as Leading ledger by 2014 and deactivate 0L - US GAAP ledger from 2014?
2. Although I understand the reporting in IFRS can happen prospectively from 2012 onwards, I am not sure how to build the open balances as of 2012. For E.g., how to get the current book values of Fixed Assets as per IFRS principles.
3. Is it advisable to migrate to SAP GL with leading ledger as IFRS directly and marking one of non leading ledger for US GAAP reporting? And how to drop posting in US GAAP non leading ledger from 2014 onwards?
Thanks in advance,
Regards,
SomDuplicate post
Maybe you are looking for
-
Single step workflow with multiple approvers (without using a group)
Hi, is it possible to have a single step workflow with multiple approvers without using a group? This is for a contract document. i want to add a number of users based on particular logic. The approvers are random and do not belong to any particular
-
I had ordered Oracle 8i for Linux long back. Have still not received the CD. Have been OTN member for more than 2 yrs now and this is the first instance that CD has been delayed and also no intimation has been provided. Hope I will receive the CD. Th
-
Love the CS5's 3d painting features but I'm running into a really frustrating issue: When I select a value from the 3d object and try to paint with that value, it's showing up as a different value altogether (the image hopefully illustrates this much
-
[bug?] tapping the next tab after closing a tab skips to the third tab.
this is an annoying situation I encounter a lot. steps to encounter this problem: 1. open 3 or more tabs, for this example they are called tab1, tab2, and tab3 in spot1, spot2, and spot3. 2. go to tab1 and close the tab switcher. 3. open the tab swit
-
I want see list of user's in the portal
hi, i want see list of user's in the portal how is it, can u help any body? ok bye bye...