This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!

Rakesh Rajmohan

Greenhorn
+ Follow
since Jul 09, 2009
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 Rakesh Rajmohan

Hello..

I read in an article that we can configure any database connectivity by just configuring it in server.xml, so my questions here are..

1) is it the best way to configure database connectivity (or) we have any other best way (if so please tell me how)

2) If I am configuring it through Tomcat's server.xml, will the connectivity only be persistent to JSP pages or even to any of my normal Java classes..?

Thanks in advance,
Rakesh
12 years ago
Hello,

I have started the tomcat server through eclipse, but I am getting the below message when I access the URL 'http://localhost:8080/'

HTTP Status 404 - /

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

type Status report

message /

description The requested resource (/) is not available.


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

Apache Tomcat/5.5.17

Help me understanding what's wrong. Thanks!
12 years ago
You are awesome.. Its works now.. Thanks a million..!
12 years ago
JSP
<td width="23%" height="25" align="left"><html:text property="school_id_code" size="20" styleClass="InputTxt10black" readonly="true" value="<%=session.getAttribute("School_id").toString() %>"/></td>

this is the line where I get the error.. (But the same works on another machine)
12 years ago
JSP
Hello,

I get the below error in one machine.. (In the other machine withb same source code & class files it works)

org.apache.jasper.JasperException: /searchStudentDetails.jsp(133,151) Attribute value session.getAttribute("School_id").toString() is quoted with " which must be escaped when used within the value

any ideas plase..?
12 years ago
JSP
Great.. I think this will work.. thanks a lot dude..!
12 years ago
Sounds good to me.. I'll try it out..

But this solution is because I use struts right..? If I use normal MVC-1 type, I can use servletcontext in my servlets and that's the best way isn't it
12 years ago
Hmmn I'll try and se if I can do it in nay way.. Will keep it posted if I get through..!

Thanks anyways Sam..
12 years ago
From where should I pass this Servlet Context object reference to my dbconnection java class.. I think the visibility of a serveletContext will only be there in my Servlet class. But when I use struts my servlet class (ActionServlet) cannot be changed isn't it..?

If there are ways to change it do let me know. And also let me know if there is any other way to pass my ServletContext to my dbconnection class
12 years ago
Hello,

I am developing a struts application, and I want to have my database credentials configured. So I had put it in my web.xml under <context-param>. I have a listener class which reads these parameters and sets it to the ServletContext.

I have another java class which will get the backend datbaase connection, here If I use "getServletContext().getAttribute("dbName");" I get an error "method getServletContext() is undefined for my class"

can anyone let me know how can I get the set ServletContext attributes in my "DbConnection" java files.

Thanks a lot in advance
12 years ago
Hello,

I am developing a struts application, and I want to have my database credentials configured. So I had put it in my web.xml under <context-param>. I have a listener class which reads these parameters and sets it to the ServletContext.

I have another java class which will get the backend datbaase connection, here If I use "getServletContext().getAttribute("dbName");" I get an error "method getServletContext() is undefined for my class"

can anyone let me know how can I get the set ServletContext attributes in my "DbConnection" java files.

Thanks a lot in advance
12 years ago
Hello.. This is my include directive..

<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>

Also the type mapping is for my actionForm and not for my action whose mapping is available in action mapping.

The important thing is, the same projects runs in other machine, but not in mine..

Not sure whats going wrong
12 years ago
Hello.. When I run my web application from Eclipse, I get the above error. (But I have all library/.jar files needed, including struts.jar in my 'Web App Libraries' of Eclipse). Not sure what exactly is the problem.

I get exception the org.apache.jasper.JasperException: Exception in JSP: /loginPage.jsp:48

48: <html:form action="/login" type="inputforms.org.gov.csr.form.LoginForm" name="LoginForm" onsubmit="return loginvalidation(this);" scope="request">

and the below as root cause

root cause

javax.servlet.ServletException: Unresolved compilation problems:
The import org.apache.struts cannot be resolved
ActionForm cannot be resolved to a type

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.loginPage_jsp._jspService(loginPage_jsp.java:523)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
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)
inputforms.org.gov.csr.bd.LoginFilter.doFilter(LoginFilter.java:81)


root cause

java.lang.Error: Unresolved compilation problems:
The import org.apache.struts cannot be resolved
ActionForm cannot be resolved to a type

inputforms.org.gov.csr.form.LoginForm.<init>(LoginForm.java:3)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:542)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
org.apache.jsp.loginPage_jsp._jspService(loginPage_jsp.java:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
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)
inputforms.org.gov.csr.bd.LoginFilter.doFilter(LoginFilter.java:81)

(JRE - 1.5 Tomcat - 5.5) All the needed class files are in place.. Any help around this would be grateful. Thanks!
12 years ago
Hello.. As I said my TOMCAT_HOME is an environment variable so I can give only this "C:\Program Files\Apache Software Foundation\Tomcat 5.5"

And The CLASSPATH Environment variable I have set is "%TOMCAT_HOME%\common\lib\servlet-api.jar;"

So there's no question of extra whitespaces (I have checked) it... The path I have in my CLASSPATH variable is the exact path to the servlet-api.jar

And I cd to the directory where "src\com\example\web\BeerServlet.java" is present and execute it as below for the below said error.

javac -classpath %CLASSPATH%;classes;.; -d classes src\com\example\web\BeerServlet.java

Please help. Thanks!

12 years ago
I Tried doing it this way, but in vain...

javac -classpath %CLASSPATH%;classes;.; -d classes src\com\example\web\BeerServlet.java

wherein my classpath has --> %TOMCAT_HOME%\common\lib\servlet-api.jar; and
TOMCAT_HOME is C:\Program Files\Apache Software Foundation\Tomcat 5.5..

Both set in environment variable..

Even now I get the same error..!
12 years ago