Solved

Spring XML document

Posted on 2013-12-12
1
409 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 36

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

724 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