Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!

vivek ja

Ranch Hand
+ Follow
since Feb 24, 2005
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 vivek ja

I am moving to India from US next month. Going to settle down in India. For the last 3 years I have been in the US and I have been a consultant mainly working on J2EE technologies. I have started applying for jobs in India, getting emails from some vendor companies, but no calls yet. A couple of them told me that only once I get to India I can start looking. I wanted to get some job offers if possible when I am in the US. Anyone who has experience in moving back to India, can you please advice? I have a total of 8 years of industry experience, how is the market now in India?
12 years ago
I submitted the above before completing the message. Sorry!
I am not sure how to access indexed fields
Can someone please help me out with this?
12 years ago
JSF
I have a datatable which contains rows of textboxes. I want to validate each of these input fields.
I get a nullpointer exception on UIComponent.findComponent.
This is how I access the value
uiComponent.findComponent("selectForm:invoice:0:amount")
uiComponent.findComponent("selectForm:invoice:0:name")
etc.,

where each row corresponds to an Invoice bean that has getters and setters

I am not sure if this is the right way to access the field.
12 years ago
JSF
I am trying to do some cross field validations in JSF. I am doing it manually in my backing bean.
Is there a way to check if the message for a particular field is empty?

<c:if test="#{ empty message.userName}" >
doesnt seem to be working.I know there is a way to check if there are any messages using rendered="#{! empty facesContext.maximumSeverity}"
But in my case I want to check for specific field error messages.
Depending on that I have to apply a new stylesheet to my text box. Can someone help. Thanks!
12 years ago
JSF
I am trying to do the validation using JSF validator interface.
For some reason the control is not reaching m y validator code at all.
I tried a system.out inside the method and its not printing out.
Any help is appreciated!

Here is my code:

public class MyValidator implements Validator {
public void validate(FacesContext context, UIComponent uiComponent,
Object object) throws ValidatorException {
System.out.println("in the validator method");
validateSomething(context, uiComponent, object);
}


In the faces-config i have
<validator>

<validator-id>MyValidator</validator-id>

<validator-class>
com.abc.MyValidator
</validator-class>

</validator>

In the JSP i have
<TD class="textBoxNew">
<h:inputText id="text1" value="#{UserBean.field1}" >
<f:validator validatorId="MyValidator"/></h:inputText>
</TD>

Am i doing anything wrong here?
12 years ago
JSF
Thanks for the input. I have implemented that with CSS. just wanted to see if JSF has some tags or any functionality that provides this. Thanks!
12 years ago
JSF
I have a requirement to hightlight input text fields in JSF
I am new to JSF and I dont see any information on this on the net.
Can someone tell me how to do this?
I see that it can be done with MyFaces, but I cannot use that.

This is my inputtext code
<h:inputText id="name" value="#{UserBean.name}" >

Thank you in advance
12 years ago
JSF
Hi,

I am having a problem with the hibernate mapping file (something.hbm.xml)
I have 1 field defined as a VARCHAR in the database.
I have defined it as a String in the java file, and given type="string" in the hbm file.

There is a field in the database with type SMALLINT. In the hbm file i have type="short" for that field. In my java class, i tried both short and java.lang.Short for that field and nothing works

When i use this driver, it works fine
Driver name: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource

But when i use this driver, it gives me an error
com.ibm.db2.jcc.DB2ConnectionPoolDataSource

Caused by:
com.ibm.db2.jcc.a.SqlException: Query processing has been terminated due to error on the server.

Can anyone give me a clue as to what to look for that will make it work with that jcc driver?
I have a column in the database with TIME datatype. THe values in the colums look like 12:06:23 etc., When i try to do a
where >='12:06:23' using winsql it works

But when i try to input the same using my java program using hibernate, when it reaches the hibernate SQLLoader file, it chaanges this value to
'12?' and gives error:
"The syntax of the string representation of a datetime value is incorrect."

I have tried declaring it as String, java.sql.Time, java.sql.Timestamp.
Nothing works. Anyone has any different ideas to make it work?
I am trying to figure out what a database field stands for,....
I have fields like 00000001153858800000, 0000009223372036854775807 etc.,

I thought this could be a timestamp and tried to get a date out of it
This is the code I am using.
When i put in 1153858800000L, it gives me
Day: 2
Month:6
Year 2006

But when I enter 9223372036854775807, looks like i am way off the mark.
it gives me year:292278994, day :0


public class TimestampTest
{

public static void main(String[] args)
{
//1153858800000L
long startTime =9223372036854775807L ;

Date startDate = new Date(startTime);
int year = startDate.getYear()+1900;

System.out.println("Day: "+startDate.getDay());
System.out.println("Month: "+startDate.getMonth());
System.out.println("Year: "+year);
System.out.println("time : "+startDate.getTime());
System.out.println("Hours : "+startDate.getHours());
System.out.println("Minutes: "+startDate.getMinutes());
System.out.println("Seconds: "+startDate.getSeconds());

}
}
I just realised that the method myMethod is in the superclass of the newForm class.
I tried writing that line invoke(newForm, obj) and its still giving the same error. If it is there in the superclass, then wont i be able to access it??
14 years ago
I have the following code

Class c = Class.forName(newForm.getClass().getName());
Method method1 = c.getMethod("myMethod", parameterTypes);
Object[] obj = new Object []{listOfStudents};
method1 .invoke((Object)c, obj);

Can someone tell me what this method invoke() takes as parameters? I am now giving the class that contains the method, and a list. (the method myMethod takes List as parameter)
I am getting IllegalArgumentException on the method1.invoke line when i run this code currently
14 years ago
Sorry the file is validation.xml
14 years ago
I want to specify an item thats part of a List
In the form it a list of Products and each product has a number
So it is like this
List productList = new ArrayList();
and Product bean contains the field productNumber

This is the entry in my validator.xml
<field property="productList[0].productNumber" depends="minlength, maxlength">
....

Actually there are many products, so validating it one by one hardcoding the indexes doesnt seem to be a good idea. Is there anyway I can specify this generically like this. <field property="productList.productNumber" depends="minlength, maxlength"> But the above gives an error
Pls help!
14 years ago
I have a string, and I want to replace all the underscore characters with
pound sign and underscore

I want to do something like this
value.replaceAll("_","#_")
and it is not working.
Can you tell me why this is not working? I tried to see if there
are other methods that do it, but when i read the descriptions, this method's description is exactly what i want to do. pls help
14 years ago