Archive for September, 2013

Hibernate DetachedCriteria


Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
DetachedCriteria criteria = DetachedCriteria.forClass(SmmPackageShowcase.class);
criteria.add(Restrictions.eq(“isActive”, SomemtoConstants.AKTIF));
criteria.add(Restrictions.ge(“endDate”,date));
packageShowcaseList = smmPackageShowcaseDao.findByCriteria(criteria);

@SuppressWarnings(“unchecked”)
@Override
public List findByCriteria(DetachedCriteria criteria, int firstResult,
int maxResults) throws DataAccessException {
List list = null;

criteria.add(Restrictions.eq(“rowStatus”, SomemtoConstants.AKTIF));
list = (List) getHibernateTemplate().findByCriteria(criteria);

return list;
}

, ,

Leave a comment

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