You have two style attributes, place both the height and width in one like this:
<button style="width:126;height:29" onclick="history.go(0)" ><img src="admin/images/reset_btn.gif" /></button>
You have two style attributes, place both the height and width in one like this:
<button style="width:126;height:29" onclick="history.go(0)" ><img src="admin/images/reset_btn.gif" /></button>
Have u tried setting the target of the form to "_self" like this:
<form id="buttons" method="post" enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" target="_self">
Why would u want to disable to back button?
U can read this http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911
this is the first time i m hearing of tags being optional, and luckily too.
i m way too used to closing tags and if i had know that sooner, i most probably would of not closed a lot of tags and become a sloppy programmer.
Thanx SOS, i was able to get all the elements using the elements tag, but had no idea about the getElementByTagName, this will make my life so much easier. Thanx again.
I have a couple of div tags inside a form, inside those tags, there are input elements, i would like to know if there is a way to loop over all the input elements that are inside the div tags.
This has to be dynamic as i will not know the exact number of div tags or elements.
Any ideas or directions for me to search.
Thanx.
it is not good practice to connect to a database using jsp, rather use a servlet, and there are loads of examples online for connecting to a db using a servlet.
If u tried my code, it will prevent u to enter any non-numeric characters, i am using both FF and IE6 to test it, and it works, yes u are right it does print out a message telling u that u have to use numeric characters only, but u can take that step out and the function will look like this:
function checkNumeric(entry)
{
var numeric = /^[0-9]*$/;
entry.value = entry.value.replace(/[^0-9]/g,"");
}
when u type in there it will remove the characters as u type it in.
sure here it is:
<table>
<tr>
<td>Display Limit:</td>
<td><input type="text" maxlength="5" style="width:95px;" name="displayLimit" onkeyup="checkNumeric(this)" id="displayLimit" value="100" /><span id="errorText" style="padding-left:5px; display:none;" class='errorTextClass'>Only numeric characters</span></td>
</tr>
</table>
I can help u out with the numeric one, if u search for regular expressions to restrict alpha and special characters, u should find something that works in both.
function checkNumeric(entry)
{
var numeric = /^[0-9]*$/;
if (!numeric.test(entry.value))
{
document.getElementById('errorText').style.display = '';
}else{
document.getElementById('errorText').style.display = 'none';
}
entry.value = entry.value.replace(/[^0-9]/g,"");
}
you can go here http://articles.techrepublic.com.com/5100-10878_11-1044655.html
There are loads of other examples i just googled "restricting input to only text " and that is where i found the above link
I used regular expressions to prevent the user from entering non-numeric characters:
function checkNumeric(entry)
{
var numeric = /^[0-9]*$/;
if (!numeric.test(entry.value))
{
document.getElementById('errorText').style.display = '';
}else{
document.getElementById('errorText').style.display = 'none';
}
entry.value = entry.value.replace(/[^0-9]/g,"");
}
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.Open("GET","index.jsp",true)
xmlhttp.Send(null)
xmlhttp.onreadystatechange=state_Change
}
should be
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.open("GET","index.jsp",true)
xmlhttp.send(null)
xmlhttp.onreadystatechange=state_Change
}
U were using captial letters for open and send
Try google, there are loads of examples available.
If u are posting the value to a servlet, set the value as a session, and then call that attribute in your second jsp, or servlet that u are on.
Lets start off simple, first u will need to put your fields in a form tag.
Your update button should then submit the form.
I have no idea how to use ruby on rails, but to make a div unique, use some id from the db and place in the html code something like:
<div id='<%==h c.name%>' >test</div>
I could be wrong since i no longer program in asp but i think the code supposed to look like this:
<%=Request.QueryString["donor"].ToString().Substring(1,9)%>
From what i remember if u want to display something u have to write it out, u have to use "<%="
I definitely know that this
<input name="donor" type="hidden" value="<%Request.QueryString("donor").ToString().Substring(1,9)%>">
should be
<input name="donor" type="hidden"value='<%=Request.QueryString("donor").ToString().Substring(1,9)%>'>
I would suggest using a bean, and then using the getter method on the jsp to get the information from the servlet.
Are u calling the two in the same ajax call, if u are the last one always gets fired.
can u provide some more code.
aah i understand now, (stupid me:$ )
try something like this:
<body onload="window.location.hash='bot'">
<div id="content" style="width:200px;height:125px;overflow:auto;color:#000000">
whatever u want to say in it
<a name="bot"></a>
</div>
</body>
dont go crazy, these things happen, and sometimes it will be a stupid thing that causes everything to break. But thats the fun of programming. :)
i think it must be the data, try changing the data that is used in the french recordset to the english or arabic one, without changin the code. if that works then it is definitely something in the data.
could also be double quotes somewhere in the string.
Just picked up something else:
shouldnt your hilighted portion look something like:
if session("CurrentLanguage")=cl then
sSub = Rs1(GetFieldName("Caption_A")) & ""
end if
if session("CurrentLanguage")=clF then
sSub = Rs1(GetFieldName("Caption_F")) & ""
end if
I think it might have something to do with what it is pulling from the database, write out the sql, maybe there is some double quotes or reserved words in the sql.
I m not too sure if i am understanding your question correctly, but if u dont want to see the scrollbars then take out the overflow attribute from the div tag.
When u dynamically get teh data, why dont u get it so the latest will always be the first line in the element.
Thanx for the help, i have solved my problem, it was the form tags inside the table tag, so i moved my form tag above the table tag, and now it displays perfectly. :)
first thing i noticed is that your comparison sign is incorrect:
If rs("distance")>25 Then Exit For
should be
If rs("distance")<25 Then Exit For
I would also change the loop, to loop till end of file instead of using the counter i, what if the records that are less than 25 are in the fileds that are not extracted by your counter.
Hope this helps a bit.
I have tomcat, but am using bea weblogic server., and tomcat is not running.
no errors displaying in firefox, is there another tool besides firebug?
I am getting no errors, part of the jsp is not displaying, if i view the page in a separate window it is there, but not when it is view as an inlude in my index page.
My page works like this,
I have an index page, which includes (lets call in pageA.jsp) i click on a button to go to pageB.jsp, then when i click back and call the struts action for pageA.jsp the heading on that page displays, and the table but none of the fields. I am using ajax to change from pageA to pageB and back again.
At first i thought it could be html tags not closing, but that isnt the case.
I too have a similar problem, i can see the code in the source it is just not visible, and i have no clue why :'( , i hope someone will be able to help
To check if a value is empty u need to use "==" and not a single equals to sign.
I would change the submit button to a normal button, and use the onclick instead of onmouseup.
I mananged to get this working, i was resetting the session bean, but now its working.
Hi
what i want to do is create a session scoped bean in my servlet and also get the values in that same servlet
i have created a bean in my servlet with a session scope(not sure if it really is in session scope) using this code:
HttpSession session = request.getSession();
NavigationBean nav = new NavigationBean();
session.setAttribute("nav", nav);
I first write out the beans using:
html += "currentpagebean = " + nav.getcurrentPage();
html += "<br />previouspagebean = " + nav.getpreviousPage();
I then set them if they are null
then display them again to make sure they get set.
all that works fine.
Now when i go to another servlet the values of the initial printing out of the beans is null.
I am not sure what i have done wrong. Things that could be affecting it, and maybe it is, is that the above servlet is an attribute member of two other servlets, i used composition.
Also could it be resetting itself since it processes all the code again?
Please help
T
It turns out by some fluke my collection returned the results in the correct order the first time i ran it, subsequent running of the sql statement, proved that the order by clause was not being processed.(We are usiing another companies methods to generate the sql query. their other method which supposed to allow a person to add and order by clause to the sql query is not working.)
Any way, i think if the methods were working correctly my iteration would work.
sorry for wasting your time.
I m leaving it unsolved for now, incase once they fix up the method, it still doesnt work .. :)
Hi
I have a collection which is the resultset of a sql query.
when i write out the collection (using system.out.println(col)) my collection is in the correct order. -- which is great.
But when i iterate through the collection in order to populate my linkedhashmap, the items are inserted into the linkedhashmap in a different order.
Is there any way to keep the order of the resulset, and put it into the linkedhashmap so i can display it in the corrrect order?
Thanx
T
Tequila, smirnoff spin, nesquick
I too am new, but ClassNotFoundException is generally caused by the class file not being in the correct location. HelloWorldServlet class file needs to be in /web-inf/classes/servlets/
thanx for teh replies. I have moved my loop into a servlet and it is working great. I have another problem though, but it has to to with servlets(at least i think so), so i m going to put my question there.
I too am new to jsps, but i do know that u will have to submit the form. use a submit button.
your code should look something like this
<form name="testform" id="testform" method="post" action="/yourjsppage.jsp">
<input type ="text" name="username" id="username" />
</form>
<input type="submit" name="submitme" value="submit" />
the text that u entered in username will then get posted to the next jsp page and the url will then look something like 'yourjsppage.jsp?username=blahblah'
On the next page u will be able to use request.getParameter() to get the value of the text field.
Hope this helps
I am sorry but i wasnt very clear in my initial post. :icon_redface:
I have and index page and inside that page using ajax the user has to fill out some forms, so if i set a variable to be available for the 'window' using 'window.variablename' in javascript i m able to access that in the other jsp pages, that are loading inside my main index page.
Thanx for the comments.
Hi
I have passed my json string to a jsp page, i would like to loop through this string to create a sql statement. Any ideas how i would go about looping through the json string in the jsp page?
a snipet of thejson string looks like this:
{"CREATEDBYNAME":"TEST_ADMIN","NAME":"test001","TYPEID":"1900000000"}
Any help will be appreciated.
Thanx
T
Thanx for taking the time to answer my question, i came across a javascript 'window' which allows me to set the variable for that window, so i can access it across any of my other pages.
I managed to solve the problem. thanx jwenting for taking time to look at my question.
(Its funny how after searching for some hours then deciding to ask someone on the forum, i find the answer) :)
I would like to clear the value of bean.
In the middle of my application the session bean gets set. at the end of my application i would like to reset the bean value to null or nothing, clear it, or remove it whatever is the correct wording.
My app is using ajax, so i would like to refresh the main page, and reset the bean.
So if i refresh the page, and using jsp:getproperty, nothing must be returned.
I hope i was clear enough, and didnt confuse u even further.
Is is possible to clear the value of a bean using the jsp:setproperty tag?
i have tried
<jsp:setProperty name="MyNameBean" property="subscriberName" value="" />
but it didnt work.
Please help!
I am very new to json and havent used much ojects in javascript.
I have created a json object, and after i move through a couple of forms in my app i want to access that same object, is there a way to do it? Any help will be greatly appreciated.
Thanx
T
I dont use access but i think it has something to do with the your sql statement.
try writing the sql statment out.
just re-read your post, i was never liked to write vbscript with "&_" cause it always confused me, but since it is a compilation error, maybe u forgot an "&_" somewhere.
hello once again
I hav put the file in wwwroot and tried to open it thr browser using
http://localhost.xyz.asp but still it is not running.
url should be http://localhost/xyz.asp
and one mor thing is that if asp is enabled in a machine then
it will show the file with asp icon like (...3.yellow wheel) . but in my case
case it is not showin.
should i try installing different version of IIS ??..................
tnx
cutebab
the icon is just to show which program a particular file type is associated with. so if u right click on the file and choose properties, then on the general tab, where it says opens with u can change it to whatever application u want to open the file, i think the yellow wheel is visual studio, not too sure though :)
You cannot see an asp file in the webrowser if u have it on your desktop, it has to be in the wwwroot. I know this statement might be stupid and i dont mean to be mean but u cannot double click and expect your asp file to open in a browser like and html file does, u need to run it through the browser url will be something like localhost/test.asp
I can answer your first question, just insert this to the top of your jsp file which is going to dipslay your information
<%response.setHeader("Content-Disposition","attachment;filename=fileName.xls"); %>
And when u go to that page a box will pop up asking u if u would like to save the file.
Regarding your second question, i m not sure, as i too am relatively new to java and jsp.
So i got the json object to display only i have to write out which element to insert which value, is there an easier way?
i have used none and single quotes and it works in both IE and firefox
like this
var el = document.getElementById(obj);
var butId = document.getElementById(buttonId);
if ( el.style.display != 'none' )
{
el.style.display = 'none';
butId.value='Show Filter';
document.getElementById("FilterResultsList").style.display = '';
}else {
el.style.display = '';
butId.value='Hide Filter';
document.getElementById("FilterResultsList").style.display = 'none';
}
Hi
i have been searching around the net, but have not have any luck(most probably i m searching for the wrong thing).
I am able to get json data from my database, i now want to populate the text fields in my form
how do i go about doing it?