Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!

Joseph Sweet

Ranch Hand
+ Follow
since Jan 29, 2005
Merit badge: grant badges
For More
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
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joseph Sweet

@Bear Bibeault: I see, I thought you were trying to say that each time I need some jar to output its logging through Tomcat, I need log4j to be on the classpath.

I was actually wondering too which forum should be the best for posting this. So yes, if you think it has more to do with Spring, please move this thread to there. Thank you for this and for your answers!
10 years ago
@Bear Bibeault: Why does log4j need to be in the classpath? AS far as I know, Spring uses Commons logging (JCL), so if there's no log4j on the classpath, it will use the JDK logging API (java.util.logging).

As I said, when I remove log4j from the classpath, the logging for some of the jars works (e.g. JSF jars), for others it doesn't (e.g. Spring jars). I wonder why. Any ideas?

Also, I am using log4j.xml to config log4j.

Changes to the conf/logging.properties do take effect. I am expecting to get the logging at the file ${catalina.home}/logs/catalina.log

Here is my conf/logging.properties:



My log4j.xml:

10 years ago
On Tomcat, I am trying to get the logging output from the Spring libraries that I am using on my project.

My problem is that I am not getting the FINE logging from Spring. However, for other libraries such as JSF, I do get the FINE logging. What am I doing wrong?

I have noticed that when I remove log4j.jar from the classpath, I do get logging from Spring. But when I add log4j.jar to the classpath, the logging from Spring is gone. Can you explain why?

BTW I do need log4j and commons-logging(JCL) in my classpath, since some of the other jars I am using, refer to log4j and JCL explicitly in their code.


Here are the settings I am using, in Tomcat's conf/logging.properties:

10 years ago
Thank you guys!
11 years ago
Is there in one of the specifications any reference to methods that start with "is", while the suffix of the method's name is a property's name (similar to getter/setter methods)?

I was trying to find out an explanation about it but search engines omit the word "is".

Thanks!
11 years ago
I have a Book class which has properties such as id (long), name (String). Also, one of its properties is



Author has properties such as id, name, biography.

I have a book search form in which the total set of the Authors in my DB appears in a multi-select box. I was able have the authors that were selected by the user sent correctly to the controller (i.e. I could get them through the command as Set of Authors), but I want the next page (i.e. the result view page, which is the same page as the first search page) also to show the original search form filled with the values that were selected by the user. This was easy with regular text fields, e.g. the book's name: in the controller I got them loaded on the command object, and I simply kept them unchanged before sending the same command object to the view. But keeping the command's Set of Authors did not cause the view page to pre-select the relevant Authors in the multi-select box.... HOW DO I DO THIS TRICK???

I have read in the following stackOverFlow link

Spring MVC JSTL preselected list

that I need to "to override the equals method of the" Author class.... I did it (two Author classes are equal if they have the same id), but it did not help. Still, no Author is selected in the multi-select box in result page after I submit the search form.

Thanks!
11 years ago
You can carry the parameters with a Get or Post request. Which one would you choose?

Regarding the session - there's an option to delete some variables when they time out.
11 years ago
I am writing a pagination method for a search form. The user will fill out the form, stating according to which parameters they want to search to be performed (there are about 20 parameters), and then if there are more results than could fit into one page, they will get the 10 first results with an index to let them skip to the next pages (like they do in Google search).

I am trying to figure out what is the best way to keep the search parameters between the result pages... URL (get) parameters, or session parameters?
Or do I have other ways to do it in the Spring framework?
11 years ago
I am trying to figure out what is the best way to write the HQL statement for the following scenario:

I have a class Book which has a property of the type Set<Author>. The class Author has properties such as name, etc.

Now my DAO method gets "Set<Author> authors" as a parameter. For this method I want to write an HQL query so I could get all the Books that at least one of their Authors is found in authors.

What is the best way to accomplish this?

Thanks!
I have seen this code snippet:



http://static.springsource.org/spring/docs/3.0.0.RC1/spring-framework-reference/html/ch05s04.html

How could this work? As far as I know it's only allowed to call a constructor after the "new" keyword.
11 years ago
I am trying to bind a multiple <select> in a JSP page to a Set collection in the command object.

The code works when I use the older version of Spring (i.e. without annotations), but some things do not work when I am using the newer version of Spring (i.e. with annotations).

The older code that does work:



Using it in the JSP page:



The JSP above works fine, because the the options of the <SELECT> show both the value and the label.

However the following newer initBinder does not fully work, because for the same JSP, the value of each option in the <SELECT> is empty (the HTML shows value=""). It does show the label.



Here is the code for Category:



Please help me understand why the initBinder does not fully work when I am using annotations.

Thank you for your time!
11 years ago

Mark Spritzler wrote:05/12/2011 12:44 PM 225,559 org.springframework.transaction-3.0.0.M3.jar

Why didn't you upgrade that jar to 3.0.5?

Also, just so you know, the Controller interfaces have been deprecated over the preferred approach of using Annotations in your POJO Controllers.



I did not upgrade org.springframework.transaction because I did not find something like spring-transaction in the repository....

http://shrub.appspot.com/maven.springframework.org/release/org/springframework/

I know the controller interfaces are deprecated now.. I was thinking to upgrade them at some point in the near future. However as far as I know they still should basically work in 3.0.5... is this not the case? They are included in the jars.

Also, I have another question regarding these jars... some repositories have these jars with the older(?) package names. Like here:

http://repository.opencastproject.org/nexus/content/repositories/com.springsource.repository.bundles.release/org/springframework/

Why do they do it and who actually distributes Spring with two different sets of jar names? The same version of Spring (3.0.5.RELEASE) appears in the first repository with names like spring-XXX-3.0.5.RELEASE while in the second repository these jars appear with names like org.springframework.XXX-3.0.5.RELEASE.
Also, I have noticed that the servlet jar appears as "webmvc" in the first repository and as "web.servlet" in the second repository.
11 years ago

The 10 jars in bold are the ones I've upgraded. As you can see my code does not work anymore after the upgrade.


My old lib directory (where my code used to work)

03/21/2011 05:03 PM 443,432 antlr-2.7.6.jar
07/02/2009 02:24 PM 92,015 antlr-runtime-3.0.jar
03/21/2011 05:03 PM 559,366 commons-collections-3.1.jar
05/12/2011 12:15 PM 121,757 commons-dbcp-1.2.2.jar
07/02/2009 02:24 PM 38,015 commons-logging-1.0.4.jar
07/04/2009 04:28 AM 44,598 commons-logging-api-1.1.jar
05/12/2011 12:20 PM 42,492 commons-pool-1.2.jar
03/21/2011 05:03 PM 313,898 dom4j-1.6.1.jar
05/06/2011 12:01 PM 50,583 ejb3-persistence-1.0.2.GA.jar
05/13/2011 12:44 PM 100,884 hibernate-jpa-2.0-api-1.0.0.Final.jar
03/21/2011 05:03 PM 4,115,591 hibernate3.jar
03/13/2011 11:04 PM 1,358,802 hsqldb.jar
03/21/2011 05:03 PM 633,312 javassist-3.12.0.GA.jar
07/04/2009 04:46 AM 20,682 jstl.jar
03/21/2011 05:03 PM 10,899 jta-1.1.jar
03/21/2011 05:03 PM 785,998 mysql-connector-java-5.1.15-bin.jar
07/02/2009 02:24 PM 53,050 org.springframework.asm-3.0.0.M3.jar
07/02/2009 02:24 PM 497,506 org.springframework.beans-3.0.0.M3.jar
07/02/2009 02:24 PM 530,360 org.springframework.context-3.0.0.M3.jar
07/02/2009 02:24 PM 99,138 org.springframework.context.support-3.0.0.M3.jar
07/02/2009 02:24 PM 318,696 org.springframework.core-3.0.0.M3.jar
07/02/2009 02:24 PM 193,901 org.springframework.expression-3.0.0.M3.jar
05/12/2011 12:42 PM 360,343 org.springframework.jdbc-3.0.0.M3.jar
05/12/2011 12:43 PM 328,461 org.springframework.orm-3.0.0.M3.jar

05/12/2011 12:44 PM 225,559 org.springframework.transaction-3.0.0.M3.jar
07/02/2009 02:24 PM 259,989 org.springframework.web-3.0.0.M3.jar
07/02/2009 02:24 PM 433,844 org.springframework.web.servlet-3.0.0.M3.jar

03/21/2011 05:03 PM 25,496 slf4j-api-1.6.1.jar
03/21/2011 05:02 PM 7,669 slf4j-simple-1.6.1.jar
07/04/2009 04:46 AM 393,259 standard.jar
30 File(s) 12,459,595 bytes

My new lib directory (where my code DOES NOT work anymore)

03/21/2011 05:03 PM 443,432 antlr-2.7.6.jar
07/02/2009 02:24 PM 92,015 antlr-runtime-3.0.jar
03/21/2011 05:03 PM 559,366 commons-collections-3.1.jar
05/12/2011 12:15 PM 121,757 commons-dbcp-1.2.2.jar
07/02/2009 02:24 PM 38,015 commons-logging-1.0.4.jar
07/04/2009 04:28 AM 44,598 commons-logging-api-1.1.jar
05/12/2011 12:20 PM 42,492 commons-pool-1.2.jar
03/21/2011 05:03 PM 313,898 dom4j-1.6.1.jar
05/06/2011 12:01 PM 50,583 ejb3-persistence-1.0.2.GA.jar
05/13/2011 12:44 PM 100,884 hibernate-jpa-2.0-api-1.0.0.Final.jar
03/21/2011 05:03 PM 4,115,591 hibernate3.jar
03/13/2011 11:04 PM 1,358,802 hsqldb.jar
03/21/2011 05:03 PM 633,312 javassist-3.12.0.GA.jar
07/04/2009 04:46 AM 20,682 jstl.jar
03/21/2011 05:03 PM 10,899 jta-1.1.jar
03/21/2011 05:03 PM 785,998 mysql-connector-java-5.1.15-bin.jar
05/12/2011 12:44 PM 225,559 org.springframework.transaction-3.0.0.M3.jar
03/21/2011 05:03 PM 25,496 slf4j-api-1.6.1.jar
03/21/2011 05:02 PM 7,669 slf4j-simple-1.6.1.jar
06/05/2011 10:27 AM 53,082 spring-asm-3.0.5.RELEASE.jar
06/05/2011 10:23 AM 555,410 spring-beans-3.0.5.RELEASE.jar
06/05/2011 10:28 AM 668,861 spring-context-3.0.5.RELEASE.jar
06/05/2011 10:28 AM 100,870 spring-context-support-3.0.5.RELEASE.jar
06/05/2011 10:20 AM 382,442 spring-core-3.0.5.RELEASE.jar
06/05/2011 10:29 AM 169,752 spring-expression-3.0.5.RELEASE.jar
06/05/2011 10:29 AM 385,712 spring-jdbc-3.0.5.RELEASE.jar
06/05/2011 10:27 AM 334,327 spring-orm-3.0.5.RELEASE.jar
06/05/2011 10:31 AM 395,587 spring-web-3.0.5.RELEASE.jar
06/05/2011 10:09 AM 418,977 spring-webmvc-3.0.5.RELEASE.jar

07/04/2009 04:46 AM 393,259 standard.jar
30 File(s) 12,849,327 bytes

11 years ago
Did you mean



?

I cannot see how it might change to result. But I tried it and I still get the



And



Is there any place where I could check what went wrong?

11 years ago