Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

krishna Gajarla

Greenhorn
+ Follow
since Oct 02, 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 krishna Gajarla

hi friends i am getting exception when i am using jasper reports.
when i am converting the xml file into pdf file i am getting this exception.can you please tell me.
14 years ago
Hi,

I have written

TestController.java

package com.egatematrix.ess.controller.model;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

import org.springframework.web.servlet.*;
import org.springframework.web.servlet.mvc.*;

public class TestController implements Controller
{
public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws Exception
{
System.out.println("1");
return new ModelAndView("Home", "message", greeting);
}
private String greeting;

public void setGreeting(String greeting)
{
this.greeting=greeting;
}
}


index.jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:redirect url="/home.htm"/>

web.xml:

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

<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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<servlet>
<servlet-name>cbtech</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>cbtech</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>

messages.properties:

success=You are a Valid User

cbtech-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean name="/home.htm" class="com.egatematrix.ess.controller.model.TestController">
<property name="greeting">
<value>Welcome to Cybertech</value>
</property>
</bean>

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
<value>buttons</value>
</list>
</property>

</bean>

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.KookieLocaleResolver"/>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>

</bean>
</beans>


Home.jsp:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head><title>Spring Training, Inc.</title></head>
<body>
<h2><fmt:message key="success"/></h2>
<input type=submit class="button" value="<fmt:message key="submit"/>">
</body>
</html>


In the above code i have miss spelt Cookie as Kookie.

Can any one help me. And also i want to use Hyperlinks to change locales in jsp using interceptors. Can anyone give me the code.

Thanks in advance

Radha Krishna
Can anybody please help me in converting xml to csv using the
jasper report api.

Thanks in advance.
Thank you for your reply,

i am going through...the code
Hi,
I am trying to run an application to implemet localisation.

SpringappController.java is :

package com.cybertech;

import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SpringappController implements Controller
{

/** Logger for this class and subclasses */
protected final Log logger = LogFactory.getLog(getClass());

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
System.out.println("1");
logger.info("SpringappController - returning hello view");
return new ModelAndView("hello.jsp");
}
}

springapp-servlet.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!-- - Application context definition for "springapp" DispatcherServlet. -->
<beans>
<bean id="springappController" class="com.cybertech.SpringappController"/>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hello.htm">springappController</prop>
</props>
</property>
</bean>
<bean id="bundleViewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="basename">
<value>views</value>
</property>
</bean>
</beans>

web.xml is:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>

<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>SpringappController</servlet-name>
<servlet-class>com.cybertech.SpringappController</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>SpringappController</servlet-name>
<url-pattern>/SpringappController</url-pattern>
</servlet-mapping>

<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>

</web-app>

hello.jsp is:

<%@ taglib uri="/WEB-INF/spring.tld" prefix="spring" %>

<html>
<head>
<title>Example :: Spring Application</title>
</head>
<body>
<spring:message code="hello.username"/><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</body>
</html>

and i have written two proeprties files

views_en_US.properties
views_it_IT.properties

I am getting an error:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hello': Instantiation of bean failed; nested exception is java.lang.IllegalStateException: Bean definition does not carry a resolved bean class
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:406)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:348)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
thank you ....
15 years ago
JSP
actually speaking, this was the question i faced in the interview.

here the "call", he(interviewer) referring is to invoke a servlet from a jsp.

Am i clear or not?
because still I'm a learner. If I'm wrong in the question itself please clarify me.

But, this was the question i faced.
15 years ago
JSP
hai,
can any body please provide me the model code to call a servlet from a jsp.

thanks in advance.
[ June 13, 2006: Message edited by: Bear Bibeault ]
15 years ago
JSP
hai all,

can any body pl.clarify me:


can we call native methods through the appplets?


thanks in advance
rk
15 years ago
hi every body,

can you please clarify between an interpreter and compiler.


jvm is an interpreter.
is it correct?



what does a compiler do ?
in the case of c language we call as c-compiler.
15 years ago
hi every body, can any one pl.tell

what is the main difference between

out.println() and

System.out.println()
15 years ago
what are ClassLoaders?




some thing i know as ,

"ClassLoaders are used for loading the class."

but i donot have the clarity.


1)loading the class in jvm?
2)the class ClassLoader an abstract class?
3)how does this loading of classes happen?

can any body please give me the detailed
description.
15 years ago
1.why jvm gives special treatment to static variables,static methods?

2.why static variables are not serialized?

can any body please give me the ansewers or the related resource
so that i can go through.


Thanks in advance.
bye
krishna
15 years ago
hi all,
i am bit new to java/j2ee please do not mind if my questions are simple.



when a class implents a singleThread model then which variables are single threaded.
Thank you oscar.
I have checked the url also
15 years ago