2012-05-17 38 views
3

我想获得在独立的java类techcontants.java中声明的java常量,以便使用jstl在jsp中显示。如何使用jstl访问java类中描述的常量值

public class TechConstants { 
    public static final String PART = "Part"; 
    public static final String DESCRIPTION = "Description"; 
    public static final String VERSION = "Version"; 
} 

在我view.jsp的,我需要这个值,这样使用ustl

<td class="Thd" width="14%">Part</td> 

(我曾经尝试这样<c:outvalue="${TechConstants.PART}">

<td class="Thd" width="20%">Description</td> 
<td class="Thd" width="10%">Version</td> 

我使用的弹簧和JSTL,

我需要从我那里得到我的modelandview控制器中的常量值我必须将它传递给v IEW?

如果是这样请描述我在代码示例控制器做什么,或者我可以使用jstl直接在jsp中获取常量?

+0

请帮我... – anto

+0

@Japan特里维迪能否请你帮我 – anto

+0

这是一门功课?如果是这样,请标记它。 – raddykrish

回答

-2

您可以访问绑定到表单的对象的属性。

<form:form method="POST" commandName="user"> 

您可以使用${user.name}