Can you provide some code please, it will make it easier to be able to help
Thirusha 20 Posting Whiz
Can you provide some code please, it will make it easier to be able to help
when using teh insert statement, the fields that do allow nulls have to be listed in teh statement, with teh correspoding values. So if all the fields in the db were designed to accept a value, then they have to be listed in the statement.
They do not have to be in the same order they are in the database.
What version of struts are u using?
if by link menu you mean the cursor doesnt change to a hand, simply and a style to it, you can do it in two ways, by either having a class attribute
in the stylesheet file create a class for example menuClass:
.menuClass{
cursor:pointer;
}
the code would then look like this:
<a class="menuClass" onClick="sendRequest('home.html');">Home</a>
or by "hard-coding" a style to the attribute like this:
<a style="cursor:pointer" onClick="sendRequest('home.html');">Home</a>
I have also noticed that the ajax part of teh code was a bit incorrect
In your sendRequest function, the handleResponse must be called before the open.
Also i dont see a need to have a script in the div, that script is causing errors in IE.You need to put the readyState and status comparisons on different lines, as this too causes and error in IE, so it shoule look something like this:
if(http.readyState == 4){
if (http.status == 200){
// the rest of the code here
}
}
The href attributes are causing it to open in a new window, you can remove them
<a onClick="sendRequest('home.html');">Home</a>
My pleasure.
Please mark this thread as solved.
You have to do some work on your own first, start coding something, and when you get an error come back to ask how to solve the error.
No one is just going to give you the answer.
I was just wondering why do you compare the username, password and role entered by the user by selecting all the records in the database?
I think it would be easier if you just select the record pertaining to the user that has logged in. So you just select the username, password and role from the database matching the username and password provided by the user, then compare the "roles".
Is everything on the new server set up the same way as it was on the old server?
Maybe the access rights are set to Anonymous on IIS
I have tried many times and just do not know if it is possible to access the index page's ajax code from the div content.
Yes it is possible, if your script is on the index page, it is also available to the new html that has just been loaded into your div.
Just call the same function that you did the first time you load content into the div.
Thanx. Although it doesnt give the top 10, they are still looking to compile a list of the top 10
Try using the colspan parameter, this merges the columns.
My pleasure, please mark this thread as solved.
I am by no means a genius in jsp, i too am still learning, so i have no clue as to why it is not working but i have figured out a "work around"
The first thing i tried is to remove the double quotes so i coded the html:option part like this:
<html:option value='<c:out value="${i}"/>' >
that got rid of the error, but when i viewed the source code, it turns out the code was being displayed like this :
<select><option value="<c:out value="${i}"/>" >1</select></select>
So the work around:
I just removed the html:option tags and replaced them with the standard option tags like this:
<html:select property="schStartTimeHH" >
<c:forEach var="i" begin="0" end="23">
<option value='<c:out value="${i}"/>'><c:out value="${i}" /></option>
</c:forEach>
</html:select>
What error are u getting, the code seems fine to me, Do u have a form bean of schStartTimeHH?
It seems like the css somehow doesnt like to be read from a separate file, I put the stylesheet in the html file and it worked.
I have done something like that. Using JSON and the JAVA DOM to create the xml file. Sending the xml using ajax, we just created a hidden field then submitted that field to the next page using ajax
I tested the code provided, and mine works correctly.
Could you provide your code, maybe something is missing.
I just replied to your other thread with the same question in the php forums.
In order for the event to be triggered, the action must occur, this will only happen when on the page where this textbox is, you change the the value of the textbox
Wouldn't it be easier to have a table in the database to hold the restricted names, and then just query that table.
there is a tutorial written by Peter in the JSP forums:
JSP database connectivity according to Model View Controller (MVC) Model 2
You dont put the full url in the action parameter unless you are submitting to a different server, if it is on the same server then
action="FriendsConnection/AddEventServlet"
should suffice, but i am not sure how the servlet is accessed (this depends on your servlet mapping parameter in the web.xml file), so it could be the action as specified above or just "AddEventServlet"
Also if u have a submit type button there is no need for an onclick event.
I dont have code, since this is very simple, the textbox you are refering to is most probably from a html page. so all you have to do is surround it with form tags, then in the action parameter place the url for the servlet, the button you can either have it as type submit or if it is of type button, add an onlick event then use document.formname.submit;
formname being the name of the form which surrounds the text box.
just submit the form to the servlet, then you can use request.getParameter to get the parameters
Snickers bar ... yummy
Use the distinct keyword:
SELECT DISTINCT "column_name" FROM "table_name"
Why dont you rather replace the double quotes with single ones in the code, thus eliminating the need for the user to retype.
var url = "servlet";
var params = "name=Bob";
http.open("POST", url, true);
http.send(params);
I have left out the parts of the ajax code that would normally remain the same.
There are loads of information on the net regarding ajax post if you are still lost, I used this site a while ago: http://www.openjs.com/articles/ajax_xmlhttp_using_post.php
You could post the information to page2, so you need to have form tags around the your university input field, also a button to submit the form
You are not sending the username to the servlet, you ahve to post the form to the servlet or in the ajax function send the username in the url, so the url would look something like this:
http://localhost/servlet?username=Bob
pleasure, glad to help
If you want to have something like that then the javascript code must cater for it, so if you are going to send in three variables then the function must have three parameters, so the js function will look something like this:
function c_uncheck(var1, var2, var3){
...
}
lets say you called your function like this:
onclick="c_uncheck('inputfieldname', 'inputfieldname1', 'inputfieldname2')"
then in the function to refer to inputfieldname you would do this
var field1 = document.myform.var1;
Please provide some code or login details, I dont want to register just to see your error.
I cannot be sure(you have provided no code), but most probably the button that you are using to submit is of type submit, change the button to type button then and an onclick event and call your javascript function.
Pleasure, glad to help
getParameter only works if the parameter you are accessing exists in the URL that was sent to the servlet.
Are you sure that the array is being sent to the servlet?
If the url is this : "/jspservlet?name=blah&myArray={1,2,3}" (the curly brackets would be replaced with the correct url encode for brackets which would be %something), then using request.getParameter("myArray") would return the array.
Try using the onload event when the page loads, place the onload event on the body tag.
I am most probably missing something here, but the url seems to be working quite well, whatever i typed in the search box gets sent to the google search.
I dont see a problem.
Try these two links, I havent tried them, but they seem to be pretty good
http://www.devarticles.com/c/a/Java/J2EE-and-AJAX-AJAX-with-Servlets/
http://www.java-tips.org/java-ee-tips/enterprise-java-beans/using-ajax-with-java-technology.html
There are also loads of examples out there, you just have to search for them.
When i first started learning jsp, I came across a lot of examples that were incomplete, dont be discouraged though, just try solving them yourself, google helps a lot, a lot of the errors are newbie errors. but you will get the hang of it.
I dont have one, but try google, there are loads of examples out there. You can search for "sroll images script" or "image slideshow"
try this:
<input type="text" name="tname" value='<%out.println(rs.getString(1));%>'/>
You have to make some effort first, then someone here will be willing to help
<%String sID = request.getParameter("id");%>
Use the same code for the other parameters, remember to change the name of the String though.
cause u would need quotation marks. when comparing values from a table where the column is not of type numeric, u have to use quotation marks like this:
username=10101010 and password = 'StealthProject'
if username is an alphanumeric column type then that too will need quotation marks as well.
I suggest googling some basic select statements to see how to write sql statements.
Try using a pop up window, or a modal window.
Adding the username and password to the javascript function is easy, just send those two values to the function itself, and ensure that the function accepts two inputs.
I dont see anywhere in your code where u are using request.getParameter("id") ??
I wouldnt send in the username and password in the javascript function unless you are going to need them for some purpose, not the purpose of posting them to the next page only, in the function.
You dont need to place comment out the javascript in the script tags anymore. Also it is better practice to use a servlet to connect to the database then doing it through a jsp.
I cant see any reason why the information is not getting posted to the next page.
I think you are missing brackets in the sql statement, when using the in clause, somthing like this :
where groupId in (1,2,3)