Jitendra Takalkar

Greenhorn
+ Follow
since Jan 12, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jitendra Takalkar

Yes, you can compare Bean classes.
Please refere org.apache.commons.beanutils.BeanComparator for more details from Apache commons - Apache Common BeanUtil
15 years ago
JSP
Serialization is the process of converting an object into a sequence of bits (binary). it can be persisted on a storage medium or transmitted across a network. Bean classes mainly used as a reusable components and can be transfer across a network, Thats why Bean class is inherited from Serializable interface. In the trasmitted network JVM reread the sequence of bits (binary) and for the instance of object again.
15 years ago
JSP
You may not have delcare/properly defined 'main' method in your class Testvb1.


15 years ago
HashMap is an implementation of Map interface. LinkedHashMap which extends HashMap i.e. implementation of Map interface. The differnce between the HashMap and LinkedHashMap is in the way of implementation of Hash table.

HashMap:
no guarantees as to the order of the map

LinkedHashMap:
it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering.
15 years ago
If A, B and C lines are anchor links then you can pass parameter using query string.

For example:
Assume servleturi map to your new servlet.

http://host:port/webapp/servleturi?type=A for line A
http://host:port/webapp/servleturi?type=B for line B etc

Use getParameter() method to get the value of parameter - type, as follows

String parameterType=HttpServletRequest.getParameter("type");


15 years ago
You can pass parameter to new servlet, javax.servlet.http.HttpServlet. based on the parameter value decide what you want to do. Use following API to get the value of parameter.

15 years ago
Problem statement:
==================
XYZ webbased system and users of system belongs to department. There are two departments
finance and personal. If requirement is for users belongs to finance department session time out
is 10 minutes and other than finance, users session timeout should be 30 minutes.

Possible Approch:
=================
1. Set default session time out using

<session-timeout></session-timeout>

to 30 minutes.
2. After successful user authentication check for the user department.

If department is finance Then
use

HttpSession.setMaxInactiveInterval()

API to override 30 min session time out
to 10 minutes and this session time will be applicable to that user not other users and there
session time out.
End IF


Hope this example helps you to get and clear understanding and about the difference between
use of

<session-timeout></session-timeout>

and

HttpSession.setMaxInactiveInterval()

.
15 years ago
Hi,

Please find the TestAray class which elemets if any duplicate value ..


This can be optimized ....

public class TestArray {

public static void main(String[] args) {
int[] myarray= {1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8};

int duplicateCount=0;
for(int i=0; i<myarray.length; i++) {
for(int j=i; j<myarray.length; j++) {
if(i!=j) {
if(myarray[i]==myarray[j]) {
duplicateCount++;
}
}
}
}

if(myarray.length!=duplicateCount) {
int[] newarray=new int[myarray.length-duplicateCount];
int k=0;
for(int i=0; i<myarray.length; i++) {
boolean isFound=false;
for(int j=0; j<newarray.length && !isFound; j++) {
if(myarray[i]==newarray[j]) {
isFound=true;
}
}

if(!isFound) {
newarray[k++]=myarray[i];
}
}
/*
* Output elements of new array.
*/
for(int i=0;i<newarray.length; i++) {
System.out.println(newarray[i]);
}

myarray=newarray;
}

/*
* Output of old array
*/
for(int i=0; i<myarray.length; i++) {
System.out.println(myarray[i]);
}
}

}
17 years ago
Hi,

Please try with following code ....



package com.capgemini.midlet;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.midlet.MIDlet;

public class CreateForm extends MIDlet implements CommandListener {

// diclaration
private Display display;

private Command exit;

private Form form;

public CreateForm() {

try {
display = Display.getDisplay(this);
exit = new Command("Quit", Command.SCREEN, 1);
StringItem Messages[] = new StringItem[2];
System.out.println("In TRy blok");
Messages[0] = new StringItem("I m in First Message", "Good Morning");
Messages[1] = new StringItem("I m In Second Message","Good Afternoon");
form = new Form(" Form Menu", Messages);
//form.append(new StringItem("I m in First Message", "Good Morning"));
//form.append(new StringItem("I m in Second Message", "Good Morning"));
System.out.println("After Form");
form.addCommand(exit);
//form.append(Messages);
//form.append(Messages);
form.setCommandListener(this);
} catch (java.lang.NullPointerException ee) {
ee.printStackTrace();
}

}

public void startApp() {
display.setCurrent(form);
}

public void pauseApp() {
}

public void destroyApp(boolean bb) {

}

public void commandAction(Command qcommand, Displayable dis) {
if (qcommand == exit) {
destroyApp(false);
notifyDestroyed();
}
}

}
17 years ago