Is there any way to select current value in dropdown list by Spring MVC by <form:options>?
No need to use if else
Example:
Student student = new Student();
student.gender = "F";
model.addObject("student", student);
Map<String, String> genders = new LinkedHashMap<String, String>();
genders.put("M", "Male");
genders.put("F", "Female");
model.addObject("genders", genders);
JSP Code
modelAttribute & commandName are interchangeable
<c:url value="/Student/Edit" var="editstudenturl"/>
<form:form method="post" action="${editstudenturl}" modelAttribute="student" class="form-horizontal">
<form:select path="gender" class="form-control" id="gender" >
<form:options items="${genders}" />
</form:select>
</form:form>
Sets 'selected' as appropriate based on bound value.
http://static.springsource.org/spring/docs/2.0.x/reference/spring-form.tld.html#spring-form.tld.options
Here's my fix to this problem. Its massive, but it works
genders: qualifier from java model
// model.addAttribute("genders", genders);
account: binded modelattribute for spring forms
fmt:message: translates m to "Mees" (Estonian)
<form:select path="cfGender">
<c:forEach var="item" items="${genders}">
<c:choose>
<c:when test="${account.getCfGender().getCfGender()==item.getCfGender()}">
<form:option selected="true" value="${item.getCfGender()}">
<fmt:message key="cf_gender.${item.getCfGender()}" />
</form:option>
</c:when>
<c:otherwise>
<form:option value="${item.getCfGender()}">
<fmt:message key="cf_gender.${item.getCfGender()}" />
</form:option>
</c:otherwise>
</c:choose>
</c:forEach>
</form:select>
Try this, it works for me
<form:select path="size">
<c:forEach items="${sizeList}" var="s" varStatus="status">
<c:choose>
<c:when test="${s eq 25}">
<option value="${s}" selected="true">${s}</option>
</c:when>
<c:otherwise>
<option value="${s}">${s}</option>
</c:otherwise>
</c:choose>
</c:forEach>
</form:select>
I had similar problem and after several days of battling with it, I was able to fix it by implementing hash and equal methods in my model class. The problem is that spring was not able to determine where an item in the drop down is equals to a value in the model. But after implementing the hash and equals in the model object, everything worked fine.
#Entity
#Table(name = "BANKS")
public class Bank implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = -8928809572705999915L;
private Long id;
private String bankCode;
private String bankName;
...........
#Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((bankCode == null) ? 0 : bankCode.hashCode());
result = prime * result
+ ((bankName == null) ? 0 : bankName.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
#Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bank other = (Bank) obj;
if (bankCode == null) {
if (other.bankCode != null)
return false;
} else if (!bankCode.equals(other.bankCode))
return false;
if (bankName == null) {
if (other.bankName != null)
return false;
} else if (!bankName.equals(other.bankName))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
And in the view i have something like this
<form:select path="bank" cssClass="form-control" required="true">
<form:option value="">--Select--</form:option>
<form:options items="${banks}" itemLabel="bankName"
itemValue="bankCode" />
</form:select>
prior to binding the form to the model, you should set whatever variable you want to be selected to the desired value in the controller of your jsp.
Form form = new Form();
form.setFoo("bar");
model.addAttribute("form", form);
When the form is built in the jsp, that form variable will be the default selected value in your options list.
Need to set both these attributes itemLabel and itemValue to preselect the value
eg: <form:options items="${subCategoryList}" itemLabel="name" itemValue="id"/>
The name and ids are the fields from the SubCategory object and subCategoryList is List<Subcategory>
Related
I'm currently programming a modal to add some basic information to print an invoice with that information later on. The code is still messy but as soon as i figure out how to solve my problem, I'm going to smarten up the code a little bit.
I'm currently struggling in creating some input fields that are used to add or remove the items of the invoice. Currently it looks like that:
When I open that modal, I retrieve the OrderSpecifications (that's what I call these lines) from the DB and populate the input fields.
protected override void OnInitialized()
{
specs = nfzContext.OrderSpecifications.Where(x => x.FkOrderNumber == order.Id).ToList();
numberOfSpecLines = nfzContext.OrderSpecifications.Where(x => x.FkOrderNumber == order.Id).Count();
SetupSpeclines();
}
I have 5 input fields predefined, which are only hidden in case there are no specification lines already existing. If i press the + button, I show the a new line.
<div class="card-body">
<div class="form-group">
<div class="row">
<div class="col">
<input class="form-control" type="text" #bind="specification1.ItemName" hidden="#specLine1Disabled" placeholder="Zeile 1" />
</div>
</div>
<div class="row">
<div class="col">
<input class="form-control" type="text" #bind="specification2.ItemName" hidden="#specLine2Disabled" placeholder="Zeile 2" />
</div>
</div>
</div>
</div>
The SetupSpecline method grabs the existing speclines and adds a reference for each to one of the five specification1 ... specification5 variables:
void SetupSpeclines() {
if (numberOfSpecLines <= 1) {
specLine1Disabled = false;
if (numberOfSpecLines == 1) specification1 = specs.ElementAt(0);
numberOfVisibleSpecLines = 1;
}
else if (numberOfSpecLines == 2) {
specLine1Disabled = false;
specLine2Disabled = false;
specification1 = specs.ElementAt(0);
specification2 = specs.ElementAt(1);
numberOfVisibleSpecLines = 2;
}
else if (numberOfSpecLines == 3) {
specLine1Disabled = false;
specLine2Disabled = false;
specLine3Disabled = false;
specification1 = specs.ElementAt(0);
specification2 = specs.ElementAt(1);
specification3 = specs.ElementAt(2);
numberOfVisibleSpecLines = 3;
}
else if (numberOfSpecLines == 4) {
specLine1Disabled = false;
specLine2Disabled = false;
specLine3Disabled = false;
specLine4Disabled = false;
specification1 = specs.ElementAt(0);
specification2 = specs.ElementAt(1);
specification3 = specs.ElementAt(2);
specification4 = specs.ElementAt(3);
numberOfVisibleSpecLines = 4;
}
else if (numberOfSpecLines == 5) {
specLine1Disabled = false;
specLine2Disabled = false;
specLine3Disabled = false;
specLine4Disabled = false;
specLine5Disabled = false;
specification1 = specs.ElementAt(0);
specification2 = specs.ElementAt(1);
specification3 = specs.ElementAt(2);
specification4 = specs.ElementAt(3);
specification5 = specs.ElementAt(4);
numberOfVisibleSpecLines = 5;
}
}
This it the database model for OrderSpecification (ID = primary key):
namespace MyNamespace
{
public class OrderSpecification
{
public OrderSpecification();
public int Id { get; set; }
public int FkOrderNumber { get; set; }
public int SeqId { get; set; }
public string ItemName { get; set; }
public virtual Order FkOrderNumberNavigation { get; set; }
}
}
You can unhide (+) up to five inputs and enter some data. After you press the OK button, the routine starts to check if individual lines have a) altered (=ItemName changed), if new ones were added or if some were removed (=empty input):
void Confirm()
{
List<OrderSpecification> linesToAdd = new List<OrderSpecification>();
List<OrderSpecification> linesToRemove = new List<OrderSpecification>();
if (!string.IsNullOrEmpty(specification1.ItemName))
{
// Check if there is a spec at index 0
if (specs.ElementAtOrDefault(0) != null)
{
specs.ElementAtOrDefault(0).ItemName = specification1.ItemName; // Only itemName has changed
}
else
{ // Add new line
linesToAdd.Add(new OrderSpecification { FkOrderNumber = order.Id, ItemName = specification1.ItemName, SeqId = 1 });
}
}
else if (!string.IsNullOrEmpty(specification1.ItemName) && specs.ElementAtOrDefault(0) != null)
Now, while all that works just fine, I have trouble writing the new speclines to the database. For example, When i run
foreach (var spec in LinesToAdd)
{
nfzContext.Add(spec);
}
nfzContext.SaveChanges();
I get the error message
{"Cannot insert explicit value for identity column in table
'OrderSpecifications' when IDENTITY_INSERT is set to OFF."}
What I assume is that EF Core tries to add the new OrderSpecification with the ID=0, which is the standard value when creating a new OrderSpecification element. I need to tell EF Core to not write the ID as 0 but to let the database set the value by using auto_increment.
And what's odd is, although I have assigned the Primary Key to the ID field, when I scaffold, the key is not set in the modelbuilder:
modelBuilder.Entity<OrderSpecification>(entity =>
{
entity.ToTable("OrderSpecifications", "samnfz");
entity.Property(e => e.Id).HasColumnName("ID");
entity.Property(e => e.FkOrderNumber).HasColumnName("FK_OrderNumber");
entity.Property(e => e.ItemName).IsRequired();
entity.Property(e => e.SeqId).HasColumnName("SeqID");
entity.HasOne(d => d.FkOrderNumberNavigation)
.WithMany(p => p.OrderSpecifications)
.HasForeignKey(d => d.FkOrderNumber)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_OrderSpecifications_Orders");
});
Any idea?
Ugh, I think I have found the error. After analyzing the table structure in the modelbuilder, I recognized that the structure is not the same that I have in my database. So i scaffolded once again and the error is gone. obviously, I used model types that were not current and maybe the primary key was set to another attribute...
The Blazorise DataGrid supports textbox filters.
I would like to use a drop-down component to allow filtering by specific values. What do I need to do to make the grid react to the change of the Select value?
Code Example
#page "/ItemList"
#using DataAccessLibrary
#using Blazorise
#using Blazorise.DataGrid
#inject IItemList _items;
<div align="center">
<h3>Item List</h3>
</div>
#if (ItemListItems is null)
{
<p>Loading...</p>
}
else
{
<DataGrid Data="#ItemListItems" TItem="ItemListItem" PageSize="20" ShowPager="true" Filterable="true" Striped="true" Narrow="true" #bind-SelectedRow="#selectedItem">
<EmptyTemplate>
<div class="box">
No items were found!
</div>
</EmptyTemplate>
<DataGridColumns>
<DataGridCommandColumn TItem="ItemListItem" Caption="Action" EditCommandAllowed="true">
<EditCommandTemplate>
<Button Color="Color.Primary" Clicked="#context.Clicked">Edit</Button>
</EditCommandTemplate>
</DataGridCommandColumn>
<DataGridNumericColumn TItem="ItemListItem" Field="#nameof(ItemListItem.ItemID)" Caption="Item ID" Sortable="true" TextAlignment="TextAlignment.Right">
<DisplayTemplate>
#(context.ItemID)
</DisplayTemplate>
</DataGridNumericColumn>
<DataGridSelectColumn TItem="ItemListItem" Field="#nameof(ItemListItem.TypeShortDesc)" Caption="Item Type" Sortable="true">
// This filter should replace the default textbox with a dropdown listing only specific values
<FilterTemplate>
<Select TValue="string" #bind-SelectedValue="#ItemTypeFilter">
#foreach (string type in ItemTypeList)
{
<SelectItem Value="#type">#type</SelectItem>
}
</Select>
</FilterTemplate>
</DataGridSelectColumn>
<DataGridSelectColumn TItem="ItemListItem" Field="#nameof(ItemListItem.Description)" Caption="Item Description" Sortable="true" TextAlignment="TextAlignment.Left" />
<DataGridSelectColumn TItem="ItemListItem" Field="#nameof(ItemListItem.StatusShortDesc)" Caption="Status" Sortable="true">
<FilterTemplate>
// This filter should replace the default textbox with a dropdown listing only specific values
<Select TValue="string" #bind-SelectedValue="#ItemStatusFilter">
#foreach(string status in ItemStatusList)
{
<SelectItem Value="#status">#status</SelectItem>
}
</Select>
</FilterTemplate>
</DataGridSelectColumn>
<DataGridNumericColumn TItem="ItemListItem" Field="#nameof(ItemListItem.ItemPrice)" Caption="Amount" Sortable="false" TextAlignment="TextAlignment.Right" DisplayFormat="{0:C}" />
</DataGridColumns>
</DataGrid>
}
#code {
private List<ItemListItem> ItemListItems;
private ItemListItem selectedItem;
private List<string> ItemStatusList;
private string ItemStatusFilter;
private List<string> ItemTypeList;
private string ItemTypeFilter;
protected override async Task OnInitializedAsync()
{
ItemListItems = await _items.GetItems();
ItemTypeList = await _items.GetItemTypes();
ItemStatusList = await _items.GetItemStatuses();
}
}
I have a requirement to create breadcrumb in sightly. I have following code which is working fine in JSP. But i am struggling to convert the code to sightly because i am not getting the right methods in currentStyle object to get the "absParent" and others. Any help will be highly appreciated!!
<%# include file="/libs/foundation/global.jsp" %>
<%
final int startLevel = currentStyle.get("absParent", 3);
final int endLevel = currentPage.getDepth() - currentStyle.get("relParent", 0);
final int minItems = currentStyle.get("minItems", 2);
if (startLevel <= endLevel - minItems) {
%><section class="breadcrumbs"><%
for (int level = startLevel+1; level < endLevel; ++level) {
Page itemPage = currentPage.getAbsoluteParent(level);
if (itemPage == null || !itemPage.isValid() || itemPage.isHideInNav()) {
continue;
}
final String pagePath = itemPage.getPath() + ".html";
final String pageTitle = itemPage.getNavigationTitle();
String className = "breadcrumb-item-"+level;
if (level == startLevel) className += " breadcrumb-first";
if (level == endLevel-1) className += " breadcrumb-last";
pageContext.setAttribute("className", className);%>
<section class="breadcrumbs ">
<%= xssAPI.encodeForHTML(pageTitle) %>
</section>
<%} %>
</section><%
}
%>
To create breadcrumb you have to write a WCMuse class and include that in this component.
<div
data-sly-use.breadcrumb="${'com.mySite.components.BreadcrumbUse'}">
<!-- + Breadcrumb component + -->
<div class="breadcrumb component">
<div class="breadcrumb_nav_bar clearfix"
data-sly-test="${breadcrumb.navList}"
data-sly-list.element="${breadcrumb.navList}">
<p data-sly-test="${!elementList.last}">
<a href="${element.path}.html">${element.title ||
element.navigationTitle || element.name}</a>
</p>
<p data-sly-test="${elementList.last}">${element.title ||
element.navigationTitle || element.name}</p>
</div>
</div>
<!-- - Breadcrumb component - -->
</div>
Code Sample for WCMUse class:
Public class BreadcrumbUse extends WCMUse
{
private List<Page> navList = new ArrayList<Page>();
#Override
public void activate() throws Exception
{
setBreadCrumbItems();
}
private void setBreadCrumbItems()
{
long level = 4L;
long endLevel = 1L;
int currentLevel = getCurrentPage().getDepth();
while (level < currentLevel - endLevel)
{
Page trailPage = getCurrentPage().getAbsoluteParent((int) level);
if (trailPage == null)
{
break;
}
this.navList.add(trailPage);
level++;
}
}
public List<Page> getNavList()
{
return this.navList;
}
}
The below code will work for creating breadcrumbs in AEM6.2 using Javascript and HTL(previously sightly).It worked well for me..here we go
Javascript to be used in the server side script(it can also be created using java)
script.js
use(function () {
var title = currentPage.getTitle();
//To get the title of the current page
var level = currentPage.getDepth();
//To find the depth of the current page from the root
var cts = new Array();
// To store the traversed page (object) from the root
for(var i=1;i<level;i++)
{ // Here I used i=1 for mycase(i=0 will be /content)
var titl = currentPage.getAbsoluteParent(i);
//To get the absolute parent at each level from root
pageStack.push(titl);
//Stack to maintain the pages
}
return {
title: title,
pageStack:pageStack
};
});
Breadcrumbs.html
<sly data-sly-use.cpt="script.js">
<h1>${cpt.title}</h1>
<div data-sly-list="${cpt.pageStack}">
<span> ${item.title}/</span>
</div>
</div>
Thus we get the breadcrumbs ready for our presentation!!!
i have a datebox
<datebox id="infrom" style ="z-index: 100000;" format="yyyy-MM-dd" value ="#bind(vm.date)"
onChange="#global-command('dataChanged', indate = infrom.value)" />
default value of date is now -1
and have a button search
<button id="searchButton" label="Search" image="/img/search.png" onClick="#command('listCars', indate = infrom.value)"/>
and grid will load data of yesterday
when i choose another day
grid will load data of chose day
and there is my grid
<listbox id="carListbox" height="" emptyMessage="No data found in the result" model="#bind(vm.cars)" >
<listhead>
<listheader label="Date" />
<listheader label="Actionid" />
<listheader label="Num user" />
<listheader label="Total action" />
</listhead>
<template name="model" >
<listitem>
<listcell label="#bind(each.date)"></listcell>
<listcell label ="#bind(each.action)"></listcell>
<listcell label="#bind(each.user)"></listcell>
<listcell label="#bind(each.total)"></listcell>
</listitem>
</template>
</listbox>
and there are my code
private List<Car> cars;
public List<Car> getCars()
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(new Date()); // Now use today date.
c.add(Calendar.DATE, -1);
String output = sdf.format(c.getTime());
final StringBuilder builder = new StringBuilder("");
for (final Action action : getActions()) {
if (action.getChecked()) {
builder.append(';');
builder.append(action.getActionid());
}
}
String lstAction = builder.toString();
lstAction = lstAction.substring(1);
String[] arrAction = lstAction.split(";");
cars = carService.search(output, arrAction);
return cars;
}
#Command
#NotifyChange("cars")
public void listCars(#BindingParam("indate") Date indate){
SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
String date = dt1.format(indate);
final StringBuilder builder = new StringBuilder("");
for (final Action action : actions) {
if (action.getChecked()) {
builder.append(';');
builder.append(action.getActionid());
}
}
String lstAction = builder.toString();
lstAction = lstAction.substring(1);
String[] arrAction = lstAction.split(";");
cars = carService.search(date, arrAction);
//return result;
//carListbox.setModel(new ListModelList<Car>(result));
}
but i can't reload grid when i choose another day
please give me any way to slove them
thanks all
Why do you bind param to function with #BindingParam("indate")?
If you bind date value with this:
<datebox style ="z-index: 100000;" format="yyyy-MM-dd" value ="#bind(vm.date)"
onChange="#global-command('dataChanged', indate = infrom.value)" />
so you may not use
String date = dt1.format(indate);
in listCars function, and not use #BindingParam in it.
Instead, you need to declare
private Date date;
in the viewmodel, with his getter and setter.
I got a simple form validation and submission that works great
Here is my struts.xml :
<action name="register" class="registerAction">
<interceptor-ref name="defaultWithoutAuthenticationStack"/>
<result type="tiles" name="input">
<param name="titleKey">global.title.register</param>
<param name="location">register</param>
</result>
<result type="tiles" name="success">register.success</result>
</action>
My jsp form :
<s:form method="post" action="register.action" validate="true">
<s:textfield name="usernameRegister" id="usernameRegister" key="global.username" labelposition="left" />
<s:password name="passwordRegister" id="passwordRegister" key="global.password" labelposition="left" />
<s:password name="passwordConfirmRegister" id="passwordConfirmRegister" key="global.password.confirm" labelposition="left" />
<s:textfield name="emailRegister" id="emailRegister" key="global.email" labelposition="left" />
<s:submit key="global.register" name="submitRegister" method="goRegister"></s:submit>
</s:form>
And my submit function :
public String goRegister(){
user.setUsername(getUsernameRegister());
user.setPassword(getPasswordRegister());
user.setEmail(getEmailRegister());
userService.addUser(user);
ArrayList<String> successMessageUsername = new ArrayList<String>();
successMessageUsername.add(getUsernameRegister());
this.addActionSuccess(getText("global.register.success", successMessageUsername));
return SUCCESS;
}
Nothing fancy !
The problem is I got a windows asking for resubmit form informations when I refresh my page on success page or form page (when validation failed)
How can I prevent that ?
Thx
EDIT : I add the action messages and fields messages preservation to my question
How to preserve the actions messages and fields messages (validation) with a redirection ?
Use the post-redirect-get pattern.
On success, redirect to the "you've registered" page. That way if the user refreshes, they just get that same page again.
Oki after Dave Newton's suggestion I dig up a little to complete the correct way to do so :)
Here is my answer so far, no more refresh, backward or forward resubmission of your form and preserve the ValidationAware messages (errors and messages)
My struts.xml :
<action name="register" class="registerAction">
<interceptor-ref name="defaultWithoutAuthenticationStack"/>
<result type="tiles" name="input">
<param name="titleKey">global.title.register</param>
<param name="location">register</param>
</result>
<result name="success" type="redirectAction">index</result>
</action>
<action name="goRegister" class="registerAction">
<interceptor-ref name="defaultWithoutAuthenticationStack"/>
<result name="input" type="redirectAction">register</result>
<result name="success" type="redirectAction">index</result>
</action>
And my jsp :
<s:form method="post" action="goRegister" validate="true">
<s:textfield name="usernameRegister" id="usernameRegister" key="global.username" labelposition="left" />
<s:password name="passwordRegister" id="passwordRegister" key="global.password" labelposition="left" />
<s:password name="passwordConfirmRegister" id="passwordConfirmRegister" key="global.password.confirm" labelposition="left" />
<s:textfield name="emailRegister" id="emailRegister" key="global.email" labelposition="left" />
<s:submit key="global.register" name="submitRegister" method="goRegister"></s:submit>
</s:form>
I found the answer to messages preservation here, the guy store the differents action messages (messages, errors, fields error) in session when we are in a redirect situation and push them to the action messages otherwise
Here is my implementation (you will find I add success messages to the default messages and errors messages) :
public class MessagesInterceptor extends AbstractInterceptor {
/**
*
*/
private static final long serialVersionUID = -6230422534075664728L;
private Map<String, Object> session;
#Override
public String intercept(ActionInvocation invocation) throws Exception {
session = invocation.getInvocationContext().getSession();
MyAction action = (MyAction) invocation.getAction();
this.addSessionMessagesInActionMessages(action);
String output = invocation.invoke();
Result result = invocation.getResult();
// If it's a redirection, store the messages in session
if(result instanceof ServletRedirectResult || result instanceof ServletActionRedirectResult)
this.addActionMessagesInSessionMessages(action);
return output;
}
#SuppressWarnings("unchecked")
private void addSessionMessagesInActionMessages(MyAction action) {
Object messagesObject = getSession().remove(SESSION_ACTION_MESSAGES);
if (messagesObject != null) {
List<String> sessionMessages = (List<String>)messagesObject;
for (String sessionMessage : sessionMessages) {
action.addActionMessage(sessionMessage);
}
}
Object errorsObject = getSession().remove(SESSION_ACTION_ERRORS);
if (errorsObject != null) {
List<String> sessionErrors = (List<String>)errorsObject;
for (String sessionError : sessionErrors) {
action.addActionError(sessionError);
}
}
Object successObject = getSession().remove(SESSION_ACTION_SUCCESS);
if (successObject != null) {
List<String> sessionSuccessList = (List<String>)successObject;
for (String sessionSuccess : sessionSuccessList) {
action.addActionSuccess(sessionSuccess);
}
}
#SuppressWarnings("rawtypes")
Map<String, List<String>> fieldErrors = (Map) session.remove(SESSION_FIELD_ERRORS);
if (fieldErrors != null && fieldErrors.size() > 0){
for (Map.Entry<String, List<String>> fieldError : fieldErrors.entrySet()){
for (String message : fieldError.getValue()){
action.addFieldError(fieldError.getKey(), message);
}
}
}
}
protected void addActionMessagesInSessionMessages(MyAction action) throws Exception{
Collection<String> actionErrors = action.getActionErrors();
if (actionErrors != null && actionErrors.size() > 0){
session.put(SESSION_ACTION_ERRORS, actionErrors);
}
Collection<String> actionMessages = action.getActionMessages();
if (actionMessages != null && actionMessages.size() > 0){
session.put(SESSION_ACTION_MESSAGES, actionMessages);
}
Collection<String> actionSuccess = action.getActionSuccess();
if (actionSuccess != null && actionSuccess.size() > 0){
session.put(SESSION_ACTION_SUCCESS, actionSuccess);
}
Map<String, List<String>> fieldErrors = action.getFieldErrors();
if (fieldErrors != null && fieldErrors.size() > 0){
session.put(SESSION_FIELD_ERRORS, fieldErrors);
}
}
public Map<String, Object> getSession() {
return session;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
}
MyAction inherits ActionSupport
Hope this will help someone ;)
Action mesages and field validation message are now preserved with no refresh problem
But my fields values are now blank, how do I retrieve / store them to repopulate my fields ?