Solved

Spring XML document

Posted on 2013-12-12
1
392 Views
Last Modified: 2013-12-12
When defining a bean in Spring, what is the best way or documentation to get all the xml elements needed for the bean definition?

For example, the spring documentation defines a bean this way.

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

But, Netbeans IDE does it another way:

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

I need to translate the first snippet into the second snippet.  That is, documentation -> Netbeans way.

What is the best way to figure out how to do that?
0
Comment
Question by:lcor
1 Comment
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39715468
Are you referring specifically to the difference between...

<property name="prefix" value="/WEB-INF/jsp/"/>

and

p:prefix="/WEB-INF/jsp/"

??



Basically, either version is acceptable (in Netbeans or any other development environment) as they are just two different alternatives to do the same thing. The only requirement is that for the second version, the "p:" namespace prefix needs to be declared in your top level "beans" xml element.

So yeah, you can choose whichever way you are happier with.


Note, I do realise that there are other differences in the two xml snippets above (the bean's class and the viewClass property). If that is what you are referring to, then there really isn't a path to translate the first into the second, they are two different (albeit very similar) things.

If I have missed the point somewhere, can you please elaborate!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question