|
Struts 2 Non-form Tags (UItags) |
|
You will get the following output:
2. Div (Ajax Tag) tag Example
The div tag is an Ajax component that is used
with Ajax that refreshes the content of a
particular section without refreshing the entire
page. The div tag when used with Ajax
refreshes the content of a particular section
without refreshing the entire page. Html <div /> tag created by Ajax div tag includes it’s
content and is used to obtain it’s content
through a remote XMLHttpRequest call through
the dojo framework.
Add the following code snippet into the
struts.xml file.
strurts.xml
<action name=”div”>
<result>/pages/div.jsp</result>
</action>
Create a jsp using the tag <s:div>.
div.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Enter first and last name</title>
<s:head theme=”ajax” debug=”false”/>
|
|
</head>
<body>
<s:url id=”test” value=”/pages/
nonformTags/mask.jsp” />
<s:div
id=”one”
theme=”ajax”
href=”%{test}”>
</s:div>
</body>
</html> mask.jsp
<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Enter first and last name</title>
<s:head theme=”ajax” debug=”false”/>
</head>
<body>
<s:div id=”maskValue” >
<div style=”position:absolute;top:10;
left:20; width:300;
height:175;background-color:#E5E5E5;”>
<h3>Enter first and last name:</h3>
<s:form theme=”ajax” action=”doMask”>
<s:textfield name=”firstname”
label=”Firstname” />
<s:textfield name=”lastname”
label=”Lastname” />
<s:submit value=”Submit”
theme=”ajax” targets=”maskValue” />
</s:form>
</div>
<br>
<div id=”8"
style=”position:absolute;top:10; left:350;
width:300; height:160;backgroundcolor:#
E5E5E5;”>
<h3>Output: </h3>
Firstname : <s:property
value=”firstname” />
<br><br>
Lastname : <s:property
value=”lastname” />
</div> |
|
Mar
2008 | Java Jazz Up |31 |
|
|
|
View All Topics |
All Pages of this Issue |
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
Download PDF |
|
|
|
|
|
|
|
|
|