Solved

Spring XML document

Posted on 2013-12-12
1
383 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Hi,      I've been learning Spring and Jersey for the past few months and to say in simple, i am pretty much impressed with these frameworks. Many developers feel it awkward to implement a RESTful Web Services with such a popular Web Application Fr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now