Varadhzzz Srinivasan

Greenhorn
+ Follow
since Nov 16, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Varadhzzz Srinivasan

It got resolved. there was jrocket and sun jdkz in CLASSPATH. Thanks folks!
16 years ago
I create a server and deploy the webapp in the weblogic console. It works fine the first time..

Every second time, I am trying to start the server, it throws me the following message.

The WebLogic Server did not start up properly.
weblogic.common.internal.VersioningError: Incompatible packages in CLASSPATH: (B
EA Systems, WebLogic Server 8.1 SP6 Wed Jun 21 08:18:55 PDT 2006 781680 , 8.1.6
.0) not compatible with (BEA Systems, WebLogic Server 6.1 SP4 11/08/2002 21:50:
43 #221641 , 6.1.4.0)

I am sure I am missing something. Pls lemme know.

Thanks,
Varadh
16 years ago
I am trying to do some AJAX stuff.

index.jsp

<html&rt;
<head&rt;

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&rt;

<style type="text/css"&rt;
.bp_invalid {
color:white;
background:red;
}
.bp_valid {
color:green;
}
</style&rt;
<script type="text/javascript"&rt;

function AJAXInteraction(url, callback) {

var req = init();
req.onreadystatechange = processRequest;

function init() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
}

function processRequest () {
if (req.readyState == 4) {
if (req.status == 200) {
if (callback) callback(req.responseXML);
}
}
}

this.doGet = function() {
req.open("GET", url, true);
req.send(null);
}
}

function validateUserId() {
var target = document.getElementById("userid");
var url = "validate?id=" + encodeURIComponent(target.value);
var target = document.getElementById("userid");
var ajax = new AJAXInteraction(url, validateCallback);
ajax.doGet();
}

function validateCallback(responseXML) {
var msg = responseXML.getElementsByTagName("valid")[0].firstChild.nodeValue;
if (msg == "false"){
var mdiv = document.getElementById("userIdMessage");
// set the style on the div to invalid
mdiv.className = "bp_invalid";
mdiv.innerHTML = "Invalid User Id";
var submitBtn = document.getElementById("submit_btn");
submitBtn.disabled = true;
} else {
var mdiv = document.getElementById("userIdMessage");
// set the style on the div to valid
mdiv.className = "bp_valid";
mdiv.innerHTML = "Valid User Id";
var submitBtn = document.getElementById("submit_btn");
submitBtn.disabled = false;
}
}
</script&rt;
<title&rt;Form Data Validation using AJAX</title&rt;
</head&rt;
<body onkload="disableSubmitBtn()"&rt;

<h1&rt;Form Data Validation using AJAX</h1&rt;

<form name="updateAccount" action="validate" method="post"&rt;
<input type="hidden" name="action" value="create"/&rt;
<table border="0" cellpadding="5" cellspacing="0"&rt;
<tr&rt;
<td&rt;<b&rt;User Id:</b&rt;</td&rt;
<td&rt;
<input type="text"
size="20"
id="userid"
name="id"
autocomplete="off"
onkkeyup="validateUserId()"&rt;
</td&rt;
<td&rt;
<div id="userIdMessage"&rt;</div&rt;
</td&rt;
</tr&rt;
<tr&rt;
<td align="right" colspan="2"&rt;
<input id="submit_btn" type="Submit" value="Create Account"&rt;
</td&rt;
<td&rt;</td&rt;
</tr&rt;
</table&rt;
</form&rt;
</body&rt;
</html&rt;


ValidationServlet.java
package com.form;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class ValidationServlet extends HttpServlet {

private ServletContext context;
private HashMap accounts = new HashMap();

public void init(ServletConfig config) throws ServletException {
super.init(config);
this.context = config.getServletContext();
accounts.put("greg","account data");
accounts.put("duke","account data");
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
String targetId = request.getParameter("id");
if ((targetId != null) && !accounts.containsKey(targetId.trim())) {
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("<valid&rt;true</valid&rt;");
} else {
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("<valid&rt;false</valid&rt;");
}
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {

String targetId = request.getParameter("id");
if ((targetId != null) && !accounts.containsKey(targetId.trim())) {
accounts.put(targetId.trim(), "account data");
request.setAttribute("targetId", targetId);
context.getRequestDispatcher("/success.jsp").forward(request, response);
} else {
context.getRequestDispatcher("/error.jsp").forward(request, response);
}
}
}

I give http://localhost:7001/TestProject/jsp/ and the page loads up fine with the form field. I fill the form and click on "Create Account" and I land on http://localhost:7001/TestProject/jsp/validate with the following error - "10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.
"

Please provide pointers.

Thanks,
Varadh
16 years ago