retrive value of read only field using Selenium Webdriver - java

Update -- I have added the entire HTML code below for easier understanding of the issue. I have tried using the xpath
findElement(By.xpath(".//div[#id='ContainerCell']/span/[#id='StartDate']/input[#id='StartDate_txtInput']")).getText();
I still get the error:
The given selector .//div[#id='ContainerCell']/span/[#id='StartDate']/input[#id='StartDate_txtInput'] is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: Unable to locate an element with the xpath expression .//div[#id='ContainerCell']/span/[#id='StartDate']/input[#id='StartDate_txtInput'] because of the following error:
SyntaxError: The expression is not a legal expression.
Using Selenium Webdriver I need to retrieve the value of a read only field.
This field contains a date which I need to compare to another date.
I have tried all methods (find element by id / class name / xpath etc) it always returns element not found. I suspect this is because the input filed resides inside a span which resides inside a div but being new to java I am unable to get to this field.
Value I am looking for is <input id="StartDate_txtInput">
HTML code below.
#document
<!--
[if lte IE 8]>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD …
-->
<!--
[if gte IE 9]>
<!DOCTYPE HTML>
<![endif]
-->
<!--
[if !IE]>
-->
<!DOCTYPE html>
<!--
<![endif]
-->
<html webdriver="true">
<head id="RuntimeForm"></head>
<body id="RuntimeFormBody" onload="InitialiseRuntimeForm();setInitialSize();" onbeforeunload="return PromptWhenClosing(event)" style="overflow: hidden; margin: 0px;" onresize="resizeContainerCell()" tabindex="-1">
<form id="Form1" style="height: 100%;" onkeydown="return FormKeyDown(event)" onkeypress="return FormKeyPress(event)" onsubmit="javascript:return WebForm_OnSubmit();" action="RunTimeForm.aspx?ScreenID=8142758e-269a-41f0-b551-433e56dd1225" method="post" name="Form1">
<div></div>
<script type="text/javascript"></script>
<script type="text/javascript" src="/V14_ST1/WebResource.axd?d=5sNVsMkS2BZs-uoFEc4iQlsiyiLjXyZMN…nDsYTHfbaZu1hg-eY3e5am9_qL4BG_2h5iaVRw1&t=635662391674952392"></script>
<script></script>
<script></script>
<script></script>
<script type="text/javascript" src="/V14_ST1/WebResource.axd?d=s_BonnG3MwQl_dl8IfLCFCykZO1rmMJx-…odgFonyPZXsgvo4Ui0T7XvpKyRoUhQlSwxeG541&t=635662391674952392"></script>
<script src="/V14_ST1/UltimateSpellInclude/UltimateSpell.core.js" language="javascript" type="text/javascript"></script>
<script language="javascript" type="text/javascript"></script>
<script type="text/javascript"></script>
<input id="hdAccessKeyArea" type="hidden" value="8" name="hdAccessKeyArea"></input>
<a id="AccessKeyLink" accesskey="0" onactivate="ShowAccessKeyHelp('false',$('#hdAccessKeyArea')[0].value);this.blur();" title="Access Key Help" tabindex="-1" href="javascript:ShowAccessKeyHelp(false,$('#hdAccessKeyArea')[0].value);"></a>
<div id="ValidationSummary" style="color:Red;height:22px;width:197px;z-index:102;left:13px;position:absolute;top:420px;display:none;"></div>
<div id="tblContainer" style="display: block; width: 100%;">
<!--
Header ToolBar
-->
<div id="trToolbarHeaderContainer" style="height: auto; width: 100%;"></div>
<!--
Runtime form content
-->
<div id="Content" style="position:relative; background-color: #F9FAF5; width: 100%; height: 100%;">
<!--
Runtime form cotrols
-->
<div id="ContainerCell" style="overflow: auto; width: 459px; height: 305px; position: relative; background-color: rgb(250, 250, 250); cursor: default;"></div>
<!--
Refresh panel
-->
<div id="RefreshPanel" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; display: none"></div>
<!--
Footer ToolBar
-->
<div id="trToolbarFooterContainer" style="width: 100%;"></div>
<div id="trToolbarMobileContainer" style="width: 100%;"></div>
<div id="dialog" title=""></div>
::after
</div>
<input id="hdSubRecordDelete" type="hidden" name="hdSubRecordDelete"></input>
<input id="hdRecordID" type="hidden" value="00000000-0000-0000-0000-000000000000" name="hdRecordID"></input>
<input id="hdTableName" type="hidden" name="hdTableName"></input>
<input id="hdNoDisplayScreen" type="hidden" value=" No display screen assigned for the current Grid." name="hdNoDisplayScreen"></input>
<input id="hdParentRecordID" type="hidden" value="00000000-0000-0000-0000-000000000000" name="hdParentRecordID"></input>
<input id="hdHelpURL" type="hidden" name="hdHelpURL"></input>
<input id="hdHelpExists" type="hidden" value="html" name="hdHelpExists"></input>
<input id="hdSaveRecordFirstMessage" type="hidden" value="You must save the current record before carrying out this action." name="hdSaveRecordFirstMessage"></input>
<input id="hdDBSearchAddInID" type="hidden" name="hdDBSearchAddInID"></input>
<input id="ReadOnly" type="hidden" value="1" name="ReadOnly"></input>
<input id="hdHelpTitle" type="hidden" value=" Help " name="hdHelpTitle"></input>
<input id="hdDateLastModified" type="hidden" name="hdDateLastModified"></input>
<input id="ChangesAction" type="hidden" value="0" name="ChangesAction"></input>
<input id="hdFormLastModified" type="hidden" value="07/01/2015 08:20:11" name="hdFormLastModified"></input>
<input id="hdIsChangesMade" type="hidden" name="hdIsChangesMade"></input>
<input id="ImpersonationToken" type="hidden" name="ImpersonationToken"></input>
<input id="HRImpersonationToken" type="hidden" value="EcwWpmHtjrWmn9UTEYVeW0QB4wsmk2a+IdSkkHq9ENs=" name="HRImpersonationToken"></input>
<input id="ImpersonationId" type="hidden" name="ImpersonationId"></input>
<input id="InstanceID" type="hidden" value="0538a35f-03d7-e511-968c-8e001800001f" name="InstanceID"></input>
<input id="hdScreenId" type="hidden" value="8142758e-269a-41f0-b551-433e56dd1225" name="hdScreenId"></input>
<input id="hdScreenIdentifiers" type="hidden" name="hdScreenIdentifiers"></input>
<input id="hdUniqueID" type="hidden" value="d0b819a3-47b6-4cf1-a08b-983e98d0a673" name="hdUniqueID"></input>
<input id="hdFormDataset" type="hidden" value="AAEAAAD/////AQAAAAAAAAAMAgAAAE5TeXN0ZW0uRGF0YSwgVmVyc2lvbj00…cgZfQnVpbGQJX1JldmlzaW9uAAAAAAgICAgCAAAAAAAAAP//////////Cw==" name="hdFormDataset"></input>
<input id="hdRecordIDList" type="hidden" name="hdRecordIDList"></input>
<input id="hdVersion" type="hidden" name="hdVersion"></input>
<input id="hdAutoCompleteMobileOnly" type="hidden" value="True" name="hdAutoCompleteMobileOnly"></input>
<input id="hdWorkflowSubmitted" type="hidden" value="false" name="hdWorkflowSubmitted"></input>
<input id="hEventSource" type="hidden" name="hEventSource"></input>
<script type="text/javascript"></script>
<script type="text/javascript"></script>
<script></script>
<script type="text/javascript"></script>
<script language="javascript" type="text/javascript"></script>
<form target="DOCCONTAINER" action="" name="DocName" method="post"></form>
<iframe name="DOCCONTAINER" src="javascript:void(0)" style="visibility: hidden; display: none"></iframe>
<script type="text/javascript"></script>
<script type="text/javascript" language="javascript"></script>
<script></script>
</div>
</form>
</body>
</html>
</html>
</iframe>
<script defer="" src="FormContainer.js" type="text/javascript"></script>
<script type="text/javascript"></script>
</body>

So being inside a span shouldn't be a reason for Element Not Found. For now Please try following two things:
Use Wait: Generally it takes time for element to load and mostly Element not found issue is fixed with this.
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("StartDate_txtInput")));
Use getAttribute(): You might be using element.getText() for retrieving the text. Sometimes there is no text within the element, rather it's just set as an attribute say, value for input tag in this case. Try:
driver.findElement(By.id("StartDate_txtInput")).getAttribute("value");

Through ID
driver.findElement(By.id("StartDate_txtInput"));
or use CSS selector
input[id="StartDate_txtInput"]
or xpath
//input[#id='StartDate_txtInput']
or relative xpath
//div[#id='ContainerSizeGuide']/span/input[#id='StartDate_txtInput']
or
//div[#id='ContainerSizeGuide']/span/input
Before using these path check iframe, if this div in the iframe first you have go to iframe then use above nay one path.
driver.switchTo().frame((WebElement) By.id("iframeID"));
else you have use webdriver explicitly wait
WebDriverWait wait=new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.visibilityOfElementLocated(null));

You have to use the attribute value instead of text.
The code goes as follows:
String date=driver.findElement(By.id("StartDate_txtInput")).getAttribute("value");

Related

HTML page did not upload correctly because of the errors

Page "bookUpdate.html" does not work correctly because of the errors. I can open this page from page "bookList.html" via click to button "Edit". On all other pages bootstrap work correctly. I try to add to code something like "link rel="stylesheet" type="text/css" th:href="#{/webjars/bootstrap/css/bootstrap.min.css}" " but it did not work.
bookUpdate.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
layout:decorate="~{fragments/main_layout}">
<body>
<div layout:fragment="content" class="container mySpace">
<form th:action="#{/bookUpdate/__${book.id}__}" th:object="${book.id}"
method="post">
<div class="form-group">
<label for="topic" class="form-control-label">Topic</label> <input
type="text" class="form-control" th:field="${book.topic}"
id="topic" />
</div>
<div class="form-group">
<label for="description" class="form-control-label">Description</label>
<textarea class="form-control" th:field="${book.description}"
id="description" style="height: 95px"></textarea>
</div>
<div class="form-group">
<label for="link" class="form-control-label">Link</label> <input
type="text" class="form-control" th:field="${book.link}" id="link" />
</div>
<input type="submit" value="Submit" class="btn btn-primary" />
</form>
</div>
</body>
</html>
SUGGESTION: Try changing "href" to "src":
https://stackoverflow.com/a/52435193/421195
ALSO: be sure to look at the other responses in the same thread.
I hope that helps ... and please post back what you find!
I resolved my issue. I added a links to bootstrap from file "main_layout.html", that I use for header, and added before them <base href="/">. Now it is working fine.
<head>
<base href="/">
<link rel="stylesheet" href="../../static/css/style.css"
th:href="#{css/style.css}" />
<link rel="stylesheet" href="../../static/css/materia/bootstrap.min.css"
th:href="#{css/materia/bootstrap.min.css}" />
<script type="text/javascript" th:src="#{scripts/jquery-3.2.1.min.js}"></script>
</head>

I reference my CSS page to my HTML and it simply won't have any effect

I am currently working on a java project and have made an html page with a design (css) page to accompany it. I have referenced it but it still won't have any effect. I hard reloaded the page still no changes. Don't really understand why this is happening. I keep getting "net::ERR_ABORTED 404" on localhost. The stylesheet file name is indeed correct (being loginStyle.css). They are also both located in the same folder. Would appreciate any help. Thanks!
.btn-color {
background-color: #0e1c36;
color: #fff;
}
.profile-image-pic {
height: 200px;
width: 200px;
object-fit: cover;
}
.cardbody-color {
background-color: #ebf2fa;
}
<!DOCTYPE html>
<html lang="en" xmlns:thymeleaf.org>
<head>
<link rel="stylesheet" type="text/css" href="loginStyle.css" />
</head>
<div class="container">
<div class="row">
<div class="col-md-6 offset-md-3">
<h2 class="text-center text-dark mt-5">Welcome</h2>
<div class="card my-5">
<form class="card-body cardbody-color p-lg-5" th:action="#{/userLogin}" th:object="${user}" method="post">
<div class="text-center">
<img src="https://cdn.pixabay.com/photo/2016/03/31/19/56/avatar-1295397__340.png" class="img-fluid profile-image-pic img-thumbnail rounded-circle my-3" width="200px" alt="profile">
</div>
<div class="mb-3">
<input type="text" class="form-control" id="Username" aria-describedby="emailHelp" placeholder="User Name" th:field="*{Id}">
</div>
<div class="mb-3">
<input type="password" class="form-control" id="password" placeholder="password" th:field="*{password}">
</div>
<div class="text-center"><button type="submit" class="btn btn-color px-5 mb-5 w-100">Login</button></div>
<div id="emailHelp" class="form-text text-center mb-5 text-dark">Not Registered?
<a href="#" class="text-dark fw-bold"> Create an Account
</a>
</div>
</form>
</div>
</div>
</div>
</div>
</html>

how to find search results using selenium webdriver

I am setting up a test to perform a search and after the search is complete, i want to capture the results line that says "About xxx results (x.xx seconds)". I can get this to work using the firefox webdriver, but it does not work when I use IE or Chrome driver. I need help determining what is wrong with my code. Here is the code snippet:
public void runSearch(WebDriver driver) {
WebElement element = driver.findElement(By.name("search"));
element.sendKeys("Kearney");
element.sendKeys(Keys.RETURN);
String itext = driver.findElement( By.cssSelector("div#resInfo-0")).getText();
System.out.println("Search returned '" + itext + "'.");
}
Here is the html of my page after the search has been made:
<head></head>
<body>
<header id="main_header_iphone"></header>
<div class="clear"></div>
<header id="main-header"></header>
<section>
<div class="content_nn">
<div class="subnav">
<!--
<div class="bannerBox">
<div class="btn_events"><…
-->
<div class="logo"></div>
<!--
START Search
-->
<div class="search_container">
<div id="cse" style="width:100%;">
<div class="gsc-control-cse gsc-control-cse-en">
<div class="gsc-control-wrapper-cse" dir="ltr">
<form class="gsc-search-box" accept-charset="utf-8"></form>
<div class="gsc-results-wrapper-nooverlay gsc-results-wrapper-visible">
<div class="gsc-tabsAreaInvisible"></div>
<div class="gsc-tabsAreaInvisible"></div>
<div class="gsc-above-wrapper-area">
<table class="gsc-above-wrapper-area-container" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gsc-result-info-container">
<div id="resInfo-0" class="gsc-result-info">
About 31 results (0.11 seconds)
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="gsc-adBlockNoHeight" style="height: 0px; font-weight: normal; text-align: center;"></div>
<div class="gsc-wrapper"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript"></script>
<script type="text/javascript" src="http://www.google.com/uds/?file=search&v=1&hl=en"></script>
<link rel="stylesheet" type="text/css" href="http://www.google.com/uds/api/search/1.0/65b21018ad4df09e3eb5a21326b72d0b/default+en.css"></link>
<script type="text/javascript" src="http://www.google.com/uds/api/search/1.0/65b21018ad4df09e3eb5a21326b72d0b/default+en.I.js"></script>
<!--
END Search
-->
</div>
<div class="text_rural_h2" style="float:left; width:100%"></div>
<div class="index_page_heading" style="float:left;"></div>
<div class="letest_news2" style="float:left;"></div>
</div>
<footer id="footer"></footer>
</div>
</section>
<div id="topcontrol" style="position: fixed; bottom: 25px; right: 10px; opacity: 0; cursor: pointer;" title="Scroll Back to Top"></div>
<table class="gstl_50 gssb_c" cellspacing="0" cellpadding="0" style="width: 137px; display: none; top: 153px; position: absolute; left: 97px;"></table>
<div style="display:none"></div>
</body>
It is possible, the search result page takes more time for loading than WebDriver expects.
I propose to wait until the next page is loaded with WebDriverWait methods.
element.sendKeys("Kearney");
element.sendKeys(Keys.RETURN);
// Wait!
WebDriverWait wait = new WebDriverWait(driver, 20);
By waitFor = By.cssSelector("div#resInfo-0");
WebElement lblSearchResults = wait.until(ExpectedConditions.ElementIsVisible(waitFor));
//
String itext = lblSearchResults.getText();
Please see also this topic - WebDriver: Advanced Usage
For IE and Chrome you need an extra driver. Start with the chrome driver and check if this solves you problem.

How can I go back from a JSP page to index.html (the login page) ?

I'm starting from here :
With that code :
<!DOCTYPE html>
<html>
<head><title>Bank application</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<table class="title">
<tr><th>Web Bank application</th></tr>
</table>
<br/>
<fieldset>
<legend>Login Page - please enter your Username and Password</legend>
<form action="loginPage">
Username: <input type="text" name="username"><br>
Password : <input type="text" name="password"><br>
<input type="submit" value="Login">
</form>
</fieldset>
<br/>
<br/>
<br/>
<fieldset>
<legend>Registration</legend>
<form action="register">
First name: <input type="text" name="firstName"><br>
Last name : <input type="text" name="lastName"><br>
Address : <input type="text" name="address"><br>
ID-number : <input type="text" name="idnumber"><br>
User-Name : <input type="text" name="userName"><br>
Password : <input type="text" name="password"><br>
<input type="submit" value="Register">
</form>
</fieldset>
<br/>
<br/><br/><br/><br/><br/><br/>
</body></html>
And while I move from one page to another , I reach here :
With that code :
<!DOCTYPE html>
<html>
<head><title>Authentication failed - a problem has occurred!</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<h1>Sorry , but you are not registered to our bank!</h1>
<fieldset>
<legend>Please press here to continue</legend>
<form action="goingBack">
<input type="submit" value="Press here">
</form>
</fieldset>
</body></html>
And I want to go back to index.html - the first page that I see when the program starts (the first picture above) .
How can I do that ? how can I forward back to index.html ?
Regards
Just add a link to the previous page in the last HTML:
<!DOCTYPE html>
<html>
<head><title>Authentication failed - a problem has occurred!</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<h1>Sorry , but you are not registered to our bank!</h1>
<fieldset>
<legend>Please press here to continue</legend>
<form action="goingBack">
<input type="submit" value="Press here">
</form>
</fieldset>
Go Back <!-- add this -->
</body></html>
You just need javascript. To redirect to /index.html after 5 seconds :
setTimeout('window.location='index.html';', 5000);
setTimeout() is a javascript function that sets a timer to trigger somehting after a given period of time. window.location is a variable that allows you to change the URL of the current page (thus redireting).

AjaxJspTag is not defined

I'm trying to use AjaxTags, especially the htmlContent tag. The jsp looks as follow:
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%# taglib uri="http://ajaxtags.sourceforge.net/tags/ajaxtags" prefix="ajax"%>
<h1>HtmlContent Tag Demo</h1>
<div style="font-size: 90%; width: 650px;">
<p>The <code>ajax:htmlContent</code> tag fills a content area (e.g., DIV tag) with an HTML
fragment from another resource. You may find this tag useful for including blocks of information in
a sidebar when the user clicks a link or form field. This tag is a more simplified approach to the <code>ajax:portlet</code>
and <code>ajax:tabPanel</code> tags.</p>
<p>Shown below are three different ways of executing the AJAX event: link, radio button, and
select field.</p>
</div>
<h3>HtmlContent in Action</h3>
<div id="modelDescription" style="background-color: EAE9AF; width: 300px; height: 100px;"></div>
<div id="htmlContentForm">
<p>Select by ANCHOR link.</p>
<ul>
<li>Ford</li>
<li>Honda</li>
<li>Mazda</li>
</ul>
<form id="htmlContentForm">
<p>Select by RADIO option.</p>
<input type="radio" id="makeford" name="make" value="ford" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makeford">Ford</label><br />
<input type="radio" id="makehonda" name="make" value="honda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makehonda">Honda</label><br />
<input type="radio" id="makemazda" name="make" value="mazda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makemazda">Mazda</label><br />
<br />
<p>Select by SELECT option.</p>
<select id="selmake" name="selmake">
<option value="">Select one</option>
<option value="ford">Ford</option>
<option value="honda">Honda</option>
<option value="mazda">Mazda</option>
</select></form>
</div>
<div id="progressMsg" class="indicator" style="padding-top: 5px; display: none;">Loading...</div>
<div id="errorMsg"
style="display: none; border: 1px solid #e00; background-color: #fee; padding: 2px; margin-top: 8px; width: 300px; font: normal 12px Arial; color: #900"></div>
<ajax:htmlContent baseUrl="${contextPath}/htmlcontent.htm" sourceClass="contentLink" target="modelDescription"
parameters="make={ajaxParameter}" />
<ajax:htmlContent baseUrl="${contextPath}/htmlcontent.htm" sourceClass="contentRadio" target="modelDescription"
parameters="make={ajaxParameter}" />
<ajax:htmlContent baseUrl="${contextPath}/htmlcontent.htm" source="selmake" target="modelDescription"
parameters="make={selmake}" eventType="change" />
The htmlcontent.htm is produced by another jsp, which contains only "HalloText" as string, nothing else (no html tags or similar). And this page can be loaded in the browser.
When i load the first jsp, then i get following as output:
<h1>HtmlContent Tag Demo</h1>
<div style="font-size: 90%; width: 650px;">
<p>The <code>ajax:htmlContent</code> tag fills a content area (e.g., DIV tag) with an HTML
fragment from another resource. You may find this tag useful for including blocks of information in
a sidebar when the user clicks a link or form field. This tag is a more simplified approach to the <code>ajax:portlet</code>
and <code>ajax:tabPanel</code> tags.</p>
<p>Shown below are three different ways of executing the AJAX event: link, radio button, and
select field.</p>
</div>
<h3>HtmlContent in Action</h3>
<div id="modelDescription" style="background-color: EAE9AF; width: 300px; height: 100px;"></div>
<div id="htmlContentForm">
<p>Select by ANCHOR link.</p>
<ul>
<li>Ford</li>
<li>Honda</li>
<li>Mazda</li>
</ul>
<form id="htmlContentForm">
<p>Select by RADIO option.</p>
<input type="radio" id="makeford" name="make" value="ford" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makeford">Ford</label><br />
<input type="radio" id="makehonda" name="make" value="honda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makehonda">Honda</label><br />
<input type="radio" id="makemazda" name="make" value="mazda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makemazda">Mazda</label><br />
<br />
<p>Select by SELECT option.</p>
<select id="selmake" name="selmake">
<option value="">Select one</option>
<option value="ford">Ford</option>
<option value="honda">Honda</option>
<option value="mazda">Mazda</option>
</select></form>
</div>
<div id="progressMsg" class="indicator" style="padding-top: 5px; display: none;">Loading...</div>
<div id="errorMsg"
style="display: none; border: 1px solid #e00; background-color: #fee; padding: 2px; margin-top: 8px; width: 300px; font: normal 12px Arial; color: #900"></div>
<script type="text/javascript">new AjaxJspTag.HtmlContent({baseUrl: "/spring-mvc-hsqldb/htmlcontent.htm", parameters: "make={ajaxParameter}", sourceClass: "contentLink", target: "modelDescription"});</script>
<script type="text/javascript">new AjaxJspTag.HtmlContent({baseUrl: "/spring-mvc-hsqldb/htmlcontent.htm", parameters: "make={ajaxParameter}", sourceClass: "contentRadio", target: "modelDescription"});</script>
<script type="text/javascript">new AjaxJspTag.HtmlContent({baseUrl: "/spring-mvc-hsqldb/htmlcontent.htm", eventType: "change", parameters: "make={selmake}", source: "selmake", target: "modelDescription"});</script>
And firebug report 3 Errors:
AjaxJspTag is not defined <script type="text/javascript">new Aja...arget: "modelDescription"});</script> hello.htm (Zeile 46)
AjaxJspTag is not defined <script type="text/javascript">new Aja...arget: "modelDescription"});</script> hello.htm (Zeile 48)
AjaxJspTag is not defined <script type="text/javascript">new Aja...target: "modelDescription"});</script> hello.htm (Zeile 50)
Can someone give me a hint, what is wrong (what i'm doing wrong)?
This refers to the fact that there is no javascript library included containing definition of the class AjaxJspTag.
The libraries javascripts should be included as follows:
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous/scriptaculous.js"></script>
<script type="text/javascript" src="js/overlibmws/overlibmws.js"></script>
<script type="text/javascript" src="js/ajaxtags.js"></script>
I also recommend to check this page for reference: AjaxTags JavaScript-JSP Library
- QuickStart (You are especially interested in step 2. described there)

Categories