суббота, 9 марта 2013 г.

AJAX приложения, Поисковая оптимизация и зачем это нужно


Сегодня, интернет технологии открывают нам огромные просторы для воображения и для осуществления самых смелых идей. На том же уровне находится и интернет сообщество – люди открыты для нового. Но, несмотря на это, большинство интернет ресурсов даже сайтами назвать сложно, просто вэб страницы. Встает вопрос, почему такой низкий уровень использования новых технологий. Данная статья описывает технологию AJAX и “проблемы”, которые с ней связаны. Также мы разберем методики поисковой оптимизации для сайтов использующих AJAX. 

Введение в AJAX

AJAX(Asynchronous Javascript and XML) – технология для построения «богатых» пользовательских интерфейсов. Суть технологии заключается в обмене данными клиента (браузера) с сервером в фоновом режиме. Традиционно при ответе сервера на запрос клиента страница полностью перегружалась. AJAX же, отправляет запрос серверу в фоновом режиме и обновляет только нужную часть страницы при получении ответа. 

Поисковая оптимизация для AJAX приложений

вторник, 9 октября 2012 г.

JSF Tutorials: Using SEAM 3 Remoting


In this tutorial I am going to give an overview of Seam 3 Remoting module and give a simple example of how to use it.

Dependency:
Seam Conversation module

The basic idea behind Seam remoting module is to give a developer a tool to work with his Beans without using a JSF actionListeners or something else. Everything is made in background by AJAX. All you need is to execute a JavaScript Function like the following one:

Seam.createBean('myBean').myMethod(arguments,callbackFunction);

Basically you are creating an "instance" of your object on the client side and executing its methods via AJAX.

So lets see an example of how can we use Seam 3 Remoting:

1. Configuration

Put Seam libraries into your project we will definitely need seam-remoting.jar and seam-conversation.jar.

2. Server side:


import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import org.jboss.seam.remoting.annotations.WebRemote;
@Named
@RequestScoped
public class TestBean {     @WebMethod // Enables this method for use in client side     public String sayHello(String name) {         return "Hello, " + name;     } }

Nothing else is needed on server side.
2. Client side:
You have to add needed .JS libraries into your view:

<script type="text/javascript" src="seam/resource/remoting/resource/remote.js?compress=false"></script> // core remoting library
<script type="text/javascript" src="seam/resource/remoting/interface.js?testBean"></script>
// your Bean instance
Also you can also write interface.js?yourFirstBean&yourSecondBean
Next you can make use of Seam Remoting:
3. Usage:
function sayHello() {
  var name = prompt("Please enter your name:");
  Seam.createBean('myBean').myMethod(name,callbackFunction);
}
function callbackFunction(result) {
  alert(result);
}

Best regards,
NETLink community member

четверг, 26 апреля 2012 г.

JSF HTML tag library - Form


h:form

This tag renders an HTML form element. It uses the "post-back" technique to submit form data back to the page that contains the form. The use of the POST method is also required and it is not possible to use the GET method for forms generated by this tag.
If your application requires the use of the GET method for form submission, your options include using plain HTML forms, binding request parameters to backing bean properties, and using the outputLink tag to generate dynamic hyperlinks.
Example
<h:form id="formid"></h:form>
HTML Output
<form id="formid" name="formid" method="post" action="/yourapp/form.jsp" enctype="application/x-www-form-urlencoded"></form>

Tag Attributes

acceptText
 
The accept attribute identifies the list of content types that the server processing this form is able to handle.
acceptcharsetText
 
The acceptcharset attribute identifies the list of character encodings for user input data that the server processing this form will accept.
bindingExpression
 
The value-binding expression linking this component tag to a backing bean property.
dirEnumerated
 
The dir attribute is a standard HTML attribute that overrides the default text directionality for this component. The values accepted for this component are "LTR" (left-to-right) and "RTL" (right-to-left).
enctypeEnumerated
 
The enctype attribute sets the content type of the data to be submitted to the server. The default value for this attribute is "application/x-www-form-urlencoded".
idText
 
The unique identifier value for this component. The value must be unique within the closest naming container.
langText
 
The lang attribute is a standard HTML attribute that sets the code describing the language to be used in the markup generated by this component.
onclickText
 
The onclick attribute sets the JavaScript code to execute when the mouse pointer is clicked over this element.
ondblclickText
 
The ondblclick attribute sets the JavaScript code to execute when the mouse pointer is double-clicked over this element.
onkeydownText
 
The onkeydown attribute sets the JavaScript code to execute when a key is pressed down over this element.
onkeypressText
 
The onkeypress attribute sets the JavaScript code to execute when a key is pressed and released over this element.
onkeyupText
 
The onkeyup attribute sets the JavaScript code to execute when a key is released over this element.
onmousedownText
 
The onmousedown attribute sets the JavaScript code to execute when the mouse pointer is pressed down over this element.
onmousemoveText
 
The onmousemove attribute sets the JavaScript code to execute when the mouse pointer is moved within this element.
onmouseoutText
 
The onmouseout attribute sets the JavaScript code to execute when the mouse pointer is moved away from this element.
onmouseoverText
 
The onmouseover attribute sets the JavaScript code to execute when the mouse pointer is moved onto this element.
onmouseupText
 
The onmouseup attribute sets the JavaScript code to execute when the mouse button is released over this element.
onresetText
 
The onreset attribute sets the JavaScript code to execute when the form is reset.
onsubmitText
 
The onsubmit attribute sets the JavaScript code to execute when the form is submitted.
renderedBoolean
 
A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered.
styleCSS Style
 
The style attribute sets the CSS style definition to be applied to this component when it is rendered.
styleClassCSS Class
 
The styleClass attribute sets the CSS class to apply to this component when it is rendered.
targetText
 
The target attribute identifies the name of a frame into which the resource retrieved by this hyperlink should be displayed.
titleText
 
The title attribute is a standard HTML attribute that sets the tooltip text to display for the rendered component.

JSF HTML tag library - InputHidden


h:inputHidden

The inputHidden tag renders an HTML input element of the type "hidden". It is essential that this tag is inside the <h:form> tag.


Example


<h:inputHidden id="hiddenValue" value="#{yourbean.hiddenValue}" />

HTML Output


<input id="form:hiddenValue" name="form:hiddenValue"  type="hidden" value="Your Hidden Value"/>

Tag Attributes

bindingExpression
The value-binding expression linking this component tag to a backing bean property.
converterText
The converter attribute sets the converter instance to be registered for this component. It must match the converter-id value of a converter element defined in your Faces configuration file.
idText
The unique identifier value for this component. The value must be unique within the closest naming container.
immediateBoolean
The immediate attribute is a boolean flag indicating that component events should be sent to registered event listeners immediately rather than after the validation phase of the JSF request processing lifecycle. The immediate flag allows you bypass JSF validation for a particular component.
renderedBoolean
A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered.
requiredBoolean
The required attribute is a boolean flag that indicates whether or not the user is required to provide a value for this field before the form can be submitted to the server.
validatorText
The validator attribute accepts a method-binding expression representing a validator method that will be called when the JSF framework validates this component. A validator method must be a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void.
valueText
The value attribute sets the current value for this component.
valueChangeListenerText
The valueChangeListener attribute accepts a method-binding expression representing a value change listener method to be notified when a new value has been set for this input component. A value change listener method must be a public method that takes a ValueChangeEvent parameter, with a return type of void.

JSF HTML tag library - InputSecret


h:inputSecret

The inputSecret tag renders an HTML input element of the type "password". It is essential that this tag is inside the <h:form> tag.


Example


<h:inputSecret id="password" value="#{yourbean.password}" />

HTML Output


<input id="form:password" name="form:password" type="password" />

Tag Attributes

accesskeyText
The accesskey attribute is a standard HTML attribute that sets the access key that transfers focus to this element when pressed.
altText
The alt attribute is a standard HTML attribute that sets the alternate textual description rendered by this component.
bindingExpression
The value-binding expression linking this component tag to a backing bean property.
converterText
The converter attribute sets the converter instance to be registered for this component. It must match the converter-id value of a converter element defined in your Faces configuration file.
dirEnumerated
The dir attribute is a standard HTML attribute that overrides the default text directionality for this component. The values accepted for this component are "LTR" (left-to-right) and "RTL" (right-to-left).
disabledBoolean
The disabled attribute is a boolean flag that when set to true indicates that this component should not receive focus or be included in a form submit.
idText
The unique identifier value for this component. The value must be unique within the closest naming container.
immediateBoolean
The immediate attribute is a boolean flag indicating that component events should be sent to registered event listeners immediately rather than after the validation phase of the JSF request processing lifecycle. The immediate flag allows you bypass JSF validation for a particular component.
langText
The lang attribute is a standard HTML attribute that sets the code describing the language to be used in the markup generated by this component.
maxlengthText
The maxlength attribute sets the maximum length in characters of the string accepted by this input component.
onblurText
The onblur attribute sets the JavaScript code to execute when this element loses focus.
onchangeText
The onchange attribute sets the JavaScript code to execute when this element loses focus and its value changes after gaining focus.
onclickText
The onclick attribute sets the JavaScript code to execute when the mouse pointer is clicked over this element.
ondblclickText
The ondblclick attribute sets the JavaScript code to execute when the mouse pointer is double-clicked over this element.
onfocusText
The onfocus attribute sets the JavaScript code to execute when the element receives focus.
onkeydownText
The onkeydown attribute sets the JavaScript code to execute when a key is pressed down over this element.
onkeypressText
The onkeypress attribute sets the JavaScript code to execute when a key is pressed and released over this element.
onkeyupText
The onkeyup attribute sets the JavaScript code to execute when a key is released over this element.
onmousedownText
The onmousedown attribute sets the JavaScript code to execute when the mouse pointer is pressed down over this element.
onmousemoveText
The onmousemove attribute sets the JavaScript code to execute when the mouse pointer is moved within this element.
onmouseoutText
The onmouseout attribute sets the JavaScript code to execute when the mouse pointer is moved away from this element.
onmouseoverText
The onmouseover attribute sets the JavaScript code to execute when the mouse pointer is moved onto this element.
onmouseupText
The onmouseup attribute sets the JavaScript code to execute when the mouse button is released over this element.
onselectText
The onselect attribute sets the JavaScript code to execute when the user selects the text contained by this element.
readonlyBoolean
The readonly attribute is a boolean flag that when set to true prohibits changes to this element by the user. The element will continue to receive focus unless you set the disabled attribute to true.
renderedBoolean
A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered.
requiredBoolean
The required attribute is a boolean flag that indicates whether or not the user is required to provide a value for this field before the form can be submitted to the server.
sizeText
The size attribute sets the width in characters of this input field.
styleCSS Style
The style attribute sets the CSS style definition to be applied to this component when it is rendered.
styleClassCSS Class
The styleClass attribute sets the CSS class to apply to this component when it is rendered.
tabindexText
The tabindex attribute is a standard HTML attribute that sets the order in which this element receives focus when the user cycles through the elements using the TAB key. The value for this attribute must be an integer between 0 and 32767.
titleText
The title attribute is a standard HTML attribute that sets the tooltip text to display for the rendered component.
validatorText
The validator attribute accepts a method-binding expression representing a validator method that will be called when the JSF framework validates this component. A validator method must be a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void.
valueText
The value attribute sets the current value for this component.
valueChangeListenerText
The valueChangeListener attribute accepts a method-binding expression representing a value change listener method to be notified when a new value has been set for this input component. A value change listener method must be a public method that takes a ValueChangeEvent parameter, with a return type of void.

JSF HTML tag library - InputText


h:inputText

The inputText tag renders an HTML input element of the type "text". It is essential that your tag is inside the <h:form> tag.


Example


<h:inputText id="login" value="#{yourbean.username}" />

HTML Output


<input id="form:login" name="form:login" type="text" />

Tag Attributes

accesskeyText
 
The accesskey attribute is a standard HTML attribute that sets the access key that transfers focus to this element when pressed.
altText
 
The alt attribute is a standard HTML attribute that sets the alternate textual description rendered by this component.
bindingExpression
 
The value-binding expression linking this component tag to a backing bean property.
converterText
 
The converter attribute sets the converter instance to be registered for this component. It must match the converter-id value of a converter element defined in your Faces configuration file.
dirEnumerated
 
The dir attribute is a standard HTML attribute that overrides the default text directionality for this component. The values accepted for this component are "LTR" (left-to-right) and "RTL" (right-to-left).
disabledBoolean
 
The disabled attribute is a boolean flag that when set to true indicates that this component should not receive focus or be included in a form submit.
idText
 
The unique identifier value for this component. The value must be unique within the closest naming container.
immediateBoolean
 
The immediate attribute is a boolean flag indicating that component events should be sent to registered event listeners immediately rather than after the validation phase of the JSF request processing lifecycle. The immediate flag allows you bypass JSF validation for a particular component.
langText
 
The lang attribute is a standard HTML attribute that sets the code describing the language to be used in the markup generated by this component.
maxlengthText
 
The maxlength attribute sets the maximum length in characters of the string accepted by this input component.
onblurText
 
The onblur attribute sets the JavaScript code to execute when this element loses focus.
onchangeText
 
The onchange attribute sets the JavaScript code to execute when this element loses focus and its value changes after gaining focus.
onclickText
 
The onclick attribute sets the JavaScript code to execute when the mouse pointer is clicked over this element.
ondblclickText
 
The ondblclick attribute sets the JavaScript code to execute when the mouse pointer is double-clicked over this element.
onfocusText
 
The onfocus attribute sets the JavaScript code to execute when the element receives focus.
onkeydownText
 
The onkeydown attribute sets the JavaScript code to execute when a key is pressed down over this element.
onkeypressText
 
The onkeypress attribute sets the JavaScript code to execute when a key is pressed and released over this element.
onkeyupText
 
The onkeyup attribute sets the JavaScript code to execute when a key is released over this element.
onmousedownText
 
The onmousedown attribute sets the JavaScript code to execute when the mouse pointer is pressed down over this element.
onmousemoveText
 
The onmousemove attribute sets the JavaScript code to execute when the mouse pointer is moved within this element.
onmouseoutText
 
The onmouseout attribute sets the JavaScript code to execute when the mouse pointer is moved away from this element.
onmouseoverText
 
The onmouseover attribute sets the JavaScript code to execute when the mouse pointer is moved onto this element.
onmouseupText
 
The onmouseup attribute sets the JavaScript code to execute when the mouse button is released over this element.
onselectText
 
The onselect attribute sets the JavaScript code to execute when the user selects the text contained by this element.
readonlyBoolean
 
The readonly attribute is a boolean flag that when set to true prohibits changes to this element by the user. The element will continue to receive focus unless you set the disabled attribute to true.
renderedBoolean
 
A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered.
requiredBoolean
 
The required attribute is a boolean flag that indicates whether or not the user is required to provide a value for this field before the form can be submitted to the server.
sizeText
 
The size attribute sets the width in characters of this input field.
styleCSS Style
 
The style attribute sets the CSS style definition to be applied to this component when it is rendered.
styleClassCSS Class
 
The styleClass attribute sets the CSS class to apply to this component when it is rendered.
tabindexText
 
The tabindex attribute is a standard HTML attribute that sets the order in which this element receives focus when the user cycles through the elements using the TAB key. The value for this attribute must be an integer between 0 and 32767.
titleText
 
The title attribute is a standard HTML attribute that sets the tooltip text to display for the rendered component.
validatorText
 
The validator attribute accepts a method-binding expression representing a validator method that will be called when the JSF framework validates this component. A validator method must be a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void.
valueText
 
The value attribute sets the current value for this component.
valueChangeListenerText
 
The valueChangeListener attribute accepts a method-binding expression representing a value change listener method to be notified when a new value has been set for this input component. A value change listener method must be a public method that takes a ValueChangeEvent parameter, with a return type of void.