Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

dgasull

« Newer Snippets
Older Snippets »
Showing 1-6 of 6 total  RSS 

How to get a parameter from the RequestContext in Spring

// How to get a parameter from the org.springframework.webflow.execution.RequestContext in Spring framework

// Java:
String myParameter = context.getExternalContext().getRequestParameterMap().get("myParameterPath");


// JSP:
<form:select path="myParameterPath" id="myParameterId">
    ...
</form:select>


// HTML rendered as:
<select name="myParameterPath" id="myParameterId">
...
</select>

bean tag template for injection in springs-context-services.xml


	<bean id="fooService" class="com.example.bar.fooServiceImpl">
		<property name="fooDao" ref="fooDao"/>
		<!-- There may be more property tags -->
	</bean>

Documentum JSP template

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
       pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/tlds/dmform_1_0
.tld" prefix="dmf"%>
<%@ taglib uri="/WEB-INF/tlds/dmformext_1_0.tld" prefix="dmfx"%>

<%-- Importa la clase controladora para poder acceder a los atributos --%>
<%@ page import="com.example.foo.Bar" %>

<%-- Para poder acceder a la clase Form desde código Java en la .jsp. --%>
<%@ page import="com.documentum.web.form.Form" %>

<html>
<head>

       <%-- Ejecuta la clase controladora --%>
       <dmf:webform validation="true" />

       <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
       <title></title>
</head>
<body>
       <%-- Some code --%>

       <%-- necesario para cualquier botón, incluido javascript --%>
       <dmf:form name="fooForm">

               <%-- Some code --%>

       </dmf:form>

       <%-- Some code --%>
</body>
</html>

How to get a String with just the date from a Calendar

// Given Calendar cal

String date = cal.get(Calendar.DAY_OF_MONTH) + "-" 
    + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR);

How to add days to a date

// You should use the class Calendar.

// Given Calendar cal and int n with the number of days
cal.add(Calendar.DATE, n);

How to convert a String with a date to a Calendar

SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Date date = sdf.parse(strDate);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
« Newer Snippets
Older Snippets »
Showing 1-6 of 6 total  RSS