I am displaying values from a set on a bean called AttributeDefinition which has a Set of ValidValues. I am able to display the set and change the values using the JSP below:
<c:forEach items="${attributeDefinition.validValues}" var="validValue" varStatus="validValueRow">
<form:hidden path="validValues[${validValueRow.index}].id"/>
...
Hi All
I was wondering if someone has already solved this. I have a SpringMVC app and we are adding support to WebKit type mobiles (iPhone and Android basically) so I was wondering someone has found an elegant way of defining specific views depending on the client that sent the request.
I know that a simple if in a Controller implement...
Title pretty much says it all. Right now it's using XML as the default in the responses from my controller but I want it to use JSON as the default when no Accepts header or format parameter is specified.
My mvc-config.xml
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes...
In short, I want something like:
public String action(@SessionAttribute User user) {..}
instead of
public String action(HttpSession session) {
User user = session.getAttribute("user");
}
Mainly for the sake of:
readability
unit testing
...
Hi folks,
I'm writing a web application using Spring MVC. Although Spring MVC comes with a couple of tag libraries, they are not rich as Struts' counterpart. What I miss most is <html:xhtml>.
Those of you using Spring MVC, what third-party tag libraries do you guys use?
Thanks!
Edit: More specifically, I would like to auto-generate t...
I have a standard form controller to update a google protocol buffers message object that gets persisted. For the form I add the Message.Builder to the ModelMap so that I have access to the setter message. However, the values I change in the form are not automatically bound to the Builder object. I can not figure out why that doesn't wor...
Hi All,
Please help me with what I want to do.
I have this scenario:
I display a list of assets to users.
User selects an asset and then
clicks add item
On my requestmapping, during GET
operation. I use the service class
to check if indeed this asset still
exist in DB
If not, user should be notified by a
message. I use the form:err...
Hi,
I have a simple jasper report that does not need a datasource so I use a JREmptyDataSource.
It only relies on a parameter map that is being used to fill the report
<?xml version="1.0"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net....>
<parameter name="param1" class="java.lang.String"/>
<parameter name="param2" cla...
Hi there,
I have a form where depending on the select state ([checkboxOn/checkboxOff]) a check box should appear or not. When the check box is displayed it should be checked by default.
How to handle that situation, taking into account that
when select is in 'checkboxOff'
state, I would have
MyFormObject.isCheckboxOn == false;
when ...
In Spring 3.0
if i have a jsp page with two different links each calling different method on MultiActionController
<form:form method="POST">
<a href="user.htm?action=add" style="color: blue;">Add</a>
<a href="user.htm?action=delete" style="color: blue;">Delete</a>
</form:form>
on the MultiActionController i get request param...
I have the following call in my JavaScript:
new Ajax.Request('/orders/check_first_last/A15Z2W2',
{asynchronous:true, evalScripts:true,
parameters:{first:$('input_initial').value,
last:$('input_final').value,
order_quantity:$('input_quantity').value}});
What do I need to do to get Spring MVC (3.0) to handle this?
...
The following JavaScript
new Ajax.Request('/orders/check_first_last/A15Z2W2',
{asynchronous:true, evalScripts:true,
parameters:{first:$('input_initial').value,
last:$('input_final').value,
order_quantity:$('input_quantity').value}});
triggers an Ajax call to the checkFirstLast method in the OrderController:
@Controller
@RequestMa...
According to the Spring docs, to enable autodetection of annotated controllers, you add component scanning to your configuration:
<context:component-scan base-package="org.springframework.samples.petclinic.web"/>
My question is, why is this necessary?
If a Controller has an annotation to already indicate what it is, shouldn't that be...
If a HTML form contains multiple input fields:
<form>
<input id="in1" type="text" value="one">
<input id="in2" type="text" value="two">
<input id="in3" type="text" value="three">
</form>
and is passed to a Spring controller as a serialized form like this:
new Ajax.Request('/doajax',
{asynchronous:true, evalScripts:true,
parame...
Let's say you have a HTML form:
<form>
<input name = "in1" id="in1" type="text" value="one">
<input name = "in2" id="in2" type="text" value="two">
<input name = "in3" id="in3" type="text" value="three">
</form>
With @RequestParam you can bind fields as separate parameters:
public String doAjax(@RequestParam("in1") String in1, ...
I have my Spring MVC & Spring Security up and running as suggested by Spring's own reference application "petclinic". Everything's fine except that the login does not persist a browser restart.
What has to be considered to make sure a logged in user does not need to relogin after browser restart?
...
I want to know how long it takes a particular page to render, where are the various parts in the Spring MVC framework that I can start and stop my timer?
BTW, what java class should I use to get the most accurate time in milliseconds?
...
Hi all,
I create a Controller bean to map a dedicated URI.
web.xml file :
<!-- Spring MVC Servlet (that will route HTTP requests to BlazeDS) -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>co...
I'm using Spring MVC and have a page in my web application where I have a mailing address field that is mandatory and a radio button with a question asking 'Is the billing address the same as the mailing address?' Neither yes or no is selected by default to force the user to select an answer to the question via validation.
I have curren...
I know the Commons Validator framework is the de facto standard for Struts projects to validate input values both on the server side and the client side.
Is the same true for Spring MVC projects?
The reason I get the impression that it may not is that most Struts books and forums talk a lot about the Commons Validator framework, but on...