hi,
i had a doubt that the output should come like 'F,10:'..but i m getting as 'F,10'..i tried so many times..i m not getting can any one suggest me where the code gets wrong...here i m sending jsp code,javascript code and servlet code..can anyone check it..i m waiting for the reply...its urgent.
login.jsp
login.js
login.java
Thanks and waiting for the reply,
madhu.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Having different input types (like text and checkbox) with the same name is a bug waiting to happen. Why don't they have distinctive names?
Also, the servlet code doesn't make sense - both branches of the if statement do the same thing (although it probably doesn't matter, because the "if" branch will never be executed, since "balrdysStr" is never null).
i had done it previously..i m getting wrong output..not the required out..here is my output code..
output:
login.jsp
login.java
i need to get the output as
can you provide me the solution for this...waiting for the reply..
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
ya where is your cubicle
Added check
String[] balrdys = request.getParameterValues("balrdys");
String balrdysStr = "";
for (int i = 0; i < balrdys.length; i++) {
if (balrdysStr == null) {
balrdysStr += balrdys[i];
} else {
balrdysStr += balrdys[i];
//added by Ravi
if(i<balrdys.length-1)
{
balrdysStr = balrdysStr +":";
}
}
}
check this out >
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Again:
Having different input types (like text and checkbox) with the same name is a bug waiting to happen. Why don't they have distinctive names?
Also, the servlet code doesn't make sense - the "if" branch will never be executed, since "balrdysStr" is never null.
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
no i don't this so , she is expecting output as F,10: how will she get desired output with out appending ":" at end of value
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi good morning,
i tried what you had given..i m getting same wrong output not the correct output...down i m giving the output..is there any method to get the correct output..i tried so many ways unable to get it...
I'd like to point out that :
1. You should read carefully what Ulf is telling you.
2. You need to describe your needs clearly, what you are expecting, and how you are expecting it to happen. I think it's useless to throw you semi-colons without understanding your needs. I still have no clue about that semi-colon you're dying to see in the output. For example:
"I click the checkbox whose value is "F," and enter "10" in the textbox. After submitting, I expect that the logic which retrieves the ""balrdys" values will result in "F,10:". I have to append the selected checkbox value, the entered text, and finally append a semi-colon to it". Something like that.
what you had replied is correct...if i click checkbox and if i enter the value in textbox both should be appended after submit button and the answer what i need is 'F,10:'
Ok. I'm still guessing :
If you select "F,", you want the Fresh Activation text appended to it ? -> "F,10:"
If you select "A,", you want the Auto-Renewal text appended to it ? -> "A,20:"
If you select both "F," and "A," -> "F,10,A,20:"
Is this something like this ? What about the "NO" checkbox ?
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
HI ........ its as simple as dat ...Madhu why dont you try what i am saying ...........
As Ulf said (please read his posts!!), giving the same name to all your components is not a good idea. Looping through the values returned by getParameterValues will give you unpredictable results. Why don't you give each component its own name, and get each values one by one ? You'll easily get the result you want by doing so.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi ravindra,
i tried its not getting... the output i got is
Instead of trying to give a complete solution, I think it would be better to leave madhuri try to understand where the problem is, and let him update his code after reading our recommendations.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi ravindra,
i got it...thanks for your support...my doubt was not still clarified...i m developing web-application...using jsp page i need to develop XML file...i created..i used what you suggested in my code...the problem is i m getting 2 times the element..i.e.,
Will you please update me with the code you are using to create xml
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
login.js
login.java
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
I havent worked on xml
but still modified the code combine A days and F days under Low Days tag ...
Element balrdysElement = doc.createElement("DAYS");
subchild.appendChild(balrdysElement);
Element balrdysElement1 = doc.createElement("LOW_DAYS")
Text balrdysElementText = doc.createTextNode(_Fdays+_Adays);
balrdysElement1.appendChild(balrdysElementText);
;
subchild.appendChild(balrdysElement1);
Text balrdysElementText1 = doc.createTextNode(_Adays);
balrdysElement1.appendChild(balrdysElementText1);
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
ok thanks i'll check it..do you have any idea regarding javascript...
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
_/\_ Yes ...go ahead ...you can post it in a new thread.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
the site you had given is not opening....i had created XML file...my doubt is how to do DML operations for XML file...for that i m using jsp page..if i enter the value in textbox it should validate that it is present in XML file or not...i have an idea how to do using Database...but no idea how to check the entered value in XML file..can you suggest me the solution..
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
hmmmm, no you need to read your xml file to do that validation sting matching operation for stting you are reading with value of your xml file ....
you are wrokining in which company ?
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i didnt got your point i work in IBM..what about you
ravindra patil
Ranch Hand
Joined: Sep 01, 2006
Posts: 196
posted
0
In Pune IBM ? , i am with Geometric ...
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
no from chennai,i need help can you suggest me what to do..its urgent