处理RTL和LTR

时间:2015-03-20 13:00:45

标签: jsp

我已经在jsp中为登录页面编写了一个代码。在登录表单中我给出了一个选择的语言列表,它将重新加载登录页面。但问题是当我选择阿拉伯语言时RTL在登录页面中并不满意并且在登录后RTL没有发生。与此类似,当我在RTL并选择英语LTR没有发生。从英语登陆LTR后发生了上述情况。 请建议我如何处理这个。代码附后。



<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<%@page pageEncoding="utf-8"%>
<%@page import="java.util.ResourceBundle"%>
<%
	String locale = null;
	String theme = null;
	String ltrRtl = "ltr";
	Cookie[] cookies = request.getCookies();

	locale = ( String ) request.getParameter( "locale" );
	for ( int i = 0; cookies != null && i < cookies.length; i++ ) {
		Cookie c = cookies[i];
		if ( c != null && c.getName() != null && c.getName().equals( "lumina_theme" ) ) {
			theme = c.getValue();
		}
		if ( c != null && c.getName() != null && c.getName().equals( "gwtLocale" ) ) {
			if ( locale == null || "".equals( locale ) ) {
				locale = c.getValue();
			}
			ltrRtl = ( c.getValue() != null && c.getValue().equals( "ar" ) ) ? "rtl" : "ltr";
		}
	}

	if ( locale == null || "".equals( locale ) ) {
		locale = "en";
	}

	if ( theme == null || "".equals( theme ) ) {
		theme = "inception";
	}
%>

<%@page import="java.io.InputStream"%>
<%@page import="java.util.Properties"%>

<%
	InputStream stream = application.getResourceAsStream( "/WEB-INF/classes/LuminaSeedMessagesAndLabels_" + locale + ".properties" );
	Properties props = new Properties();
	props.load( stream );
%>

<title><%=new String( props.getProperty( "Product.Name" ).getBytes( "ISO-8859-1" ), "UTF-8" )%></title>

<link rel="stylesheet" href="./application_gui_resources/themes/common/ltr/animations.css" />
<link
	href="application_gui_resources/themes/common/<%=ltrRtl%>/CommonLogin.css"
	rel="stylesheet" type="text/css" />
<link
	href="application_gui_resources/themes/<%=theme%>/<%=ltrRtl%>/Login.css"
	rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon"
	href="./application_gui_resources/themes/common/ltr/icons/kivar-logo.png" />
</head>
<body>
	<div id="header">
		<div id="headerProductLogo"></div>
	</div>

	<%
		String code = request.getParameter( "code" );
		if ( "true".equals( request.getAttribute( "showLogInConfirm" ) ) ) {
		}
		else if ( request.getAttribute( "errorMessage" ) != null ) {
			out.print( "<div class='license-expiry-status-bar'>" + request.getAttribute( "errorMessage" ) + "</div>" );
		}
		else if ( code != null && !code.isEmpty() ) {
			out.print( "<div class='license-expiry-status-bar'>" + new String( props.getProperty( "Error.Codes." + code ).getBytes( "ISO-8859-1" ), "UTF-8" ) + "</div>" );
		}
	%>

	<div class="row block0">
		<div class="col-3-5">
			<div class="block01 animetiondiv"></div>
		</div>
		<div class="col-1-3">
			<div class="block02">

				<%
					String displayValue = "display:none";
					String userName = "";
					String key = "";
					if ( "true".equals( request.getAttribute( "showLogInConfirm" ) ) ) {
						displayValue = "";
						userName = request.getParameter( "username" );
						key = request.getParameter( "password" );
					}
				%>

				<form name="login" class="bounceIn" id="Login" action="login" method="post">
					<div id="Loginmaindiv">
						<div class="headertitle"><%=new String( props.getProperty( "Login.Welcome" ).getBytes( "ISO-8859-1" ), "UTF-8" )%></div>
						<%
							String en = "en".equals( locale ) ? "selected" : "";
							String ar = "ar".equals( locale ) ? "selected" : "";
							String fr = "fr".equals( locale ) ? "selected" : "";
							String es = "es".equals( locale ) ? "selected" : "";
						%>
						<select name='locale' class="locale"
							onchange="document.location.href = 'Login.jsp?locale=' + this.value">
							<option value="en" <%=en%>>English</option>
							<option value="ar" <%=ar%>>العربية</option>
							<option value="fr" <%=fr%>>français</option>
							<option value="es" <%=es%>>Español</option>
						</select>
						<div class="clear"></div>
						<div class="inputs">
							<input type="text" name="username"
								placeholder=<%=new String( props.getProperty( "Login.Username" ).getBytes( "ISO-8859-1" ), "UTF-8" )%>
								autofocus value="<%=userName%>" /> <input type="password"
								name="password"
								placeholder=<%=new String( props.getProperty( "Login.Password" ).getBytes( "ISO-8859-1" ), "UTF-8" )%>
								value="" />
							<div class="clear"></div>
							<a class="forgot-password"
								href="<%="PasswordReset.jsp?locale=" + locale%>"><%=new String( props.getProperty( "Login.ForgotPassword" ).getBytes( "ISO-8859-1" ), "UTF-8" )%></a>
							<div class="buttondiv">
								<button id="submit" type="submit" value="Log In"><%=new String( props.getProperty( "Login.LogIn" ).getBytes( "ISO-8859-1" ), "UTF-8" )%></button>
							</div>
							<div class="clear"></div>
						</div>
					</div>
				</form>
			</div>
		</div>

		<div class='lumina-concurrent-user-login' style='<%=displayValue%>'>
			<form name="loginconfirm" id="Login" action="loginconfirm"
				method="post">
				<div id="Loginmaindiv">
					<div class="headertitle">Log In Confirmation</div>
					<div class="clear"></div>
					<div class="inputs">
						<div class='lumina-concurrent-user-login-text'><%=new String( props.getProperty( "Login.ConfirmationMessage" ).getBytes( "ISO-8859-1" ), "UTF-8" )%></div>
						<input type="hidden" name="hiddenname" value="<%=userName%>" /> <input
							type="hidden" name="hiddenkey" value="<%=key%>" />
						<div class="buttondiv">
							<button id="submit" type="submit" name='yesno' value="yes">Yes</button>
							<button id="submit" type="submit" name='yesno' value="no">No</button>
						</div>
						<div class="clear"></div>
					</div>
				</div>
			</form>
		</div>

		<div class="clear"></div>
	</div>
	<div id="footer"><%=new String( props.getProperty( "Login.Copyright" ).getBytes( "ISO-8859-1" ), "UTF-8" )%></div>
</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案