PDA

View Full Version : Accessing Spring bind in JSP scriptlet


DJViking
Jul 16th, 2007, 04:17 AM
I have begun to use Spring:bind to obtain names and values in my forms.

I want to use ${status.expression} and ${status.value}, but I have run into a wall concerning the following code. How can I access the status.value in a JSP scriptlet?


<% String environment = request.getParamter("environment"); %>
...
<select name="environment">
<option <%if(environment.equals("PP1")){ %>selected="selected"<%}%> value="PP1">PP1</option>
<option <%if(environment.equals("PP2")){ %>selected="selected"<%}%> value="PP2">PP2</option>
<option <%if(environment.equals("PP3")){ %>selected="selected"<%}%> value="PP3">PP3</option>
<option <%if(environment.equals("PP4")){ %>selected="selected"<%}%> value="PP4">PP4</option>
<option <%if(environment.equals("ST1")){ %>selected="selected"<%}%> value="ST1">ST1</option>
<option <%if(environment.equals("ST2")){ %>selected="selected"<%}%> value="ST2">ST2</option>
<option <%if(environment.equals("ST3")){ %>selected="selected"<%}%> value="ST3">ST3</option>
<option <%if(v.equals("ST4")){ %>selected="selected"<%}%> value="ST4">ST4</option>
</select

Jörg Heinicke
Jul 17th, 2007, 12:35 AM
Why not directly Spring's form taglib?

Also for spring:bind there are enough (http://forum.springframework.org/showthread.php?t=9686) samples (http://www.jroller.com/page/raible?entry=multiple_select_with_spring_mvc) out there for doing what you want.

Jörg