Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Vaibhav Deshpande

Ranch Hand
+ Follow
since Apr 26, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vaibhav Deshpande

Hi All,

I have one input text field. Its readonly attribute is set to true. The value in this field is "JAVA RANCH".

Now using javascript I make thsi field enable by setting readonly="false".

After enabling this field, I enter some new data like "SUN JSF".

When I click on the submit button the backing bean is not getting update with the new value "SUN JSF". The set method of the bean whcih is associtaed with this field is not called.

My backing bean is in session scope.

any idea why this data is not submitted to server even though the feild is now enabled?

Thanks,
vebs
10 years ago
JSF
Hi All,

I have one input text field. Its readonly attribute is set to true. The value in this field is "JAVA RANCH".

Now using javascript I make thsi field enable by setting readonly="false".

After enabling this field, I enter some new data like "SUN JSF".

When I click on the submit button the backing bean is not getting update with the new value "SUN JSF". The set method of the bean whcih is associtaed with this field is not called.

My backing bean is in session scope.

any idea why this data is not submitted to server even though the feild is now enabled?

Thanks,
vebs
10 years ago
JSF
Any one there to help me out???

vebs
10 years ago
JSF
Hi All,

I am trying to use tomahawk custom components in my jsf applicaiton which is build using SUN JSF implementation.

I have added on my xhtml page following
xmlns:t="http://myfaces.apache.org/tomahawk"

and the component tag:
<t:htmlTag value="b">INDIA</t:htmlTag>

The problem is that above mentioned compoment doesn't get rendered. In the vewi source of the screne it is same as <t:htmlTag value="b">vaibhav</t:htmlTag>

I am using jar tomahawk-1.1.6.jar.

do i need to update my web.xml or any other confuiguration.

warm regards and thanks
Vebs
10 years ago
JSF
hello,

thanks for your quick replies.

As an example we can say my Transfer object having one variable which is returning a "int" value. But my POJO which need to be set have a class object for this int. It means I need to map this int to a class.

So reflection will be not useful for me.

Main prob is that structure of transfter Onject from backend and POJO wghich will be used to display data are diffrent.

another example is my backend is sending me 2 boolean values true and false and in POJO this is actually class which will showing drop down on screen.

thanks,

Vaibhav
11 years ago
Hello All,

I am getting one transfer Object from my backend. I want to copy this trasfer object data into my model beans (POJOs). The problem is that transfer object and my model beans do not have same structrue or mapping. I want a genric way to do this copying of data. otheriwse it will be tedious to write lengthy code.

thanks in advance.
11 years ago
Hi,

I have to microsoft word files. What I want to obtain through my application is to append content(data) of first file to second file.

my code is as follows. When i run this class a new micorsoft word file with name final get generated but it contains data and all binary data. so some problem may be with my code can some one help me out.


package com.wow.framework.proploader.javafiles;

import java.io.*;


public class Appender {

// Returns the contents of the file in a byte array.
public static byte[] getBytesFromFile(File file) throws IOException {
InputStream is = new FileInputStream(file);

// Get the size of the file
long length = file.length();

// You cannot create an array using a long type.
// It needs to be an int type.
// Before converting to an int type, check
// to ensure that file is not larger than Integer.MAX_VALUE.
if (length > Integer.MAX_VALUE) {
// File is too large
}

// Create the byte array to hold the data
byte[] bytes = new byte[(int)length];

// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
}

// Ensure all the bytes have been read in
if (offset < bytes.length) {
throw new IOException("Could not completely read file "+file.getName());
}

// Close the input stream and return bytes
is.close();
return bytes;
}

public static void append(String fileName1, String fileName2) throws Exception
{
File f1 = new File(fileName1);
File f2 = new File(fileName2);

File finalFile = new File("C:/vebs/daemon/final.doc");

byte[] buffer1 = getBytesFromFile(f1);
byte[] buffer2 = getBytesFromFile(f2);

//BufferedOutputStream fw = new BufferedOutputStream (new FileOutputStream(finalFile, true));
FileOutputStream fw = new FileOutputStream (finalFile);

byte[] buffer3 = new byte[buffer1.length+buffer2.length];

System.out.println("buffer3.length = !" + buffer3.length + "!");

for(int i= 0 ; i < buffer1.length;i++) {
buffer3[i++]= buffer1[i];
}

int length = buffer1.length;

for(int i= 0 ; i < buffer2.length;i++) {
buffer3[length++]= buffer2[i];
}

fw.write(buffer3);

fw.close();
}


public static void main(String[] args)
{

try
{
append("C:/vebs/daemon/to.doc", "C:/vebs/daemon/from.doc");
}
catch(FileNotFoundException fnfe)
{
System.out.println(" does not exist");
}
catch(Exception e)
{
}
}
}


thanks,

vebs
12 years ago
Hi All.

All I want to do is that I want to open my uploaded word doc in browser on my jsp in IE. now i want that user should be able to format that word doc and save it through IE. And all other his data will also get saved.

Is it possible to open word doc in IE through JAVA programming and format that word file and save it without lossing its formatting.

thanks,

vebs
13 years ago
Hi ,

I want to read a .doc file from directory location and write it to new file with .doc extention.

I am able to do taht with java I/O API . but problem is that when i tried to open new craeted file, word shows error that path name is invalid.
I think file get curropted during writing process.

in my jsut previous post i also included code .


CAn some one help me out.

tahnks,

vebs
13 years ago
Hi All,

I am just trying to read from one doc file and writing to another word doc file. this application runs file. But problem is that when i went to that directory and tries to open that new written word file it is not opening it showing error that some path problem taht is .
Document name or path is invalid.

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class filewriter {

public static void main (String[] args) throws IOException {

String readLine = "";
File tempfile = new File ("C:/test/test.doc");
File newFile = new File ("C:/test/resumes/result.doc");


try{
BufferedReader br = new BufferedReader(new FileReader(tempfile));

BufferedWriter out = new BufferedWriter( new FileWriter(newFile));

while ((readLine = br.readLine()) != null) {
out.write(readLine);
}
br.close();
out.close();
}catch(IOException e) {
System.out.println("exception");
e.printStackTrace();
}
System.out.println("no exception");
}
}
13 years ago
HI All,

My database is MYSQL and using struts framework.

I am trying to run one sql that is

Select GC.GEN_Code_Id, GC.GEN_Code_Type_Id, GC.GEN_Code
From GEN_Code_Types GCT, GEN_Codes GC
Where GCT.GEN_Code_Type_Id = GC.GEN_Code_Type_Id
And GCT.GEN_Code_Type = 'US_Military_Service_Code_Id'
And GCT.GEN_Valid_Record_Flag = 1
And GC.GEN_Valid_Record_Flag = 1
Order By 1

THis sql executes file.

I am writing code like

result = resultset.getString("GC.GEN_Code");
The above line executes fine in window env. but same code when tried to run on linux m/c
I got error msg for above lien that "GC.GEN_Code" column doesn't exist.
Marc,

I have get and set methods for country but still i am facing same error.

vebs
13 years ago
Hi All,

I am new to struts. I just want to show drop-down box with values od states hard coded.
my code in jsp is like this

<html:select property="country" size="1">
<html ption value="US">USA</html ption>
<html ption value="JPN">Japan</html ption>
</html:select>

I have get and set methods in my Form class for country field

when i try to run my page it gives error msg and page doesn't displayed

no getter method availabe for property country in org.apache.struts.html.BEAN

* I jsut want to show values in drop down with hard coded values.
I tried on web but all info is realted to collection and all other stuff.

can some one plz help.

vebs
13 years ago
Hi All,

I want to remove a Jtable which is painted on a frame.
What problem i am facing is that when first time user selects a text file
data of that file get populated into jtable. if user now again selects one file a new Jtable get opened and get populated.
What I want is to remove that first one jtable.

thanks,

vebs
13 years ago
Hi All,

I am using eclipse 3.0 and using pugin Jboss IDE 3.2.3.
When i am runing Jboss server through eclipse i am getting folowing error

ERROR [MainDeployer] could not create deployment: file:/C:/wowdev/portal/jboss-3.2.3/server/default/deploy/nukes-ds.xml

whats is the reason for this error.
I am using databse mysql. nukes will be used.

thanks,
Vaibhav
13 years ago