gaurav kant

+ Follow
since Oct 06, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gaurav kant

Here i am expecting that You have created text boxes as much as You need on page with the help of java script (if not then tell us, i will tell you ).
now put name Your test boxes say You have 3 text boxes

put another hidden text box (say "allTextName") in which You will store comma separated string of name of all text boxes for example "allTextName" value will be "textBox1,textBox2,textBox3"
and while adding or deleting text boxes, update "allTextName".
Now in Your action class, simply get
request.getParameter("allTextName") and tokanize it through ",". at this point You have all the names of textboxes just put in request.getParameter() and fetch the values

Hope it will work
11 years ago
11 years ago
Then why don't you go for 1st option given by me in last reply ....
11 years ago

samir singha wrote:why don't you pass the bean object (fb in your case)created in your servlet to your java class through constructor or method parameter of your java class and get the value from bean object.

Both are the same things. either direct fetch values from request or do one more step in which first populate bean then use in another class. Do any way you think is good
11 years ago
Yes, you can do. Just import javax.servlet.http.HttpServletRequest and use it. i am sure about it. It will ease your life
11 years ago
If you are looking for MVC then you have many choices, here i am suggesting you two of them
1. Follow MVC in your current running Project.
a) create a controller servlet that will decide the flow
b) For all the business logic create beans and access these beans in your JSPs
c) All the presentation includes in JSPs using EL or JSP tags or scriptlets
i don't think that using scriptlet in JSP is a bad thing. But you must not put your business logic in JSPs or big codes should not be placed on JSPs. If you need some small codes just put in JSP. I agree that scriptlets should not be used in JSPs but it can be used for small codes.

2. Follow Struts:
Its a good practice to follow struts framework. This framework is based on MVC architecture. It make the system robust, powerful and well designed.

Please correct me if i am wrong at any point
11 years ago
There is no need to recompile a file that has been compiled earlier. This is for the sake of surety that you have latest classes in you build. Suppose you have a vast number of files and you had made some changes in say 60 or 70 files and if you by chance forget to copy 1 or 2 files in your build, what would be the result ? For this we just compile all the files not to leave even a single file and i think there is no harm to do this just before production. what do you think?

one more thing. ANT compiles only those file that have been modified and never touch unmodified files. clean means delete all those files that you have specified in command (in ant script) from build and run ant command by which ant can recompile and place into your build all those deleted files just to ensure that you have latest code in build.
11 years ago
as i think, you can use ANT with out "clean" command when you are not doing any serious deployment like testing or when work is going on (i.e. coding and you are just checking your code working). But you must go for complete clean and build your project when you want to create WAR for production or deployment on server.
Please correct me if m wrong at any point
11 years ago
Why don't you do things in this way.
lets take an example :

suppose you have 1 text field named "myText" in jsp. you submitted form to your servlet in which you have called a java class.
Now myText comes in your servlet inside request object. you do 1 thing. pass this complete "request object" inside your java class constructor and assign it to instance variable and then use it in your methods.

some thing like this

Servlet side code:

MyClass side code:

11 years ago
As i think, if you simply run ANT with out clean command, it builds only modified classes, other classes remain untouched. But this is not a good practice if you are building it for your production. you should clean it every time before creating WAR file. because some times even modified classes do not get any change (i have faced many times)
11 years ago
Please suggest me a book in which examples are not of swings or AWT. actually i dnt know ny thing abt swings or event handling so i m looking for a thread book in which i can find simple java examples
12 years ago
it is a huge data(more than 10,000 characters) dat i wanted to print.

lets assume dat data , comming from database is "this is complete text"

and when i m trying to print it is printing only " this is compl"

i think this problem is comming due to jdbc driver
database is returning complete text and wen i m trying to extract proc.getNString(1); it is giving exactly 4000 characters. remaining is being truncated.
sorry dear, in future i wll keep this in mind.
i m working on sqlserver2005,
is it possible to use CLOB ?
but anyways, i have used it like this

CallableStatement proc = conn.prepareCall(procedureString);
proc.registerOutParameter(1, Types.CLOB);
Clob aclob = proc.getClob(1);
Reader charsRead= aclob.getCharacterStream();
char[] textBuffer = new char[1024];
int position = 1;
String myString="";
while (( != -1) {
String str=new String(textBuffer);
textBuffer = new char[1024];
System.out.println("MyString :::::::::::: ");
wen i m printing this string , it is showing the same as it was earlier.
m i doing nything wrong?
m calling a stored procedure from sqlserver that is returning a NVARCHAR(max) type value.

code is like this

String procedureString="{call getname('12',?)}";
CallableStatement proc = conn.prepareCall(procedureString);
proc.registerOutParameter(1, Types.NVARCHAR);
String str=prov.getNString(1);

now. database is returning a string and length of this string is more than 8000 but nvarchar size is 4000 atmost so it is truncating characters comming after 4000 place.
can nybdy help regarding this