• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JSP with DWR.XML

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all

i am learning DWR.xml with jsp .can any body give me the sample examples and related tutorials on that.where do i get the correct info on that..?

thank you

durgesh
 
Ranch Hand
Posts: 259
 
ka durgesh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
here i am sending my code i am working it in eclipse please loook at this and please tell me where error is

this is my dwrtest1.html page

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript"
src="jspproj2/dwr/interface/dwrtest.js"> </script>
<script type="text/javascript"
src="jspproj2/dwr/engine.js">
function uvalid()
{
return dwrtest.uValid(DWRUtil.getValue("username"),alert("hi this is digi"));
}
</script>
<script type="text/javascript"
src="jspproj2/dwr/DWRUtil.js"></script>

</head>
<body>
<form action="dwrtest1.jsp" method="get">
<table>
<tr>
<td> UserName: <input type="text" name="username" onchange ="uvalid();"></td>
</tr>
<tr>
<td> PassWord: <input type="password" name="password"></td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="submit" >
<input type="reset" name="cancel" ></td>
</tr>
</table>
</form>
</body>
</html>

and this is my dwrtest1.jsp page

<%
response.setContentType("text/html");
String uname = request.getParameter("username");
String pwd = request.getParameter("password");
if (uname.equals(pwd))
out.print("wel come");
else
out.print("dont come"); %>

and this is my dwrtest.java file


public class dwrtest {
public boolean uValid(String uname)
{

if (uname.equals(""))
return false;
else
return true;
}

}

this is my dwr.xml file

<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">

<dwr>
<allow>
<create creator="new" javascript="dwrtest">
<param name="uname" value="String"/>
</create>
</allow>
</dwr>

this is web.xml file

<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>

in the code what i am doing is just validating the username field for notnull using dwr concept please can anybody tell me where i am doing the mistake.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ka durgesh,
Javaranch tip:

If you are going to post more than a line or two of your code, wrap that
code in a set of UBB Code tags.
Doing so will help to preserve your code's indenting, making it easier to read.
If it is easier to read, more people will actaully read it and you will
stand a better chance of getting help with your question.
See UseCodeTags for more
help with UBB code tags.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!