Win a copy of Terraform in Action this week in the Cloud forum!

Prasanna Soundarapandiyan

Greenhorn
+ Follow
since Sep 04, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
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 Prasanna Soundarapandiyan

If i am not wrong you can try out onething, onchange or onclick of any where in the screen , process an ajax call without any action. Just a simple server hit. There by you can avoid session getting timed out.
10 years ago
JSP
in the doPost() , you have added the domList directly to the request, but while reading in jsp, it has been trying to read from dao.domList, Please try readin the domList directly inside the c:forEach.

<c:forEach var="dl" items="${domList}">
10 years ago
JSP
could you please provide the jsp form tag code? and also the have you checked whether you are adding the list to your action form? Provide the information what is the dao that you used in your code.

if possible place your jsp and servlet
10 years ago
JSP
I would prefer using a normal button instead of a submit button, and in the java script submit the forms as follows,

<button type="button" onclick="submitForms()"/>

<script type="text/javascript">
function submitForms() {
document.forms["f1"].submit();
document.forms["f2"].submit();
}
</script>

Thanks
10 years ago
JSP
Sorry man. I was considering them as method calls alone. But as per the fact you need to update the values to your action form and then you should call your ajax method.
For this,
1. create a flag variable like isNewUserAdded (with default values as "NO") in your form, when ever you are doing ADD MORE, while hitting the action set the variable as "YES". Then return back the response to jsp
2. Create a hidden variable in your jsp which maps to this value i.e <input type="hidden" id="isNewUserAddedFlag" value="${form.isNewUserAdded }" />
3. In the javascript on load of the jsp, if isNewUserAddedFlag is "YES" call the ajax method.
if (document.getElementById("isNewUserAddedFlag").value == "YES") {
addMore();
}
------------------------------------------

If the above solution doesn't work out, try this,

1. Create three string array variables for Name, Email and Phone.

2. On Click of ADD MORE dont use any ajax just dynamically add input text boxes alone with the same property as the first one.

3. Provide the values and submit the form. The string arrays will get populated with values seqeuntially in all the three arrays.
Note: I am not sure about this solution, try this out.
10 years ago
JSP
There are two possible solutiosn to this,

The simple solution may be
1. Try calling your addMore() method within the updateValuesInForm();
like

Calling like above ensures addmore() getting called after the functions in updateValuesInForm()

2. If you dont want to go with the above you may need to manipulate the formbean to accomodate or add the user details by implementing dedicated getters and setters. But i hope solution 1 will work as per your comments.
10 years ago
JSP
Well, its really a nice question..

The reason for this behaviour is the implementation of TreeMap. while trying to remove an object out of Treemap, you are calling map.remove(key) method. Please see the implementation of remove method for Treemap,



So, if you dont have any object in your map, then its size will be 0, and obviously it will return null only with out allowing further processing.
10 years ago
In Struts higher versions (above 1.2.0 i guess ), the usage of ActionError is depricated, hence the following code will help to resolve it if you want ,

Use your code similar to the following in your action class to add the action errors,

ActionErrors errors = null;
errors = (ActionErrors) request.getAttribute(Globals.ERROR_KEY);
if (errors == null) {
errors = new ActionErrors();
}
errors.add("Global Error message", new ActionMessage("error.provided.in propertiesfile"));
request.setAttribute(Globals.ERROR_KEY, errors);

12 years ago
Hi Dhanji Prasanna .. Welcome