Solved

Spring XML document

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate insert example 13 34
sql import cannot be resolved jsp 3 49
Why is enum singleton a better approach than static factory 3 24
Java 8 to Java 6 8 22
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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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.

820 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