Archive for category STRUTS

Struts’da Javascript’ten java action class’n atribute’na erişim

1. Strust/jsp
function saveInParent() {

var r=confirm("Odemenizi gerceklestiyoruz. Emin misiniz!")

if (r==true)
{
var postedData =$('#navigationPage').val('success');

}

else{
var postedData =$('#navigationPage').val('input');

}

}


2. Java Acton class

public String doContinue() {
return navigationPage;
}

3. struts.xml


/jsp/cardPayment/cardPaymentForm.jsp
/jsp/cardPayment/cardPayment-success.jsp

, , ,

Leave a comment

Redirect Action Result

This result uses the ActionMapper provided by the ActionMapperFactory to redirect the browser to a URL that invokes the specified action and (optional) namespace. This is better than the ServletRedirectResult because it does not require you to encode the URL patterns processed by the ActionMapper in to your struts.xml configuration files. This means you can change your URL patterns at any point and your application will still work. It is strongly recommended that if you are redirecting to another action, you use this result rather than the standard redirect result.

See examples below for an example of how request parameters could be passed in.

Parameters
actionName (default) – the name of the action that will be redirect to
namespace – used to determine which namespace the action is in that we’re redirecting to . If namespace is null, this defaults to the current namespace
supressEmptyParameters – optional boolean (defaults to false) that can prevent parameters with no values from being included in the redirect URL.

detail link

, , ,

Leave a comment

hasActionMessages/hasActionErrors

“could not be resolved as a collection/array/map/enumeration/iterator type.”

hatasının çözümü

ActionBean içinde prepare() metodunuzu ya da default action 'da yaptığınız işleri tekrar çağırmanız gerekir.

1. public void prepare() throws Exception {
populate();
}

2. ekranda çıkan warning 'ise struts.properties " struts.devMode = false" ekleyerek gizlebiliyor.(struts xml lerinizde vereilebilir)

3. struts.xml'nizde eklemeniz lazım.

,

Leave a comment