This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java code compatibility

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make java code compatible to all browsers?
I have got 50-60jsps and java scripts... currently it works only for IE.
Can we handle the compatibility using javascript code??
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, JSP only generates the HTML. If you need certain syntax or whatever for certain browsers,
then you could get the request parameters for browser signature and perform as such.

I would personally let this up to the browser javascript itself, do not generate js via the JSP.

WP
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume most of your compatibility issues are with JavaScript, not JSPs, so I'm going to move this to our HTML, CSS, and JavaScript forum. As William pointed out, JSP code runs on your server, not the browser, though what it outputs could have browser compatibility issues.

Unfortunately, there's not a simple answer to JavaScript compatibility among different browsers. IE has been notoriously bad at sticking to standards, so anything targeting it didn't run well on other browsers. Professional web developers used to go insane trying to trick different browsers into behaving consistently, and their sad experiences are documented at length in various texts and web sites.

However, there are a couple simple things you can do:

1. Officially drop support for IE 6. Microsoft's adherence to standards improved markedly starting with IE7. IE6 was a disaster everyone should be ready to close the page on.
2. Use JQuery. JQuery takes different browsers into account and knows all the tricks to make them behave. Plus it's so much easier to use than raw JavaScript.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64848
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be precise when talking languages, there's Java and then there's JavaScript, which have nothing at all to so with each other. Be sure not to use these terms interchangeably.

So which are you actually asking about?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64848
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote:1. Officially drop support for IE 6. Microsoft's adherence to standards improved markedly starting with IE7. IE6 was a disaster everyone should be ready to close the page on.

In fact, Microsoft itself no longer supports IE6 -- no one else should either.

2. Use JQuery. JQuery takes different browsers into account and knows all the tricks to make them behave. Plus it's so much easier to use than raw JavaScript.

Very, very much this. Life is too short to write JavaScript without jQuery.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for the inputs.sorry for framing the question in a bad way.we have huge code in struts,hibernate.it is working only in IE and it shd work in al browsers. We shd finsh this EOD so i am looking to quickly finish this.couldnt find anything ready on net and i hav never tried jquery.how should i progress?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep Adibatla wrote:how should i progress?


As a first step, clearly explain with an example on what exactly doesn't work. Otherwise the question is too vague to even guess whether it's an issue with the way it's implemented in your application or something else.
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep Adibatla wrote:Thanks all for the inputs.sorry for framing the question in a bad way.we have huge code in struts,hibernate.it is working only in IE and it shd work in al browsers. We shd finsh this EOD so i am looking to quickly finish this.couldnt find anything ready on net and i hav never tried jquery.how should i progress?

I'm assuming "EOD" means End-Of-Day and not End-Of-Decade. One of your best bets probably is JQuery as others have already advised. See http://api.jquery.com/jQuery.support/
Bear already alluded to this but the fact that your application uses Struts and Hibernate has nothing to do whatsoever with the generated HTML not working in IE. That said, you will probably end up changing JSPs and .js files to include hacks for supporting IE in the generated HTML.

One protocol-related comment: Please try to spell out words fully. "shd", "al", "finsh", and "hav" may be easier for you to type but it's more difficult for people to read than "should", "all", "finish", and "have". Unless you're accessing these forums using a cellphone with no QWERTY keyboard, it borders on the impolite to make people work harder than they need to just to try to help you out. Granted, you did type the full words in some spots but a little effort in making sure your posts are readable will go a long way in getting an answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic