- This topic has 22 replies, 3 voices, and was last updated 12 years, 1 month ago by
support-tony.
-
AuthorPosts
-
dear Mr Tony
here is attached my version of helloworld app to use jsf spring and hibernate.
I think it is much easier than any on the net. your team can kindly check and may be slightly enhance to be used as an example on demand.
I like to use this code as reference for any jsf spring hibernate applications..
Please let me know if it is fine and usable technique.
take care
Amir
support-tonyKeymasterAmir,
I think you forgot to attach the file, as it doesn’t appear in your post.
If the sample is demonstrating use of MyEclipse functionality, then we’ll consider using it. However, if it is a general example of using Spring with JSF and Hibernate, then it might be better posted to a Spring development forum.
hi dear Tony
I am sorry as I did attach the program but it was big with jars so I removed the jars and here it is
The jars are these but may not all needed
commons-el-1.0.jar
commons-fileupload-1.0.jar
commons-lang-2.1.jar
commons-pool.jar
mail.jar
mysql-connector-java-5.0.3-bin.jar
spring.jar
struts.jar
tomahawk-1.1.6.jarthe project is pure MyEclipse on Jboss server and very simple. If your team improve it for me or else, please let me have a look on it.
I just ask you to look at the thread before saying why do I have to import myeclipse libraries or jars in the web subordinate i.e dependent on the Main java project. I guess if java project imports them then no need for the web. if so how to place the lib folder in java project to release the dependent from any jars.
take care
Amir
Attachments:
You must be logged in to view attached files.
support-tonyKeymasterAmir,
Thanks for the sample projects. Unfortunately, I couldn’t get them to execute properly. There were a couple of problems with the project set-up: the common Java project had a dependency on a non-existent project, so I just deleted that dependency (Main_Subbordinate_Jsf). There was also a missing classpath entry to the MySQL Connector/J jar file, which I added. However, after setting up a MySQL database and running the application, after clicking on the “here” link, my browser tried to display a strange URL: http://localhost:8080/Subbordinate/bean/charset=iso-8859-1 which didn’t exist. I’m not very familiar with Spring and couldn’t easily figure out why it was producing that URL.
I’m not sure why your web application had the hibernate configuration files, instead of putting them in the common Java project. I’m also not sure I understand the questions you asked but it shouldn’t be necessary to duplicate classpath entries if you mark the libraries needed by the common code at runtime (this is a standard eclipse build path configuration). You probably also don’t need to duplicate any configuration files.
I then tried something using the scaffolding tools in MyEclipse for Spring. I created a web project, added JSF capabilities and then scaffolded a CRUD application (right click the project and select MyEclipse->Scaffold Spring CRUD Application). I got it to generate code from the database table and to generate a JSF web flow app. This produced a working application (though I think I had to add the MySQL Connector/J jar file to the classpath and I ignored a false warning on an xml file). Next, I created a Java project and moved everything that wasn’t directly related to web processing to this new project. So anything to do with domain entities, persistence and hibernate configuration (though there wasn’t much here, as the code generator used Hibernate annotations rather than a configuration file).
I managed to get this to work, though there are a lot of rough edges that would need to be sorted out. However, I’ve attached the two projects (about 1MB in size), in case they are of interest. You will need to change the classpath entry for the MySQL Connector/J jar file. Note that this is not a supported set of projects and I’ve attached them only because they might be of interest.
In doing this, I didn’t use any MyEclipse specific features (apart from the scaffolding, for which we provide a tutorial). Consequently, I’m not sure if there is any more assistance that we can provide. You may be better off seeking help on a Spring development forum (there are many of them).
Attachments:
You must be logged in to view attached files.hi dear Tony
I do feel so grateful for you for your effort. I need to read scaffolding later as it might help me a lot.
but as for what you said as next about the class path please tell me how to do it in myeclipse for spring IDE
[ it shouldn’t be necessary to duplicate classpath entries if you mark the libraries needed by the common code at runtime
}I need to remove the lars and libraries in all from the web app and place them in the java imported project
so many thanks and take care
support-tonyKeymasteramir,
If you go to the build path configuration (right click the project, then select Build Path->Configure Build Path) and select the “Order and Export” tab, you can mark any of the libraries as Exported (by clicking the selection box by the side of the library). Exported libraries will be included in the depending project’s classpath and be packaged up when you deploy. This is standard eclipse functionality. In this way, you don’t need to repeat the same libraries in the build path of the depending application.
So, yes, any libraries that are needed in both the common project and the web project only need to be specified in the common project, provided they are marked as exported in that project.
I hope this helps.
hi dear Tony
sorry for late reply as I left your scaffolding project till I learn more.
Now i tried to run it but not working tell me
1 – if you could make it only one project say SpringWen and do away with spring-comon java project for simplicity.
2 – I wonder if you could run on Jboss I have 4.2.2 and jboss 7 so any one can do.
3 – I tried to run the myeclipse tomcat but error in the port 8080 so i tried configure it to anothre like 8081 but still not running. The server runs but index.jsp not read for port error
This error (HTTP 400 Bad Request) means that this program was able to connect to the web server, but the webpage could not be found because of a problem with the address.
many thanks really my friend
Amir
support-tonyKeymasterAmir,
I’m not sure you have a MyEclipse problem, though I’m not really sure what the issue is. Your points 1 and 2 appear to be asking me to provide you with a basic application for your needs and point 3 doesn’t really contain enough information to determine if you have a MyEclipse problem there. You might try creating a new Web project, letting MyEclipse generate all the project files, then run it on MyEclipse Tomcat to check that the server is working OK.
For your other issues, I suggest using a development forum like stackoverflow or, perhaps, the Spring Community Forums for spring related issues.
Of course, we’d be happy to investigate MyEclipse problems but we don’t generally have the resources to deal with general development issues.
I hope this helps.
-
AuthorPosts