|
|
I'm using sqljdbc4.jar if you are pointing towards it.I'm not sure how to check if it is latest version?
|
|
|
|
|
Sorry, nor do I. I would guess you go to wherever the library comes from and ask there.
Use the best guess
|
|
|
|
|
ok thanks a lot
|
|
|
|
|
Hello! Everyone,
May I ask for Struts project configuration with Spring.
I've used the "struts-config.xml" in Struts configuration.
But when I used it with Spring. It need to use together with "ApplicationContext.xml" for Spring. But I don't know how to connect these files together with others classes (like Action,Form and Bean). Please help me to advice and suggest for this matter.
Thanks you so much.......... *(^__^)*
|
|
|
|
|
I am assuming you are using Struts 1.x and Spring 2.5.x and able to solve jar dependency by your own.
If you have to integrate Struts with Spring you can follow this approach. This is the simplest way to integrate those two.
1. First you have to register spring ready-made struts plug-in in the struts-config.xml . Other things will be remain the same.
<struts-config>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/ApplicationContext.xml" />
</plug-in>
</struts-config>
The ContextLoaderPlugIn will handle all the integration work between Struts and Spring.
2. Inside your ApplicationContext.xml you have to mention all the Service and DAO and other stuff, what you want manage by Spring.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="someService" class="com.some.Service.SomeService" >
<property name="someDao" ref="someDao" />
</bean>
</beans>
3. All struts action class must extends spring ActionSupport instead of extending struts action. This will make the spring bean available via getWebApplicationContext() method.
public class SomeAction extends ActionSupport{
public ActionForward execute(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response)
throws Exception {
SomeService someService =
(SomeService) getWebApplicationContext().getBean("someService");
Now you can invoke spring service from struts.
|
|
|
|
|
Thanks you very much for your valuable answer, Arindam Mondal!
Okay, I will implement and configure those part of codes like that. ^^
|
|
|
|
|
If you have any difficulties with this implementation (lots of action class need to be change) let me know there are other types of implementation available.
|
|
|
|
|
Hi folks
I need a java program which can able to read and write smart card data.
how to do this??
I did not get any accurate programs through which I can able to get this functionality.
Valuable suggestions highly welcome.
$ai
|
|
|
|
|
I'm a beginner in Java, learning on my own. And I want to test my knowledge in multiple classes and method with parameters.
Can you suggest any simple machine problem?
|
|
|
|
|
Look at the Java Tutorials[^] where you will find lots of samples that you can easily modify.
Use the best guess
|
|
|
|
|
|
Do you want a practice with class inheritance?
If yes: create a command line chess set, no AI need, just recreate the basic methods of movements,etc.
no: create a command line turtle graphics app. Here is a turtle graphics problem definition:
http://www.bfoit.org/itp/IntroCmdsScreencast.html[^]
|
|
|
|
|
Hi..
I am using eclipse juno,tomcat6.
I want to read the property file only by name. and path should be my current location.
currenttly i have hard coded the path. "E:\SERENE0121201311\phibro\param.properties". But when i read the current path it shows "E:\Eclipse_Juno" but it should be ""E:\SERENE0121201311\phibro".
Can anyone help me to set application path..
Thanks
|
|
|
|
|
How are you obtaining the current path and why do think it is wrong?
Use the best guess
|
|
|
|
|
File file = new File(".");
System.out.println("Current dir : " + file.getCanonicalPath());
I am using above code to get current path...
this gives output : E:\Eclipse_Juno
but my code is inside : E:\SERENE0121201311\phibro
I need above path?
|
|
|
|
|
It doesn't matter where your code is it is where you start the program from that is the current directory.
Use the best guess
|
|
|
|
|
I have tried many options but could not get.
please let me know what is the best?
Thanks in advance.
|
|
|
|
|
I am using below code and their output in comment (//)
I need this path "E:\SERENE0121201311\phibro" i have code inside this path...
try{
File file = new File(".");
System.out.println("Path 1 : " + file.getCanonicalPath());\
//E:\Eclipse_Juno
System.out.println("Path 2 : " +new java.io.File("").getAbsolutePath());
//E:\Eclipse_Juno
System.out.println("Path 2 : " + file.getCanonicalFile());
//E:\Eclipse_Juno
String path = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
System.out.println("Path 4 : " + this.getClass().getClassLoader().getResource("").getPath());
///E:/SERENE0121201311/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/phibro/WEB-INF/classes/
String s = currentRelativePath.toAbsolutePath().toString();
//E:\Eclipse_Juno
String myCurrentDir = System.getProperty("user.dir")
+ File.separator
+ System.getProperty("sun.java.command")
.substring(0, System.getProperty("sun.java.command").lastIndexOf("."))
.replace(".", File.separator);
System.out.println("Path 5 : " +myCurrentDir);
//E:\Eclipse_Juno\org\apache\catalina\startup
Path currentRelativePath = Paths.get("");
System.out.println("path 6 : "+path);
///E:/SERENE0121201311/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/phibro/WEB-INF/classes/com/crmod/job/impl/XmlRead.class
}catch(Exception e){
e.printStackTrace();
}
|
|
|
|
|
If you know the path that you want then you will need to code it into your program. It is obvious that when you execute your program you are not starting in that directory, so none of the other methods will give you the path that you want.
Use the best guess
|
|
|
|
|
I need to deploy my web site to somewhere else so must know the path of phibro(my website folder name) folder. if i do hard code then it will create problem.. so please let me know if any other way to do it..
Thanks
|
|
|
|
|
I am not familiar with java web sites, but I would assume that there is some property in Tomcat that will give you the correct location.
Use the best guess
|
|
|
|
|
I want simple example code in web service then related websites for studies.
By
R.Ganesh Babu
|
|
|
|
|
If you type that into a google search, you will find all kinds of example code and references.
|
|
|
|
|
Ok, But I want, if you know best websites, you send to me.
Thanks & Regards,
R.Ganesh Babu
|
|
|
|