Featured Post

Field Marshal Sam Manekshaw on leadership

Field Marshal Sam Manekshaw on leadership I had a chance to read this article recently and just loved the way he describes leadership...

Wednesday, June 28, 2006

input type="image" submit's the form

When we have a input type="image" inside a form then that image link can be used to submit the form. No need to write seperate onclick function to submit the form.

This can happen only for input type="image". It does not apply to img src="".....
Need to take extra care when using input type="image". Or else form will be submitted.

Monday, May 22, 2006

Dynamically adding text box in JSP

You can dynamically add text box on runtime when you click on add Button.
Assume you need to create a text box and on run time when you click on add button.
Create a for loop around the text box and on click of the add button increment the for loop condition variable.
for Example.

for(int i=0;i<=count;i++){
text box code.....
}

Add Button.(onClick="javascript:reloadPage();");

when the add button is clicked in the javascript code resubmit to the page.
On top of the page in scriptlet have a variable called count initialise to 1.
for Example: int count = 1;
When the page reloads increment the count with 1. like count++;
Now the count will be 2 and in forloop 2 text box will be created.
If u need the value of the 1st text box to retain. Take that value in request and reassign to the text box.
For text box have the variable as textbox<%=i%>
So each time the loop comes it will create dynamic text box.

Tuesday, March 21, 2006

System.out.println OR out.println

When u get any error in JSP this first step to find the problem is to give System.out.println(If you want to see the output in console) OR you can use out.println(If you want to see the output in the screen itself). Try to give as much as possible.
Right click on the jsp you might get a null pointer exception in the view source.

Sunday, March 12, 2006

Shortcut debug technique for developers in JSP/JAVA

I have intended to start this blog as a first step to get my thought on the web. There are many ways to debug an application. Many of them have their own style. I intend to put some of my ways of debugging. I am not sure if this will help you to solve your problem. But just give it a try may be its saves your time.:-)

Google Custom search

Custom Search