Struts - example of iterate using a hashtable (key,value)
I am trying to create a dynamic menu system and each menu group
is storied within a single hashmap with the name of the menu as the key (e.g. "mainmenu", "adminmenu"). I am having problems understanding the documentation on how to pass the key to select the
right entry within the hashmap. I have read the following but find
it confusing. Could someone provide a detailed example?
http://jakarta.apache.org/struts/struts-logic.html#iterate
Here's some code to show you what I am doing.
I will start out with how I am creating the List and the HashMap
menuList = new ArrayList();
sqlStatement = "select * from menu where admin = 'Y' ";
// gets the menu items from the database and builds the menuList
this.buildMenu( (DBResultSet)db.executeSQL( sqlStatement, args ) );
// puts the menuList into a HashMap with a key of adminmenu
// NOTE: the menuList is actually a collection (list) of beans
menuMap.setItem ("adminmenu", menuList );
...Here's my bean that stores I use to store the HashMap (menuMap).
import java.util.*;
public class MenuBO extends BaseBusinessObject
private HashMap menuMap;
public MenuBO()
menuMap = new HashMap();
public void setItem ( String menuType, List menuList )
menuMap.put ( menuType, menuList);
public List getItem( String menuType )
return (List)this.menuMap.get( menuType ) ;
public HashMap getMenuMap ()
return menuMap;
public void removeItem ( String menuType)
menuMap.remove( menuType);
}And here's my iterate which is not working. I want to single out the value that has a key of "adminmenu" and process that list of menu elements. This is easy to do with scriptlets but I am spending many hours trying to figure out Struts documentation - they need some real world examples if they want Struts to catch on...
<jsp:useBean id="menuMap" scope="session"
class="com.benchdogs.webapp.beans.MenuBO"/>
<logic:iterate id="mapEntry" name="menuMap" property="menuMap">
<bean:write name="mapEntry" property="key"/>
</logic:iterate>This example loops through the hashmap and displays the keys. I want to be able to process a specific value based on the key. The value is a List so I would need to do another iterate statement within the master iterate.
Similar Messages
-
Using XML as key-value pair in OSB 11g
Hi All,
I have made a new project Test. In that there are 2 folders:
1. Proxies - which contain proxy services
2. xml - which contains XMLs
An example of XML (Name of XML - TestXML) present in xml folder:
<valueDetails>
<key1>abc</key1>
<key2>123</key2>
<key3>a12s</key3>
</valueDetails>
I want to use them in the pipeline of proxy services as key-value property. How do I achieve this?
I am using OSB 11gR1.
Thanks in advance!
Regards,
Karthik.Register the xml as a xquery resource in osb. Then use an assign action to load it in pipeline. E.g Assign XQuery Resource KeyPairsXML to $keypairs. After this $keypairs will have your xml and you can use appropriate xpath to retrieve the key you desire,
-
LOV usage -- Can LOV used as key-value pair?
Post Author: phoenix
CA Forum: WebIntelligence Reporting
Hello,
I am using BO XI R2 and I come to an issue with LOV. Can LOV be used as a key-value list?
Say I have a key-value list as below:
A --> 1
B --> 2
Can LOV just list 'A, B.. ' and return 1 if user choose A and 2 if user choose B?
Many thanks.
phoenixIt is possible only if you know all possible KEY values:
with t as (
select 1 id,'STATUS' key,'TRUE' val from dual union all
select 1,'AGE GROUP','10' from dual union all
select 1,'TRAVEL','Y' from dual union all
select 2,'STATUS','FALSE' from dual union all
select 2,'AGE GROUP','20' from dual union all
select 2,'TRAVEL','N' from dual
select id,
max(case key when 'STATUS' then val end) status,
max(case key when 'AGE' then val end) age,
max(case key when 'AGE GROUP' then val end) "AGE GROUP",
max(case key when 'TRAVEL' then val end) travel
from t
group by id
ID STATUS AGE AGE GROUP TRAVEL
1 TRUE 10 Y
2 FALSE 20 N
SQL> If you are on 11g, you can use PIVOT construct, but again you need to know resulting columns upfront.
Another thing you could do is to return a CSV list of key all values in one column using STRAGG (or LISTAGG if you are on 11.2), hierarchical queries, XML or undocumented WM_CONCAT.
SY. -
Using Struts Example in IPlanet web Server 6.0
Hai
i am new to struts and i was trying to run the example application shiped along with the binary distribution
in iplanet webserver 6.0.
I have extracted the struts-example.war file in to a folder named strutsexamples under my iplanetdocroot\servers\docs\ Using the
link DeployWebApplications in the admin side of the iplanet application.
By doing the above steps all the example files are extracted in to the folder iplanetdocroot\servers\docs\strutsexamples directory .
Problem 1: when i restarted the server i found the following error in the log file
[06/Apr/2003:19:58:03] info ( 394): successful server startup
[06/Apr/2003:19:58:03] info ( 394): iPlanet-WebServer-Enterprise/6.0SP1 B08/20/2001 01:49
[06/Apr/2003:19:58:05] info ( 394): Installing a new configuration
[06/Apr/2003:19:58:05] info ( 394): [LS ls1] http://gdcblr1596.gdcblr, port 80 ready to accept requests
[06/Apr/2003:19:58:05] info ( 394): A new configuration was successfully installed
[06/Apr/2003:19:58:09] info ( 394): Loading IWSSessionManager by default.
[06/Apr/2003:19:58:09] info ( 394): IWSSessionManager: Maximum number of sessions is 1000
[06/Apr/2003:19:58:10] info ( 394): Adding web application (/diva) at (E:/iPlanet/Servers/docs/diva)
[06/Apr/2003:19:58:10] info ( 394): Loading IWSSessionManager by default.
[06/Apr/2003:19:58:10] info ( 394): IWSSessionManager: Maximum number of sessions is 1000
[06/Apr/2003:19:58:10] info ( 394): Adding web application (/struts) at (E:/iPlanet/Servers/docs/struts)
[06/Apr/2003:19:58:10] info ( 394): Loading IWSSessionManager by default.
[06/Apr/2003:19:58:10] info ( 394): IWSSessionManager: Maximum number of sessions is 1000
[06/Apr/2003:19:58:10] info ( 394): Adding web application (/strutsexamples) at (E:/iPlanet/Servers/docs/strutsexamples)
[06/Apr/2003:19:58:10] info ( 394): Loading IWSSessionManager by default.
[06/Apr/2003:19:58:10] info ( 394): IWSSessionManager: Maximum number of sessions is 1000
[06/Apr/2003:19:58:11] info ( 394): vs(https-gdcblr1596.gdcblr)servlet 'action' class = 'org.apache.struts.action.ActionServlet' loaded in context = '/strutsexamples'
[06/Apr/2003:19:58:11] info ( 394): action: init
[06/Apr/2003:19:58:13] warning ( 394): vs(https-gdcblr1596.gdcblr)ServletException thrown in servlet.init; context = /strutsexamples, servlet = 'action'; stack tace: javax.servlet.UnavailableException: Parsing error processing resource path
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java, Compiled Code)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java, Compiled Code)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.iplanet.server.http.servlet.WServletEntity.loadAndInitServlet(WServletEntity.java:98)
at com.iplanet.server.http.servlet.WebApplication.init(WebApplication.java, Compiled Code)
at com.iplanet.server.http.servlet.VirtualServer.init(VirtualServer.java, Compiled Code)
at com.iplanet.server.http.servlet.NSServletRunner.VSInit(NSServletRunner.java:680)
, root cause:
[06/Apr/2003:19:58:13] info ( 394): Successfully initialized web application environment (web-apps.xml) for virtual server (https-gdcblr1596.gdcblr)
Problem 2: when i was trying to invoke the example by typing http://localhost/strutsexamples/ i am getting only the following errors .
[06/Apr/2003:20:03:17] info ( 394): vs(https-gdcblr1596.gdcblr)servlet 'jsp' class = 'org.apache.jasper.servlet.JspServlet' loaded in context = '/strutsexamples'
[06/Apr/2003:20:03:17] info ( 394): jsp: init
[06/Apr/2003:20:03:18] info ( 394): jsp: init
[06/Apr/2003:20:03:19] failure ( 394): Internal error: servlet service function had thrown ServletException (uri=/strutsexamples/): javax.servlet.ServletException, stack: javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:453)
at jsps.index_jsp._jspService(_index_jsp.java, Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:247)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6(JspServlet.java:237)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:520)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:589)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:891)
at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1064)
at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:953)
, root cause: javax.servlet.jsp.JspException
at org.apache.struts.util.RequestUtils.message(RequestUtils.java:975)
at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:294)
at jsps.index_jsp._jspService(_index_jsp.java, Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:247)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6(JspServlet.java:237)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:520)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:589)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:891)
at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1064)
at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:953)
I have read all the FAQ and searched in web also and i am not able to find any answer to my problem .
Kindly if someone knows how to overcome the above problem do reply me to this id .
If any one has got the steps to be done to use struts in IplanetWebServer 6.0 do mail me also .
thanks and regards
Divakar.Renganathan
Associate Consultant
MascotSystems .
Bangalore.Hi,
Were you successful in getting the steps for incorporating struts with iPlanet Web Server 6.0 ?
If so, please email them to me as I am having similar problems.
Thanks
Harinder
[email protected] -
Use of primitive datatypes as hashtable key finally OK?
Are we finally at the point where we can use primitive values as keys in a hashtable? I know that this wouldn't work in the past, and I haven't needed to use a hashtable for years, so I haven't really cared.
Yesterday I tried it in a program compiled for JVM 1.5, using ints for the keys, and it runs fine. Admittedly, I do get several "unchecked operation" warnings during compilation.Yesterday I tried it in a program compiled for JVM
1.5, using ints for the keys, and it runs fine.
Admittedly, I do get several "unchecked operation"
warnings during compilation.It autoboxed the ints as Integers for you. Under the covers it is still using Integer objects. -
Error while running struts example on JBOSS
Hi,
In any application of struts wherever i am using formbeans, i am getting following error.
If i remove <html:form> and all <html:...> types of tag, it will just show the jsp page.
If anybody knows the solution please help me.
Following are the details.
After deploying application on jboss on index.jsp i am clicking on the link for DynaAddress.jsp it is giving following error
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:113: jspxmeth_bean_message_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.HtmlTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_bean_message_0(_jspx_th_html_html_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:116: jspxmeth_html_base_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.HtmlTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_base_0(_jspx_th_html_html_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:121: jspxmeth_html_form_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.HtmlTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_form_0(_jspx_th_html_html_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:190: jspxmeth_html_errors_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_errors_0(_jspx_th_html_form_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:200: jspxmeth_html_text_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_text_0(_jspx_th_html_form_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:210: jspxmeth_html_text_1(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_text_1(_jspx_th_html_form_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:221: jspxmeth_html_text_2(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_text_2(_jspx_th_html_form_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:229: jspxmeth_html_submit_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_submit_0(_jspx_th_html_form_0, jspxpage_context))
^
Generated servlet error:
D:\jboss-3.2.7\server\default\work\jboss.web\localhost\ExampleDynaAction\org\apache\jsp\web\DynaAddress_jsp.java:234: jspxmeth_html_cancel_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.web.DynaAddress_jsp cannot be applied to (org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext)
if (_jspx_meth_html_cancel_0(_jspx_th_html_form_0, jspxpage_context))
^
9 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
while clicking jsp for validator it is also ginig me the same error.
f anybody knows the solution please help me,
thanks,
Message was edited by:
myDishaHi,
Goto Project Properties:
Search for the following in left pane:
Oracle Applications -> Runtime Connection
DBC file : Choose the correct dbc file from your local machine. You have to get it from your dba and paste it in this path: jdevhome\jdev\dbc_files\secure\*.dbc
User Name: Application User Name
Password : Application password
Responsibilty Key:
Goto Application Developer --> Responsibility --> Define -- >
Query for the available responsibility for the given user. Say for example: "Order Management Super User"
Application: Order Management
Responsibilty Key: ORDER_MGMT_SUPER_USER
Application Short Name:
Goto Application Developer --> Application --> Register -- >
Query for the given application " Order Management"
Short Name: ONT
Responsibility Key and Application Short Name depends upon the object you are developing.
Regards. -
Can I use the CD key more than once?
I bought Lightroom as a Christmas present for my husband this year, but his laptop was stolen recently. It will be a few months before we can afford getting him a new one, and I want him to still be able to use Lightroom until then, so I was considering installing it on my computer, if it will do so (my computer is getting a bit old). But I don't want to do that unless he'll still be able to use the CD key to install it on a new laptop once we get him one. I've never had to worry about installing software on more than one computer, so I'm not completely sure of myself here. Any advice?
LR’s license, like most Adobe products’ licenses, is for one person on two different computers, with a desktop and a laptop or a work computer and a home computer being the typical examples, as long as only one of those computers is used at a time.
-
Is There a way of using an alt key on the iphone (to so alt characters)
Is There a way of using an alt key on the iphone (to so alt characters)??
Cheers all.There is no alt key, so no, but there are a lot of preloaded symbols already on the phone, all you have to do is hold a key and extra options will come up. For example, if you want an accent over a, hold a, and it will give you options for it. This also works with the symbols, for example, the $ symbol can be held to provide the money symbol for euros, yens, pounds, etc.
-
Use of foreign key check in ABAP reports
Hi,
I'm trying to understand if it's possible to use a foreign key integrity check in an ABAP reports. I have understood that this kind of check is deactivated for performance reasons, is it right?
In this case I'd like to know if it is possible to activate the foreign key check "on demand", or just for a particular table.
As an example, I'd like to use the foreign key defined on attribute AKONT of table KNB1, that points on the related attribute of table SKB1.
Thanks,
GabrieleWelcome on SCN!
I'm trying to understand if it's possible to use a foreign key integrity check in an ABAP reports. I have understood that this kind of check is deactivated for performance reasons, is it right?
Most likely yes. Integrity is turned OFF for Open SQL statements but is turned ON for screen fields.
If you just create screen parameter like
parameters pa_akont type knb1-akont.
...then input help for that field will be automatically provided. This means that you will not be able to pick or enter value different that this allowed from SKB1 table (foreign key relationship will be checked).
You can explicitly assign different input help or search help for certain screen field independently of type it is refering i.e by means of fm F4IF_FIELD_VALUE_REQUEST .
This however still relates only to screen fields, not fields used directly in ABAP statement.
Regards
Marcin -
Using the tab key in a list and keeping a table format when copying and pas
when I transfer a table from a microsoft word document or PDF file to the pages document, it does not keep the table and only the data inside the table. how do I keep the table?
Also, how do I keep the numbers from indenting when I do a list. for example, if I need to indent part of the sentence for writing specifications of something, I want to use the tab key to move away from the first part of the sentence, but it moves everything and not just my marker.Not if it decides the list is a list, it can't.
The app never "decide that a list is alist". It does what you ask it to do.
Of course, if you refuse to disable the preference which automatically treats a paragraph as a new list entry I can't help you.
If the datas are stored as a list, the bullets are not part of the datas themselves so they will not be copied.
As I already responded the "Copy" tool doesn't copy attributes.
We have to choose:
we are using lists and the bullets can't be copied
or
we are using text arranged in columns and, if we put bullets, these bullets may be copied.
It's not me which wrote:
+In Textedit, it's very easy:+
+Tab, Bullet, First Column, Tab (or Tab x2 to get everything aligned), Second Column, etc.+
To do the same thing in Pages
Bullet, Tab, First Column, Tab (or Tab x2 to get everything aligned), Second Column, etc.
It's what was displayed in my screenshot and really I don't see what is more complicated. -
I have a JSP page, displaying Employee details(5 attrbutes in total)
(code, name, address, telephone, email)
And this employee is coming from Employee table, which is having around 50 attributes, and I have one entity class for the employee doing the database operation.
Now since I have to show only 5 fields, using Employee class (which is having 50 attributes) will be very heavy.
Should I create a new bean class EmployeeView having only 5 attributes or shall i go for <b>hashtable</b> , having 5 entries, with attribute name as key and attribute value as key value.
Are there any disadvantage on using hashtable like this, or what can be better approach.
Please suggest.Hi,
The best way for this is to create view for the table in the database.
Then you can access the view like how you access a table.
This will reduce the amount of data transfer from database to your application.
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Micro Sysytems
http://www.sun.com/developers/support/ -
Key Bindings using the arrow keys
Following is some code that allows you to move a component around the screen using the arrow keys. I've noticed a problem and I'm just wondering if its Java or my keyboard.
Lets start with an example that works:
Press the down and right keys. Then press either the up or left key. The image moves proving that it supports 3 keys.
Now for the problem:
Press the up and left keys. Then press either the down or right key. Three things to notice:
a) the direction doesn't change when the third key is pressed
b) no output is displayed, so the ActionListener is not being invoked
c) after a short time, the program starts beeping
Now try rerunning the code after removing the comments that assign the key bindings to the "a, s, d, f" keys. Redo the above test and it works even if all four keys are pressed.
I don't remember this problem when I wrote the code a while ago, but I did recently get a cheap new keyboard so I'm just wondering if the problem is my keyboard or whether its a quirk with Java.
You can download Duke from here:
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/LayeredPaneDemoProject/src/components/images/dukeWaveRed.gif
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class KeyboardNavigationProblem implements ActionListener
private JComponent component;
private int deltaX;
private int deltaY;
private Timer timer;
private int keysPressed;
private InputMap inputMap;
public KeyboardNavigationProblem(JComponent component, int delay)
this.component = component;
this.deltaX = deltaX;
this.deltaY = deltaY;
timer = new Timer(delay, this);
timer.setInitialDelay( 0 );
inputMap = component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
public void addAction(int keyCode, String description, int deltaX, int deltaY)
new NavigationAction(keyCode, description, deltaX, deltaY);
public void updateDeltaX(int delta)
deltaX += delta;
public void updateDeltaY(int delta)
deltaY += delta;
public void actionPerformed(ActionEvent e)
int componentWidth = component.getSize().width;
int componentHeight = component.getSize().height;
Dimension parentSize = component.getParent().getSize();
int parentWidth = parentSize.width;
int parentHeight = parentSize.height;
// Determine next X position
int nextX = Math.max(component.getLocation().x + deltaX, 0);
if ( nextX + componentWidth > parentWidth)
nextX = parentWidth - componentWidth;
// Determine next Y position
int nextY = Math.max(component.getLocation().y + deltaY, 0);
if ( nextY + componentHeight > parentHeight)
nextY = parentHeight - componentHeight;
// Move the component
component.setLocation(nextX, nextY);
class NavigationAction extends AbstractAction implements ActionListener
private int deltaX;
private int deltaY;
private KeyStroke pressedKeyStroke;
private boolean listeningForKeyPressed;
public NavigationAction(int keyCode, String description, int deltaX, int deltaY)
super(description);
this.deltaX = deltaX;
this.deltaY = deltaY;
pressedKeyStroke = KeyStroke.getKeyStroke(keyCode, 0, false);
KeyStroke releasedKeyStroke = KeyStroke.getKeyStroke(keyCode, 0, true);
inputMap.put(pressedKeyStroke, getValue(Action.NAME));
inputMap.put(releasedKeyStroke, getValue(Action.NAME));
component.getActionMap().put(getValue(Action.NAME), this);
listeningForKeyPressed = true;
public void actionPerformed(ActionEvent e)
if (listeningForKeyPressed)
updateDeltaX( deltaX );
updateDeltaY( deltaY );
inputMap.remove(pressedKeyStroke);
listeningForKeyPressed = false;
if (keysPressed == 0)
timer.start();
keysPressed++;
else // listening for key released
updateDeltaX( -deltaX );
updateDeltaY( -deltaY );
inputMap.put(pressedKeyStroke, getValue(Action.NAME));
listeningForKeyPressed = true;
keysPressed--;
if (keysPressed == 0)
timer.stop();
System.out.println(KeyboardNavigationProblem.this.deltaX + " : "
+ KeyboardNavigationProblem.this.deltaY);
public static void main(String[] args)
JPanel contentPane = new JPanel();
contentPane.setLayout( null );
JLabel duke = new JLabel( new ImageIcon("dukewavered.gif") );
duke.setSize( duke.getPreferredSize() );
duke.setLocation(100, 100);
contentPane.add( duke );
KeyboardNavigationProblem navigation = new KeyboardNavigationProblem(duke, 100);
navigation.addAction(KeyEvent.VK_LEFT, "zLeft", -5, 0);
navigation.addAction(KeyEvent.VK_RIGHT, "zRight", 5, 0);
navigation.addAction(KeyEvent.VK_UP, "zUp", 0, -5);
navigation.addAction(KeyEvent.VK_DOWN, "zDown", 0, 5);
// navigation.addAction(KeyEvent.VK_A, "zLeft", -5, 0);
// navigation.addAction(KeyEvent.VK_S, "zRight", 5, 0);
// navigation.addAction(KeyEvent.VK_D, "zUp", 0, -5);
// navigation.addAction(KeyEvent.VK_F, "zDown", 0, 5);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setContentPane( contentPane);
frame.setSize(800, 600);
frame.setLocationRelativeTo( null );
frame.setVisible(true);
}if you hold down left and right (so it doesn't move), down works, but not up.
hold up/down, right works but not left.Yes, the problem only seems to be when the up and left in combination with the right or down key is pressed.
num lock off - use the number pad arrow keys and all works OK Thats interesting, I didn't notice that. Although it just confuses the issue as to what the problem is.
So it appears to me that:
a) left + up + down, and
b) left + up + right
are special key combinations that are intercepted by either the OS or the JVM. Do these key combinations ring a bell to anybody?
I'm use JDK1.4.2 on XP. I wonder if other OS will have the same problem?
Again, this isn't a real, problem, just more of a curiosity. Thanks, -
Cannot Open A Library File Using the 'Option' key When Launching iTunes
I found that when I tried to open a different iTunes library file then my default by using the 'option' key when lanching iTunes that the iTunes Library file was greyed out.
I looked in the previous Library Folder and noticed that the old file had the extension .itl.
My solution was to add the extension .itl to the end of the of the file name of my iTunes Library files and things then worked when launching with the 'option' key. As an example 'iTunes Terry Library' became 'iTunes Terry Library.itl'. I applied this to all my iTunes library filles and all is well. Of course make a duplicate of the file you are going to change so you have a backup file.
I am using iTunes 10.4 and Sno-Leopard 10.6.8.
MJNo, choose library works in Windows. The thread you linked to suggested that, on OSX at least, iTunes now behaves like almost every other application in that you can open a data file associated with the application and it opens that data file rather than a different one it had opened in the past. I was hoping things might have actually changed.
In short, holding shift or option while launching the app is a very clunky way of opening an alternative library given the standard behaviour of the GUI where "opening" a data file normally opens the application that can work with it.
tt2 -
To get the Workflow status using the Object Key
Hi Experts,
Do we have any transaction code or a Standard table where I can see the status of the Workflow using the Object Key.
For example I have an Invoice Document number for which a Workflow has been triggered and now I want to see the which workflow has been triggered and what is the status for the same. I have only the Invoice Document Number.
I think I can use the SWI1, SWEL etc but I don't have Object key as Input field.
Thanks in advance.
Regards,
SRinivasHi,
You can find the workitem id in table SWW_WI2OBJ.
Here you need to pass the invoice number in "Instacne ID" with leading zeros, business object in Object type.
This may take little bit longer time.
After getting the workitem number then look into table SWWWIHEAD for the workitem status.
Thanks and regards,
SNJY -
Need example report program using PNPCE LDB in SAP HR
Need example report program using PNPCE LDB in SAP HR.
and how to create a report category in sap hr for using it as cutomised selection screen.Hi,
Go through the following links, i hope it will help you.....
/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/893908#
A sample prog with LDB PNP
*& Report ZH_REPT_PAYMENT *
report zh_rept_payment line-size 80 no standard page
heading.
tables: pernr, " Standard Selections for HR Master Data Reporting
pcl1, " HR Cluster 1
pcl2, " HR Cluster 2
pa0009,
PA9001,
PA9006,
pa0002,
pc260 , " Cluster Directory for Payroll Results
bnka .
Infotypes
infotypes: 0001. " Organizational Assignment
Declaration of Internal Tables
data : bnka1 like bnka occurs 0 with header line .
data: begin of t_int_rep occurs 100,
bankl like pc209-bankl, " Bank Number
zlsch like pc209-zlsch, " Payment method
pernr like pernr-pernr, " Employee Number
ename like pernr-ename, " Employee Name
bankn like pc209-bankn, " Bank Account Number
betrg like pc209-betrg, " Amount to be transfered
zweck like pa0009-zweck, " Purpose
end of t_int_rep.
data: begin of int_rep occurs 100,
bankl like pc209-bankl, " Bank Number
zlsch like pc209-zlsch, " Payment method
pernr like pernr-pernr, " Employee Number
ename like pernr-ename, " Employee Name
bankn like pc209-bankn, " Bank Account Number
betrg like pc209-betrg, " Amount to be transfered
zweck like pa0009-zweck, " Purpose
begda like pa0009-begda, "Begin date
end of int_rep.
Declaration of Data Variables
data: ws_betrg like pc209-betrg, " BT Amount
w_val like spell occurs 0 with header line,
int_rep1(6), " TYPE I, " Employee Number
cnt type i value 0, " Counter
calcmolga like t500l-molga value '40', " Country Grouping
v_id(15),
calc_currency like t001-waers value 'INR'. " Currency
data : ctr type i,
dt_merge like pa0009-begda.
data: ws_totemp(6) type c,
ws_totamt(20) type c,
r_mth(9) type c,
ws_fpbeg(6) type c,
ws_fpend(6) type c,
ws_mthyr(6) type c,
ws_mthyr_r(14) type c,
r_mth_t(3) type c,
ws_amt(8) type c,
ws_bankl(14) type c,
ws_date(6) type c,
amount_word(500),
total_page type i,
pages type i,
remain type i.
data begin of i_spell.
include structure spell .
data end of i_spell .
data : c_molga type t500l-molga value '40',
c_banks type bnka-banks value 'IN'.
Standard Includes
include rpc2cd09. "Cluster CD data definition
include pc2rxin0.
include rpc2rx09.
include rpppxd00. " Data Definition buffer PCL1/PCL2
include rpppxd10. " Common Part buffer PCL1/PCL2
include rpppxm00. " Buffer Handling RoutinePCL1/PCL2
include zrpc2rox2. " Data Definition POCLSTERS (not J,K,U)
Selection Screen
selection-screen begin of block b1 with frame title text-001.
parameter: pa_mth(2) type c default sy-datum+4(2) obligatory,
pa_year(4) type c default sy-datum(4) obligatory,
p_bankl like pc209-bankl, " Bank Number
p_zlsch like pc209-zlsch. " Payment method
selection-screen end of block b1.
save_calc_currency = calc_currency.
count_top = 0.
get_pernr_flag = 0.
Top-Of-Page
top-of-page.
perform convert_month using pa_mth(2) r_mth.
ws_mthyr_r = r_mth.
concatenate ws_mthyr_r pa_year into ws_mthyr_r separated by space.
SKIP 5.
skip 1.
skip 4.
if int_rep-bankl eq ' '.
if int_rep-zlsch eq 'C' or int_rep-zlsch eq 'E' or
int_rep-zlsch eq ' '.
write: /1(85) 'CHEQUE PAYMENT STATEMENT'(047) centered.
elseif int_rep-zlsch eq 'L'.
write: /1(85) 'DEMAND DRAFT STATEMENT'(047) centered.
endif.
else.
write: /1(85) 'BANK TRANSFER STATEMENT'(002) centered.
endif.
skip.
write: /34 ws_mthyr_r,
62 'Page :'(008),69(2) sy-pagno intensified off,
' Of ',78(2) pages intensified off.
clear pages.
read table bnka1 with key bankl = int_rep-bankl .
if sy-subrc = 0.
if int_rep-zlsch eq 'T'.
write:/03(10) 'Bank Name : ', bnka1-banka.
write:/03(10) 'Branch : ', bnka1-brnch.
write:/03(10) 'Address : ', bnka1-stras.
endif.
endif.
skip.
write:/1(80) sy-uline.
write: /1 sy-vline, 2(5) 'Sl.No'(002),
7 sy-vline, 8(8) 'Emp.No.'(003),
16 sy-vline,17(35) 'Employee Name'(004).
*--added for Demand Draft
if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
write : 47 sy-vline, 48(15) 'Payable at'(005).
else.
write : 47 sy-vline,48(15) 'Account No.'(005).
endif.
write: 63 sy-vline,64(16) 'Amount'(006),
80 sy-vline.
write:/1(80) sy-uline.
end-of-page.
write:/1(80) sy-uline.
write:/2 'Printed on ', sy-datum.
Start-of-selection.
start-of-selection.
*perform h_headr.
ctr = 0.
set margin 5.
call function 'RP_GET_CURRENCY'
exporting
molga = calcmolga
importing
waers = calc_currency
exceptions
others.
if sy-subrc ne 0.
calc_currency = 'DEM'.
calc_currency = save_calc_currency.
endif.
get pernr.
cd-key-pernr = pernr-pernr.
perform import_cluster.
get_pernr_flag = 1.
check : ocd-version-molga eq calcmolga.
The table 'tabpernr' is filled with the personnel numbers
and is used after selection is finished.
move-corresponding pernr to tabpernr.
append tabpernr.
The table 'tab_rgdir' is filled
loop at rgdir.
rx-key-pernr = pernr-pernr.
unpack rgdir-seqnr to rx-key-seqno.
perform int_tab. "fill tab_rgdir
perform import_bt.
perform validate.
endloop.
End of Selection
end-of-selection.
*perform h_headr.
perform convert_date_a using pa_mth r_mth_t.
sort int_rep by bankl zlsch pernr betrg descending.
delete adjacent duplicates from int_rep
comparing bankl zlsch pernr .
sort int_rep by bankl zlsch bankn . "PERNR.
loop at int_rep.
at new bankl.
select single * into bnka1 from bnka
where banks = c_banks and
bankl = int_rep-bankl .
append bnka1.
clear bnka1.
endat.
endloop.
for Demand Draft - purpose added
loop at int_rep.
concatenate pa_year(4) pa_mth(2) '01' into dt_merge.
select single * "zweck into int_rep-zweck
from pa0009 where
pernr = int_rep-pernr and
bankl = int_rep-bankl and
zlsch = int_rep-zlsch
and begda <= dt_merge and
endda >= dt_merge .
if sy-subrc = 0.
int_rep-zweck = pa0009-zweck.
modify int_rep.
endif.
endloop.
*-for DD and Chq sorted by PAyable at and EMPNO wise
if p_zlsch = 'T' .
sort int_rep by bankl zlsch bankn . "PERNR.
else. "added for "payable at" for DD/Chq
else.
sort int_rep by zweck pernr . "PERNR.
endif.
*delete adjacent duplicates from int_rep.
t_int_rep] = int_rep[.
loop at int_rep.
*-for page of page no.
total_page = 0.
loop at t_int_rep where bankl = int_rep-bankl
and zlsch = int_rep-zlsch.
total_page = total_page + 1.
endloop.
pages = total_page div 25.
remain = total_page mod 25.
comment bcoz its adding one extra page no.
done as on 29/11/2004
if remain > 0.
pages = pages + 1.
endif.
**-end
at new bankl.
ctr = 0 .
new-page.
endat.
at new zlsch.
ctr = 0 .
new-page.
endat.
clear v_id.
select single natio
into pa0002-natio
from pa0002
where pernr eq int_rep-pernr.
*-testing......for soma
if ctr > 24.
ctr = 0 .
write:/1(80) sy-uline.
new-page .
endif.
ctr = ctr + 1 .
cnt = cnt + 1.
pack int_rep-pernr to int_rep1.
write:/1 sy-vline, 2(3) cnt intensified off,
7 sy-vline, 9(6) int_rep1 intensified off,
16 sy-vline,17(35) int_rep-ename intensified off .
if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
write : 47 sy-vline,48(15) int_rep-zweck intensified off.
else.
write:
47 sy-vline,48(15) int_rep-bankn intensified off .
endif.
write: 63 sy-vline,64(16) int_rep-betrg
intensified off currency 'INR',
80 sy-vline.
ws_betrg = ws_betrg + int_rep-betrg.
*-testing......for soma
skip.
write :
/1 sy-vline, 7 sy-vline ,16 sy-vline ,47 sy-vline,63 sy-vline,80
sy-vline .
*-end testing......for soma
at end of zlsch.
if int_rep-bankl = ' '.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = ws_betrg
importing
amt_in_words = amount_word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
w_val-word = amount_word.
concatenate 'INR.' w_val-word into w_val-word
separated by space.
write:/1(80) sy-uline.
write: /1 sy-vline, 7 'Total transfer:'(009),
64(16) ws_betrg intensified off currency 'INR',
80 sy-vline.
write:/1(80) sy-uline.
write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
80 sy-vline.
write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
80 sy-vline.
write:/1(80) sy-uline.
clear: ws_betrg,cnt.
skip 2.
write: /2 'Prepared by :'(010), '_______________'(013),
45 'Checked by :'(011),'_______________'(013).
skip 2.
write: /2 'Printed On ', sy-datum,
45 'Approved by :'(012),'_______________'(013).
clear sy-pagno.
endif.
endat.
at end of bankl.
if int_rep-bankl ' '.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = ws_betrg
importing
amt_in_words = amount_word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
w_val-word = amount_word.
concatenate 'INR.' w_val-word into w_val-word
separated by space.
write:/1(80) sy-uline.
write: /1 sy-vline, 7 'Total transfer:'(009),
64(16) ws_betrg intensified off currency 'INR',
80 sy-vline.
write:/1(80) sy-uline.
write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
80 sy-vline.
write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
80 sy-vline.
write:/1(80) sy-uline.
clear: ws_betrg,cnt.
skip 2.
write: /2 'Prepared by :'(010), '_______________'(013),
45 'Checked by :'(011),'_______________'(013).
skip 2.
write: /2 'Printed on ', sy-datum,
45 'Approved by :'(012),'_______________'(013).
clear sy-pagno.
NEW-PAGE.
endif.
endat.
endloop.
End of Page
end-of-page.
write: /2 'Prepared by :'(010), '_______________',
45 'Checked by :'(011),'_______________'.
*& Form IMPORT_CLUSTER
Importing Data from Cluster *
form import_cluster.
sy-subrc = 0.
rp-imp-c2-cd.
if sy-subrc eq 0.
if cd-version-number ne ocd-version-number.
endif.
endif. " SY-SUBRC EQ 0
endform. " IMPORT_CLUSTER
*& Form INT_TAB
Filling internal table tab_rgdir form int_tab.
*Fill internal table tab_rgdir.
move-corresponding rgdir to tab_rgdir.
tab_rgdir-pernr = pernr-pernr.
append tab_rgdir.
endform. " INT_TAB
*& Form IMPORT_bt
Import Values from Bank Transactions Table (BT) form import_bt.
rp-init-buffer.
RP-IMP-C2-RX.
rp-imp-c2-in.
if rp-imp-in-subrc eq 0.
if in-version-number ne oin-version-number.
write: / 'Schlüssel des Clusters RX:'(015),
rx-key-pernr, rx-key-seqno.
write: / 'The imported version of the cluster'(016), 'RX',
'is not current'(017).
write: / 'Imported version :'(018),
oin-version-number.
write: / 'Current version of cluster :'(019),
in-version-number.
stop.
else.
sy-subrc = 0.
endif.
else.
sy-subrc = 8.
write: /
'Inconsistencies between cluster directory and directory for'(020).
write: /
'No payroll results found for data in cluster directory'(021).
write : /
'Please contact hotline to solve the current problem'(022).
endif.
ws_fpbeg(2) = versc-fpbeg+4(2).
ws_fpbeg+2(4) = versc-fpbeg(4).
ws_fpend(2) = versc-fpend+4(2).
ws_fpend+2(4) = versc-fpend(4).
ws_mthyr(2) = pa_mth.
ws_mthyr+2(4) = pa_year.
check ws_mthyr = ws_fpbeg.
check ws_mthyr = ws_fpend.
loop at bt. "from pc209
int_rep-pernr = pernr-pernr.
int_rep-ename = pernr-ename.
int_rep-bankl = bt-bankl.
int_rep-bankn = bt-bankn.
int_rep-betrg = bt-betrg.
int_rep-zlsch = bt-zlsch.
append int_rep.
endloop.
IF P_BANKL ' ' AND P_ZLSCH ' '.
DELETE INT_REP WHERE BANKL P_BANKL.
ELSEIF P_BANKL = ' ' AND P_ZLSCH ' '.
DELETE INT_REP WHERE ZLSCH P_ZLSCH.
ELSEIF P_BANKL ' ' AND P_ZLSCH = ' '.
DELETE INT_REP WHERE BANKL P_BANKL.
ENDIF.
endform. " IMPORT_BT
*& Form CONVERT_MONTH
Fetching Month Text form convert_month using mth t_mth.
case mth.
when '01'.
t_mth = 'January'(023).
when '02'.
t_mth = 'February'(024).
when '03'.
t_mth = 'March'(025).
when '04'.
t_mth = 'April'(026).
when '05'.
t_mth = 'May'(027).
when '06'.
t_mth = 'June'(028).
when '07'.
t_mth = 'July'(029).
when '08'.
t_mth = 'August'(030).
when '09'.
t_mth = 'September'(031).
when '10'.
t_mth = 'October'(032).
when '11'.
t_mth = 'November'(033).
when '12'.
t_mth = 'December'(034).
endcase.
endform. " CONVERT_MONTH
*& Form CONVERT_DATE_A
Fetching Month Text * form convert_date_a using mth_t t_mth_t.
case mth_t.
when '01'.
t_mth_t = 'Jan.'(035).
when '02'.
t_mth_t = 'Feb.'(036).
when '03'.
t_mth_t = 'Mar.'(037).
when '04'.
t_mth_t = 'Apr.'(038).
when '05'.
t_mth_t = 'May.'(039).
when '06'.
t_mth_t = 'Jun.'(040).
when '07'.
t_mth_t = 'Jul.'(041).
when '08'.
t_mth_t = 'Aug.'(042).
when '09'.
t_mth_t = 'Sep.'(043).
when '10'.
t_mth_t = 'Oct.'(044).
when '11'.
t_mth_t = 'Nov.'(045).
when '12'.
t_mth_t = 'Dec.'(046).
endcase.
endform. " CONVERT_DATE_A
*& Form VALIDATE
text
--> p1 text
<-- p2 text form validate .
if p_bankl <> ' ' and p_zlsch ' '.
delete int_rep where bankl p_bankl.
elseif p_bankl = ' ' and p_zlsch ' '.
delete int_rep where zlsch p_zlsch.
elseif p_bankl ' ' and p_zlsch = ' '.
delete int_rep where bankl p_bankl.
endif.
endform. " VALIDATE
check this weblog.....
/people/dj.adams/blog/2003/11/13/food-for-thought-ldbs-and-abap-objects
Also , check the following link too.
http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
Regards,
Harish
Maybe you are looking for
-
To begin with, in file-explorer (.\system32\explorer.exe) normally, the new ribbon user interface in Win 8.1 does indeed display appropriate buttons depending on the currently displayed folder within the explorer.exe window. But when one re-parents
-
Wagetypes are not displaying on Payslip
Experts please throw some light on this.. Wagetypes are not displaying on Payslip. I Copied Standard Form CEDT to my own own form and saved as Variant. In PE51 I gave my form name as OM01 added wagetypes in Windows and Cumlation IDs I can see Waget
-
How to setup portal navigation
I am new to the portal and I am trying to setup the following portal navigation Top Level - Reports If user has been assigned the Sales Role, they should see under Detailed Navigation Sales Reports Report1 Report2 If user has been assigned th
-
is it possible to build a tree with the tree coordinates i have a tree cordinates field and the description of the co-ordinate in my database tree-coord description 1.1.2 AAA 1.1.3 aaa 2.1.2 VVV 2.2.3 TTR I have build
-
IPad 2 unresponsive except DFU mode, iTunes won't restore
Let me preface: the steps to resolve the issue I have provided on the Apple website did not work, please do not suggest them. Yesterday I received my replacement iPad 2 in a brand new sealed box after about a month of waiting and shipment issues. Ou