• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp and style sheets

 
mary sarami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying this two different ways and get stuck on both.
I am trying to display 2.css if the remote address is anything but 142 or 205, then I am trying to display 1.css
<%
String agent1 = request.getRemoteAddr();
if ( agent1 != null )
var style = 2.css;
else if ( agent1.startsWith("142.226.") | | agent1.startsWith("205.192."))
style = 1.css;
%>
<link rel="stylesheet" type="text/css" href="<%= style %>">
error
"jsp:28: Syntax: Unexpected symbol ignored"
and when I try it the following way I get a different error
<%
String agent1 = request.getRemoteAddr();

<% if ( agent1.startsWith("142.226.") | | agent1.startsWith("205.192.")) { %>
<link rel="stylesheet" type="text/css" href="1.css">
<%} else { %>
<link rel="stylesheet" type="text/css" href="2.css">
<%} %>
"Syntax: Unexpected input discarded"
I know my syntex is off, but how do I fix it??
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


<%
String agent1 = request.getRemoteAddr();
if ( agent1 != null )
var style = 2.css;

Shouldn't that be....var
String style = "2.css";


error
"jsp:28: Syntax: Unexpected symbol ignored"

what does this line # 28 contain?

- satya
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!