Struts 2:不显示文本框标签 [英] Struts 2: textbox label is not displayed
问题描述
我是Struts 2的新手,并开始构建我的新应用程序。我用简单的文本框和一个按钮创建了一个JSP页面,但是我的文本框标签没有显示出来。这是我的JSP代码,
I am new to Struts 2 and started to build my new application. I created a JSP page with simple textbox and a button but my textbox labels are not getting displayed. here is my JSP code,
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Enter Outbound details</title>
</head>
<body>
<s:form action="outbound.action" method="post">
<h1> Enter required details for fetching outbound log</h1>
<s:textfield label="StationId" name="StationId" size="20" />
<s:textfield label="Username" name="username" />
<s:submit method="execute" value="Submit" align="center" />
</s:form>
</body>
</html>
我的输出是(抱歉,我无法粘贴图像)
My output is (sorry i could not paste the image),
输入获取出站日志所需的详细信息
Enter required details for fetching outbound log
文本框文本框 sumbit_button
我只能看到文本框。我找不到标签。我不确定我在哪里犯错。如果需要其他详细信息,请告诉我。
I could see only the textbox. I cant find the label. I am not sure where I am making the mistake. Please let me know in case if any additional details are needed.
推荐答案
如果 xhtml
或,则呈现标签css_xhtml
主题已应用。主题还用于通过模板注入到文档中的其他标记。您应该更改用于每个页面的默认主题,或者使用 s:form
标记 theme
属性覆盖默认值
Labels are rendered if xhtml
or css_xhtml
themes applied. Themes are also used for other markup injected into the document via templates. You should either change the default theme used for every page or use the s:form
tag theme
attribute to override the default setting.
<s:form action="outbound.action" method="post" theme="xhtml">
这篇关于Struts 2:不显示文本框标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!