Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Nagendra Shasthri

Ranch Hand
+ Follow
since Nov 12, 2010
Nagendra likes ...
MyEclipse IDE Chrome Java
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 Nagendra Shasthri

Hi all,

I have written a valuechangelistener for a combo box..The method is calling and the data is fetched from database. This data has to be set to another combo box . But I am unable to set this data to combo box. Any help is welcome..

I am trying to set the value in below code.
setParameterList(selectedItem.getItemList(personalProfileVO.getHlthParameterMst(), "parameterList"));
10 years ago
JSF
Thanks Anthony and Peter..I followed suggestions given by both of you..Created a new Web project and added the extra features..It was just a simple project and working fine now..Thanks for your time..:-)
Ok...I have a project coded in JSP and java scripts..I created a .project file for that taking guidance from a previous .project file of a java project...Now it is been imported to MyEclipse..And now I am getting exception "org.apache.jasper.JasperException: Unable to compile class for JSP"...How to resolve the issue?
Dear All,

I have a JSP project..I have created .project file for it..But it is not getting imported to My Eclipse.Shall I have to create some other files?
@James and Nam..Thank you guys for your time..Ya I didn't set the class path..That was the problem..Solved it..:-)
This is my java code...


import java.sql.*;
import javax.sql.*;

public class JDBCDemo{

public static void main(String args[]){
String dbtime;


//String dbUrl = "jdbc:jtds:sqlserver://192.168.1.109:1433/KHRMS";
//String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM EMPLOYEE_MASTER where EM_ID=356";

try {
System.out.println("Hello....");.....................This line is printing..
Class.forName("net.sourceforge.jtds.jdbc.Driver");
System.out.println("Hi..");..............It will not be printed.
Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://ktwo-19:1433;DatabaseName=KHRMS","sa", "Welcome12");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {
String s = rs.getString("EM_USERNAME");
System.out.println(s);
}

con.close();
}

catch(ClassNotFoundException e) {
e.printStackTrace();
}

catch(SQLException e) {
e.printStackTrace();
}

} //end main

} //end class
HI All,

I am connecting to MS SQL 2005 server using Java code..I have jtds.jar file..But still I am getting class not found exceptiion...Wat could be the reason?Please help me..I have deadline to submit.
Hi I re started the server but stil getting same exception..When I tried to run authUser1.jsp direclty I got this exception..


org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
Syntax error on token ";", delete this token

An error occurred at line: 52 in the jsp file: /db.jsp
Generated servlet error:
Syntax error on token ")", delete this token

An error occurred at line: 8 in the jsp file: /authUser1.jsp
Generated servlet error:
Syntax error on token "else", finally expected

Generated servlet error:
Syntax error on token "catch", Identifier expected

Generated servlet error:
out cannot be resolved

Generated servlet error:
_jspx_out cannot be resolved

Generated servlet error:
out cannot be resolved

Generated servlet error:
out cannot be resolved

Generated servlet error:
out cannot be resolved

Generated servlet error:
_jspx_page_context cannot be resolved

Generated servlet error:
_jspx_page_context cannot be resolved

Generated servlet error:
Syntax error on token "finally", { expected

Generated servlet error:
_jspxFactory cannot be resolved

Generated servlet error:
_jspxFactory cannot be resolved

Generated servlet error:
_jspx_page_context cannot be resolved


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.11 logs.
10 years ago
JSP
This is the exeption I am getting..

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:591)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.ClassNotFoundException: org.apache.jsp.authUser1_jsp
java.net.URLClassLoader$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(Unknown Source)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:133)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.11 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.11

My manager wants it to be edited in the same page..So I cant go for servlet...:-(
10 years ago
JSP
Actually someone has written the code and I am assigned with buf fixing..So I am not understanind the code properly..This is the code written in authUser1.jsp

<%@ include file="conn/dbConn.jsp" %>

<%@ page session="true"%>
<%@ page errorPage="genErrorPage.jsp"%>
<%@ page import="javax.naming.*"%>



<%
boolean bEmployee = false,bConsultant=false;
int iEID=0,iAccess=0,iHR=0;
String sQuery="";
PreparedStatement pstmt;
String sRetVal="",sNickName="",sLocation="",sDivision="";
ResultSet rst;

int iFirstIndex=0,iLastIndex=0,iFirstTilde=0,iLastTilde=0,iDivision=0;
boolean isValid=false;
//out.println("isValid :"+isValid);

try{
//String sUserName =(String)session.getValue("name");
//String sPassword = (String)session.getValue("password");
//String sPassword = request.getParameter("Password");
String sUserName = request.getParameter("UserName");
String sPassword = request.getParameter("Password");
//isValid = authJNDI.isValidUser(sUserName,sPassword);
isValid =isValidUser(sUserName,sPassword);


//isValid=true;

if (isValid){
CallableStatement cstmt = oConnection.prepareCall("begin ?:=fn_authenticate(?,?);end;");
cstmt.registerOutParameter(1,Types.VARCHAR);
cstmt.setString(2,sUserName);
cstmt.setString(3,sPassword);
cstmt.execute();

sRetVal=cstmt.getString(1);
if(sRetVal.equalsIgnoreCase("NOTFOUND")){
response.sendRedirect("genInvalidUser.htm");
}else{

try{
// out.println(sRetVal);
iFirstIndex = sRetVal.indexOf("~");
iLastIndex = sRetVal.lastIndexOf("~");
iFirstTilde = sRetVal.indexOf("^");
iLastTilde = sRetVal.lastIndexOf("^");
iDivision = sRetVal.indexOf("!");

// out.println(" iFirstIndex:"+iFirstIndex);
// out.println(" iLastIndex:"+iLastIndex);
// out.println(" iFirstTilde :"+iFirstTilde );
// out.println(" iLastTilde :"+iLastTilde );
// out.println(" iDivision:"+iDivision);

sNickName = sRetVal.substring(0,iFirstIndex);
iEID = Integer.parseInt(sRetVal.substring(iFirstIndex+1,iLastIndex));
iAccess = Integer.parseInt(sRetVal.substring(iLastIndex+1,iFirstTilde));
sLocation = sRetVal.substring(iFirstTilde+1,iLastTilde);
iHR = Integer.parseInt(sRetVal.substring(iLastTilde+1,iDivision ));
sDivision = sRetVal.substring(iDivision+1,sRetVal.length());

// out.println(" sNickName :"+sNickName );
// out.println(" iEID :"+iEID );
// out.println(" sLocation :"+sLocation );
// out.println(" iAccess :"+iAccess );
// out.println(" HR :"+iHR);
// out.println(" Division :"+sDivision);

session.putValue("EmpId",new Integer(iEID));
session.putValue("NickName",sNickName);
session.putValue("RRF", new Integer(iAccess));
session.putValue("EmpLoc", sLocation);
session.putValue("HR", new Integer(iHR));
session.putValue("EmpDiv", sDivision);
}catch(Exception ee){
out.println(ee.toString());
throw new Exception("Bad Parameters...");
}
}

if(sUserName.equalsIgnoreCase("guest")){
response.sendRedirect("demoframe.jsp");
}else{
response.sendRedirect("newframe.jsp");
}

cstmt.close();
oConnection.close();
}else{
response.sendRedirect("genInvalidUser.htm");
}



}catch(Exception e){
throw new Exception("Authentication Failed "+e.getMessage());
}
%>


and dbConn.jsp is


<%@page import="java.sql.*,javax.util.*,com.microsoft.jdbc.sqlserver.SQLServerDriver" %>
<% //@ page errorPage="ErrorPage.jsp"%>
<%Connection oConnection = null;
try{
//Class.forName("oracle.jdbc.driver.OracleDriver");
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

oConnection = DriverManager.getConnection("jdbc:sqlserver://192.168.1.109:1433;DatabaseName=KHRMS","sa", "Welcome12");
}
catch(Exception e){
out.println(e.toString());
//throw new Exception("Error Accessing Database: "+e.getMessage());
}
%>
10 years ago
JSP
@Prasad...filename is authUser1...This is my javascript code in login.jsp to navigate to authUser1.jsp..


function submitMe(){
var userName = document.frmIndex.UserName.value;
var pwd = document.frmIndex.Password.value;
if(userName == "")
{
alert("Enter the User Name");
return false;
}else if(pwd == "")
{
alert("Enter the Password");
return false;
}else

document.frmIndex.method="POST";
document.frmIndex.action="authUser1.jsp";
document.frmIndex.submit();
}
10 years ago
JSP
Hi All,

I am new to jsp coding..When navigating from a jsp page to another jsp page I am getting exception

I am using javascript to navigate..I am in login.jsp page and after giving username and password I have to move to authUser.jsp..I have written document.frmIndex.action="authUser.jsp";..

org.apache.jasper.JasperException: Unable to load class for JSP and java.lang.ClassNotFoundException: org.apache.jsp.authUser1_jsp..

I am using apache tomcat 5.5 server..Can anyone help me resolve my problem?I have deadline for submission..

10 years ago
JSP
Hi all...

In a dropdown list I am getting values from 1-10 and in another dropdown I am getting values like 1-0-1,1-1-1,0-0-1 like this...In next text box I need to multiply these 2 values...How to do that?(I mean if I select 2 from 1st list 1-0-1 from 2nd list I should calculate it as 2*(1+0+1)
11 years ago
Hi all,

Can I run SQL server and JBoss on the same machine at a time??Port number of Jboss(8080) and sql server(1433) are different..If I start JBoss it is giving bind exception...What is the problem??
11 years ago
Thanks Jesper...
11 years ago