java

Jasper Report doc export margin problem

Hi there, Im using Jasper Reports to generate a word (docx) document but I have a problem when I want to try to print the doc. The exporter messes up the margins of the page. Does anyone know how to prevent that from happening. I know how to set the margin in iReport, but it just makes the data generate further from the page borders, b...

Java EE6 over EE5 ?!

We are at the edge of getting Java EE6 (with Glassfish v3 as reference implementation). Planned release is December 09. While still quite a number of companies are struggling to move their codebase to EE5 (from earlier versions), we are in the luxurious situation to start development of a new product and could choose to do it with EE6 as...

java FileInputStream - differences based on how the File object is referenced: classloader/filesystem

Hi all, I'm using apache POI to extract some data from an excel file. I need an InputStream to instantiate the POI HSSFWorkbook class HSSFWorkbook wb = new HSSFWorkbook(inputStreamX); I'm finding differences if I try to construct the InputStream object like InputStream inputStream = new FileInputStream(new File("/home/xxx/workspace...

JSF tags in JSF component renderer

Can i somehow add JSF tags to my JSF component renderer class? I'm trying in this way: writer.append("<f:param name=\"active\" value=\""+tabName+"\"/>"); But, this tag is not recognized by compiler as JSF tag. ...

How to convert Integer to Date in JSP page and then format that Date ?

I get following varaiable, but I cannot format Integer, so is there any way to convert Integer to Date in JSP page? <fmt:formatDate value="${c.dateInIntegerValue}" pattern="dd.MM.yyyy hh:mm"/> ...

java.net.MalformedURLException: no protocol

Im getting Java exception like: java.net.MalformedURLException: no protocol My program trying to parse XML string by using Document dom; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); dom = db.parse(xml); The XML string contains: String xml = "<?xml version=\"1.0\" ...

java - effective files copying

hi. i would like to know which is the best way to copy large number of files. ...

how to render javascript in server side

Hi, i m getting a web page content in a string by using java.net.URL and Input Streams. the problem i m having that my javascript is not rendering and i m getting the as it is response. <html> <head></head> <body> <script> document.write("<h1>hello world!</h1>"); </script> </body> </html> suppose this is the code written i...

Action tag is forced to use input result if outer action has action errors

I use Sitemesh as template engine with Struts2. In my decorator jsp file, I use for division content source. Now I encounter a problem that if an action has an action error, there will be a "input" result used. It will cause all in decorator JSP file also execute input result directly. That's means method won't be called. How do I ma...

How to refactor this code?

Please suggest in refactoring this code. Avoid code duplication, mutiple If's public FormDataDTO getDataForFieldFormCHrzntalField(Field field) { FormDataDTO formDataDTO = new FormDataDTO(); CHrzntalField cHrzntalField = (CHrzntalField) field; for (int j = 0; j < cHrzntalField.getFieldCount(); j++) { Field sField = c...

JAVA RMI Client side random ports

Hi, I have a java 1.4 RMI application. By using custom socket factory, I am running my RMI server in a particular port (5050). The problem is, when the RMI client application tries to communicate to RMI server from a different machine, random ports are being opened up in the client machine (Can see through TCPView.exe). Since, firewal...

Java: how to write out PDF to a text file?

When I open a PDF file and write the content to a text file the content from the text file is messed up. I think it's because of the encoding. From what I understand the JVM sets the default character set to Cp1252 (because I'm running on Windows XP). I've changed the default character set but with no results (System.setProperty("file.en...

swing, show a JList over a editable jTable to select entries to autocomplete the text

Hello World ! I have a JTable with editable cells. Each Cell contains a CarretListener for quick validation of the entered text. But in one special cell you should be able to select entrys out of a list. The List is generated when you enter a text. The Programm serach in a list for entrys equal so the entered text, like google suggest. ...

Java RegEx - Regular expression to split a paragraph with start and end ....

Hi All, I am new to java regex.Please help me. Consider the below paragraph, Paragraph : Name abc sadghsagh hsajdjah Name ggggggggg !!! Name ggg dfdfddfdf Name !!! Name hhhh sahdgashdg Name asjdhjasdh ...

Changing tab order in editor window of Intelli-J IDEA

Does anyone know whether it is possible to change the tab order that tabs are displayed in the Intelli-J IDEA? Sometimes it is handy to have two specific tab together so that it is easier to switch between them using either the mouse or 'ALT+LEFT' and 'ALT+RIGHT' respectively. If the two tabs are together it reduces the keystrokes requ...

Copy documentum content with apache IOUtils.copy() and setContent()

I want to copy the content from one object stored in one docbase to another object stored in another docbase. I do not want to create a file because I have more than 300 k files to copy. Below is a part of my code: ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(source.getContent(), baos); [...] targetObj.setCon...

How to handle different versions of xsd files in one java application?

The Facts In my java application I have to handle XML files with different schema versions (xsd files) simultaneously. The content of the XML files changed only a little between the different versions, so I'd like to use mainly the same code to handle it and just do some case distictions dependent on the version of the used schema. Cur...

Get html data from a web page which is populated by ajax

I've a web page on which certain section is being populated by ajax. I want this data. I've written a java program which posts the data and submit the form but unable to fetch the ajax content of the response. My application is a core java app. I'm simply posting data/submitting form with all request parameters set correctly. But not ...

Find user independent TEMP directory with Java

Hi, when running a Java application as service with the user 'LocalService', the temp directory ("java.io.tmpdir") points to 'c:/windows/temp' (for example). Running a Java application normally gives 'c:/documents and settings/user/local settings/temp' instead. How can I determine the user independent temp folder 'c:/windows/temp' whe...

Removing pause after reading using readLine in java

I am reading several lines from the console in a java program using the readLine command from the BufferedReader class. However, the program pauses at the end of the last line and does not proceed until i press return. How do I eliminate this pause? ...