Win a copy of Terraform in Action this week in the Cloud forum!

Rajendra Nath

Greenhorn
+ Follow
since Nov 09, 2005
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 Rajendra Nath

hi all,

SimpleDateFormat dateformat=new SimpleDateFormat("MM-dd-yyyy");
System.out.println("Formated date:"+dateformat.format(dd)); String parsedate=dateformat.format(dd);

which prints this output
Formated date:02-02-2007

i am also using the date picker in a jsp, which prints the date as 2-2-2007.
there is a problem with these date formats. date picker gives the date as 2-2-2007, but the java code gives the date prepending with 0.
can you please help me. as there is a problem with executing the sql query.
14 years ago
hi all,

SimpleDateFormat dateformat=new SimpleDateFormat("MM-dd-yyyy");
System.out.println("Formated date:"+dateformat.format(dd)); String parsedate=dateformat.format(dd);

which prints this output
Formated date:02-02-2007

i am also using the date picker in a jsp, which prints the date as 2-2-2007.
there is a problem with these date formats. date picker gives the date as 2-2-2007, but the java code gives the date prepending with 0.
can you please help me. as there is a problem with executing the sql query.
14 years ago
hi all,

I'm implementing an application in struts, and I'm getting the following exception.

org.apache.jasper.JasperException: Exception in JSP: /pages/jsp/customerinfo.jsp:172

169: </head>
170: <body>
171:
172: <html:form action="/information" onsubmit="return validation();">
173: <table class="inner" width="770">
174: <tr>
175: <td>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
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:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


root cause

javax.servlet.ServletException: Exception creating bean of class com.form.SubmitForm: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.pages.jsp.customerinfo_jsp._jspService(customerinfo_jsp.java:254)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
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:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


root cause

javax.servlet.jsp.JspException: Exception creating bean of class com.form.SubmitForm: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:563)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
org.apache.jsp.pages.jsp.customerinfo_jsp._jspx_meth_html_form_0(customerinfo_jsp.java:271)
org.apache.jsp.pages.jsp.customerinfo_jsp._jspService(customerinfo_jsp.java:244)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
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:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

--------------------------------------------------------------------------------------
struts-config.xml file

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config
PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources>

</data-sources>

<form-beans>
<form-bean name="submitForm" type="com.form.SubmitForm" />
<form-bean name="loginForm" type="com.form.LoginForm" />
</form-beans>

<global-exceptions/>

<global-forwards>
<forward name="error" path="/pages/jsp/error.jsp" />
</global-forwards>

<action-mappings>

<action path="/information"
scope="request"
name="submitForm"
type="com.action.SubmitAction">
<forward name="success" path="/pages/jsp/customerinfo.jsp"/>
</action>

<action path="/login"
scope="request"
name="loginForm"
type="com.action.LoginAction">
<forward name="success" path="/pages/jsp/login.jsp"/>
</action>

</action-mappings>



<controller/>
<!-- ========== Message Resources Definitions ============================ -->
<message-resources
factory="org.apache.struts.util.PropertyMessageResourcesFactory"
key="org.apache.struts.action.MESSAGE"
null="true"
parameter="com.mass.drm.app.ApplicationResources"/>

</struts-config>

-------------------------------------------------------------------------
PART of jsp page

<body>
<html:form action="/information" onsubmit="return validation();">
<table class="inner" width="770">
<tr>
<td>
<h2 align="center"> Individual Information </h2>
</td>
</tr>
</table>
----------------------------------------------------------------------------

WEB.XML

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<taglib>
<taglib-uri>struts-logic</taglib-uri>
<taglib-location>
pages/tld/struts-logic.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-form</taglib-uri>
<taglib-location>
pages/tld/struts-form.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-bean</taglib-uri>
<taglib-location>
pages/tld/struts-bean.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>struts-html</taglib-uri>
<taglib-location>
pages/tld/struts-html.tld
</taglib-location>
</taglib>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>

<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>

<init-param>
<param-name>nocache</param-name>
<param-value>true</param-value>
</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>/pages/jsp/customerinfo.jsp</welcome-file>
</welcome-file-list>

</web-app>

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

CAN YOU PLEASE HELP ME OUT TO FIND THIS EXCEPTION
14 years ago
hi all,
i'm trying to cast an Object array to string array, and it's throwing a class cast exception.

public class example
{
public static void main(String args[])
{
ArrayList arr= new ArrayList();

arr.add("R");
arr.add("A");
arr.add("J");
arr.add("A");

System.out.println("ArrayList size: "+ arr.size());
System.out.println(arr);
String array[]=(String[]) arr.toArray();
System.out.println("array: "+array);
}

}

what may be the reason for an error.
14 years ago
Thanks Ernest Friedman-Hill. It's working now.
But i didn't understand the logic the way it has worked.
14 years ago
hi all...

I'm implementing a small application which has an interface and an implementing class with the given package structure.

interface:

package math.src;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface MathFace extends Remote {
public int add(int a, int b) throws RemoteException;
}


implenting class

package math.src;

import math.src.MathFace;

import java.rmi.RemoteException;

public class MathImpl implements MathFace {
public int add(int a, int b) throws RemoteException {
return a + b;
}
}


these two classes are in web service dir.
when i try to compile, it's giving the following error:

C:\Web Service>javac -d bulid/classes math/src/MathImpl.java
math/src/MathImpl.java:3: cannot find symbol
symbol : class MathFace
location: package math.src
import math.src.MathFace;
^
math/src/MathImpl.java:7: cannot find symbol
symbol : class MathFace
location: package math.src
public class MathImpl implements math.src.MathFace {
^
2 errors


Regards
Rajendranath
14 years ago
hi all,

I've a web service application that is developed using struts framework. Now, i want to validate the login id with the mysql database. Its not able to connect to database.
could you please tell me what may be the flaw for an error.

Bye...
Rajendranath
14 years ago
Hi,

I'm put into a new project which is on struts, hibernate, and JBoss server.
I dont know any of the these. Can you please tell me how to deploy the project in JBoss.
What is hibernate. please provide me the best links, and with an examples.


Bye, and thank you.

SCJP(90%)
SCWCD(85%)
15 years ago
it's internet explorer.

The tag handler is the example of HFSJ on setting the attribute at pageContext scope.
Hi...

I'm trying to execute the classic tag example of HFSJ.
I've deployed the appl as per servlets and jsp spec. but my browser is not responding to my request.

this is my jsp page

<%@ taglib prefix="my" uri="classictags" %>
<html><body>
<table>
<my:iterateMovies>
<tr><td>${movie}</td></tr>
</my:iterateMovies>
</table>
</body>
</html>


my tld file:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version>1.2</tlib-version>
<uri>classictags</uri>

<tag>
<name>iterateMovies</name>
<tag-class>com.ClassicTag</tag-class>
<body-content>scriptless</body-content>
</tag>

</taglib>
It's showing a different exception now.

This is my web.xml file:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">

<servlet>
<servlet-name>jstlservlet</servlet-name>
<servlet-class>com.example.JSTLServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>jstlservlet</servlet-name>
<url-pattern>/jstl</url-pattern>
</servlet-mapping>

<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>;
<taglib-location>/WEB-INF/lib</taglib-location>
</taglib>

</web-app>

and

This is the exception the container is throwing now

type Exception report

message

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

exception

org.apache.jasper.JasperException: File "/WEB-INF/lib" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:202)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:525)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1625)
org.apache.jasper.compiler.Parser.parse(Parser.java:173)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.example.JSTLServlet.doGet(JSTLServlet.java:17)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


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


Thanks a lot for your kind response.

Bye...
do i need .tld files for JSTLs. or is it enough to have jar files under WEB-INF/lib.

I did the same. i put the jar files under WEB-INF/lib, and i didn't mention anything about the uri in web.xml. because HFSJ says the container will automatically does the mapping.
Hi Kathy,
can you please solve my problem the one which i've posted.

Bye....
Hi...
I'm trying to execute the HFSJ JSTL example, but it's showing an exception.

for the first example of <c:forEach> example. i made a servlet, which has a an array, and i set it as an attribute at request scope. and i forwarded the request to the jsp.

In JSP, i used the taglib directive, i.e, <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core " %>

But, when i deployed and tried to exucute this application, the container is throwing an exception:

org.apache.jasper.JasperException:The absolute uri:http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with the application.

what is the solution for this exception.

And one more thing. Even i copied the standard jstl file also into my WEB-INF/lib dir.