aspose file tools*
The moose likes JNLP and Web Start and the fly likes hitsofweb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "hitsofweb" Watch "hitsofweb" New topic
Author

hitsofweb

hitkumar patel
Greenhorn

Joined: Dec 21, 2009
Posts: 1
=========web.xml====================================================
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>


<servlet>
<servlet-name>SpringContext</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
==========faces-config.xml=============================================
<!-- Application converter Start -->
<converter>
<converter-for-class>java.lang.String</converter-for-class>
<converter-class>web.clerk.webapp.dui.convertor.EmptyToNullConverter</converter-class>
</converter>
<converter>
<converter-id>NumberProtectionConverter</converter-id>
<converter-class>
web.clerk.webapp.dui.convertor.NumberProtectionConverter
</converter-class>
</converter>
<!-- Application converter End -->

<!-- Application validator Start -->
<validator>
<validator-id>CaseNumberValidator</validator-id>
<validator-class>web.clerk.webapp.dui.validator.CaseNumberValidator</validator-class>
</validator>
<!-- Application validator End -->


in JSP:
<hutputText value="#{referralBean.socialSecurityNumber}">
<f:converter converterId="NumberProtectionConverter"/>
</hutputText>

<h:inputText id="recentDUIArrestDate" required="true" value="#{referralBean.recentDUIArrestDate}" maxlength="10" size="12" label="#{bundle.referralform_recentDuiArrestDate}" onblur="formatDate(this);" onkeypress="return validateDate(event)" >
<f:convertDateTime pattern="#{bundle.datePattern}" />
<f:validator validatorId="PastDateValidator"/>
</h:inputText>


=============Converter==============================================
package web.clerk.webapp.dui.convertor;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

public class NumberProtectionConverter implements Converter{

/* (non-Javadoc)
* @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)
*/
public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
String inputNumber = (String)value;
String protectedString = "XXX-XX-"+inputNumber.substring(7);
return protectedString;
}
}

==========================validater==================================

package web.clerk.webapp.iucs.validator;

import java.util.regex.Pattern;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

public class PhoneNumberValidator implements Validator{

public PhoneNumberValidator() {
}

public void validate(FacesContext context, UIComponent component, Object value)
throws ValidatorException {
String strValue = (String)value;

String regex = "[0-9]{3}-[0-9]{3}-[0-9]{4}";
boolean isMatch = Pattern.matches(regex, strValue);

if (!isMatch){
FacesMessage message = new FacesMessage();
message.setDetail("Phone number is not valid.Please enter in XXX-XXX-XXXX format.");
message.setSummary("Phone number is not valid.Please enter in XXX-XXX-XXXX format.");
message.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(message);
}
}
}


public class CountyDAO {

public List getCountyNameList(){

LoggerUtils.info("Inside " + this.getClass().getName()
+ " --> getCountyNameList method --> Enter ");

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction transaction = session.getTransaction();

transaction.begin();
List countyList = null;
try {
Criteria criteria = session.createCriteria(County.class);
criteria.setProjection(Projections.distinct(Projections.property("name")));
countyList = criteria.list();

transaction.commit();
} catch (Exception e) {
LoggerUtils
.info("Transaction rollbacked in getCountyNameList method of "
+ this.getClass().getName() + " !!! ");
transaction.rollback();
e.printStackTrace();

LoggerUtils.error("Inside " + this.getClass().getName()
+ " --> getCountyNameList method --> Error Message -->"
+ e.getMessage(), e);
}

LoggerUtils.info("Inside " + this.getClass().getName()
+ " --> getCountyNameList method --> Exit ");

return countyList;
}
}


applicationContext.xml


<bean id="userProfileDAO" class="com...dao.impl.user.UserProfileDAOImpl">
<property name="sessionFactory"><ref local="hibernateSessionFactory"/></property>
</bean>
<bean id="userProfileService" class="com.service.impl.user.UserProfileServiceImpl">
<property name="userProfileDAO" ><ref local="userProfileDAO"/></property>
</bean>


<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://ducs/iinkit"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
<!--
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
current_session_context_class=thread
cache.provider_class=org.hibernate.cache.NoCacheProvider
cache.use_second_level_cache=false
transaction.auto_close_session=true
</value>
</property>
<property name="mappingResources">
<list>
<value>com\iinkit\pojo\UserProfile.hbm.xml</value>
<value>com\conscisys\iinkit\pojo\UserGroup.hbm.xml</value>
</list>
</property>
-->
</bean>



import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.FetchMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hibernate.sql.JoinFragment;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.pojo.user.UserProfile;
import com.util.ApplicationConstants;

public class UserProfileDAOImpl extends HibernateDaoSupport {

public Serializable add(Object persistentObject) {
return getHibernateTemplate().save(persistentObject);
}



public void modify(Object persistentObject, Serializable pkClass) {
getHibernateTemplate().saveOrUpdate(persistentObject);
}
public void remove(Class<?> persistentObjectClass,
Serializable pkClass) {
getHibernateTemplate().delete(getHibernateTemplate().get(persistentObjectClass, pkClass));
}


public Serializable view(Class<?> persistentObjectClass,
Serializable pkClass) {
return (Serializable) getHibernateTemplate().get(persistentObjectClass, pkClass);
}


public List<?> list(Class<?> persistentObjectClass){
return getHibernateTemplate().loadAll(persistentObjectClass);
}
public List<?> listWithPageLimit(Class<?> persistentObjectClass,Integer startRange,Integer maxResultRange){
DetachedCriteria criteria = DetachedCriteria.forClass(persistentObjectClass);
return getHibernateTemplate().findByCriteria(criteria, startRange, maxResultRange);
}

public UserProfile getUserProfileByUserID(String userID) {
StringBuilder query = new StringBuilder("from UserProfile ");
query.append("where ");
query.append("userid = '").append( userID ).append("' ");
List<?> find = getHibernateTemplate().find( query.toString() );
if(find!=null && find.size()>0)
{
return (UserProfile)find.get(0);
}
return null;
}

@SuppressWarnings("unchecked")
public List<UserProfile> listUserProfileForUserOffers(final Integer subscription_ID)
{
return getHibernateTemplate().executeFind(new HibernateCallback(){
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Criteria criteria = session.createCriteria(UserProfile.class, "userProfile").
createAlias("userOffers", "userOffers", JoinFragment.INNER_JOIN);
Criterion notForAll = Restrictions.eq("userOffers.subscription_ID", subscription_ID);
criteria.add(notForAll);
List list = criteria.list();
return list;
}
});
}

@SuppressWarnings("unchecked")
public List<UserProfile> listForUserProfile(UserProfile userProfile) {
DetachedCriteria detachedCriteria = getDetachedCriteria(userProfile);
List<UserProfile> find = getHibernateTemplate().findByCriteria(detachedCriteria);
return find;
}

@SuppressWarnings("unchecked")
public List<UserProfile> searchUserProfiles(UserProfile userProfile, Integer startRange,
Integer maxResultRange, String orderBy, String orderType) {
DetachedCriteria detachedCriteria = getDetachedCriteria(userProfile);
if(orderType.equals(ApplicationConstants.SORT_DESC))
detachedCriteria.addOrder(Order.desc(orderBy));
else
detachedCriteria.addOrder(Order.asc(orderBy));
List<UserProfile> find = getHibernateTemplate().findByCriteria(detachedCriteria,
startRange, maxResultRange);
return find;
}

public DetachedCriteria getDetachedCriteria(UserProfile userProfile)
{
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(UserProfile.class);

detachedCriteria.setFetchMode("userGroup", FetchMode.JOIN);
detachedCriteria.createAlias("userGroup", "userGroup");
detachedCriteria.add(Restrictions.eq("userGroup.userGroup_id", ApplicationConstants.CUSTOMER_GROUP));

if(userProfile.getUseridSearch() != null && userProfile.getUseridSearch().trim().length() != 0)
{
detachedCriteria.add(Restrictions.like("userid", "%" + userProfile.getUseridSearch().trim() + "%"));
}

if(userProfile.getLastNameSearch() != null && userProfile.getLastNameSearch().trim().length() != 0)
{
detachedCriteria.add(Restrictions.like("lastName", "%" + userProfile.getLastNameSearch().trim() + "%"));
}

if(userProfile.getIsActiveSearch() != null && userProfile.getIsActiveSearch().trim().length() != 0)
{
detachedCriteria.add(Restrictions.eq("isActive", userProfile.getIsActiveSearch().trim()));
}

if(userProfile.getIsCompanySearch() != null && userProfile.getIsCompanySearch().trim().length() != 0)
{
detachedCriteria.add(Restrictions.eq("isCompany", userProfile.getIsCompanySearch().trim()));
}

return detachedCriteria;
}

@SuppressWarnings("unchecked")
public UserProfile getUserProfileFromGroupID(int userGroupID){
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(UserProfile.class);
detachedCriteria.setFetchMode("userGroup", FetchMode.JOIN);
detachedCriteria.createAlias("userGroup", "userGroup");
detachedCriteria.add(Restrictions.eq("userGroup.userGroup_id", userGroupID));
List<UserProfile> find = getHibernateTemplate().findByCriteria(detachedCriteria);
if(find.size()>0)
return find.get(0);
return null;
}
}
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

I don't see a question in that post. And I don't see anything related to JNLP or WebStart. So, hitkumar, which forum would you like it moved to?

And when you respond to that, please provide a question, or at least some reason why you posted it. And while you are doing that, please format your code using the code tags so that interested parties would find it easier to read.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hitsofweb