prasad chowdary

Greenhorn
+ Follow
since Feb 18, 2012
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 prasad chowdary

htmlform

<body>
<form name="customerform" action="/Customer/cs">
customerid:<input type="text" name="cid"/>
customerName:<input type="text" name="cname"/>
<input type="submit" value="store"/>
</form>
</body>

Servlet

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

public class CustomerServlet extends HttpServlet{

public void Service(HttpServletRequest req,HttpServletResponse res){
try{
System.out.println("1");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbcracle:thin:@localhost:1521:xe","prasad","abc");
Statement stmt = conn.createStatement();
String id = req.getParameter("cid");
String name = req.getParameter("cname");
int result=stmt.executeUpdate("insert into customer values('"+id+"','"+name+"')");
PrintWriter out = res.getWriter();
out.write(id);
out.write(name);
conn.close();
}catch(Exception e){}
}
}


web.xml


<web-app>
<servlet>
<servlet-name>csservlet</servlet-name>
<servlet-class>CustomerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>csservlet</servlet-name>
<url-pattern>/cs</url-pattern>
</servlet-mapping>
</web-app>
4 years ago
hi experts,

how to reverse a string without using built in methods.

eg)"john is a boy" and print "yob a si nhoj".



Thanks in advance, please send me the code its useful to me.
6 years ago
thanks piyush,

iam not getting any exception.
this is my main program go through it.



MyApp.java



package info.spring.test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyApp {

public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
Student student = (Student)context.getBean("std");

student.details();
}

}
6 years ago
hi experts,

In my application im getting same results in autowiring(byname and byType) .please see my code.



Address.java

package info.spring.test;

public class Address {
private String city;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
private String state;
}


Student.java

package info.spring.test;

public class Student {

private String name;
private Address address1;
private Address address2;
private int roll_No;


public int getRoll_No() {
return roll_No;
}

public void setRoll_No(int rollNo) {
roll_No = rollNo;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Address getAddress1() {
return address1;
}

public void setAddress1(Address address1) {
this.address1 = address1;
}

public Address getAddress2() {
return address2;
}

public void setAddress2(Address address2) {
this.address2 = address2;
}


public void details(){

System.out.println("student roll_no:"+roll_No);
System.out.println("Student name:"+name);
System.out.println("Temparary address:"+address1.getCity()+'\t'+address1.getState());
System.out.println("paramenent Address:"+address2.getCity()+'\t'+address2.getState());
}

}


config.xml

<bean id="std" class="info.spring.test.Student" autowire="byType">
<property name="name" value="sachin"></property>
<property name="roll_No" value="99"></property>

</bean>

<bean id="address1" class="info.spring.test.Address" >
<property name="city" value="hyd"></property>
<property name="state" value="ap"></property>
</bean>

<bean id="address2" class="info.spring.test.Address">
<property name="city" value="banglr"></property>
<property name="state" value="karnataka"></property>
</bean>
</beans>

output

getting both address objects


Thanks in Advance.


6 years ago
hi experts,

How do improve the performance of an Application.




Thanks in advance.
6 years ago
thanks mark,

i know thants work fine , why idref attribute is not working.
6 years ago
Thanks Maru,
now, i got a new exception

Exception:

Failed to convert property value of type 'java.lang.String' to required type 'info.spring.test.Address' for property 'address2'; nested exception is java.lang.IllegalStateException:
6 years ago
hello experts,


i am trying to inject objects through idref tag i got an exception

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<bean id="std" class="info.spring.test.Student">
<property name="name" value="sachin"></property>
<property name="roll_No" value="99"></property>
<property name="address1" ref="addr1"></property>
<property name="address2" >
<idref="addr2"/>
</property>
</bean>

<bean id="addr2" class="info.spring.test.Address" name="addr2_alias">
<property name="city" value="hyd"></property>
<property name="state" value="ap"></property>
</bean>

<bean id="addr1" class="info.spring.test.Address">
<property name="city" value="banglr"></property>
<property name="state" value="karnataka"></property>
</bean>
</beans>

Exception

Element type "idref" must be followed by either attribute specifications, ">" or "/>"
6 years ago
hello experts,

In springs the terms Inversion of Control (ioc) and Dependency Injection are same.


thanks in advance.
6 years ago
thanks mangal,
6 years ago
























hi experts,

When will we go for autowiring in spring. I have a doubt in a spring bean if we have more no of objects its recomended.




Thanks in advance, Feedback me ASAP.









6 years ago
Thanks for reply,

In framework they mentioned, tell me both are acting as FrontControl.
6 years ago
hi experts,

i have a doubt in Struts2 They are saying Filter is a FrontControl Design pattern, i think Filter is also a servlet.
Struts1 ActionServlet is a FrontControl design pattern.

Thanks inAdvance,
6 years ago
hi, send your login page code.
6 years ago
hi Stefen,
thanks for your valuable suggestion.
6 years ago
JSP