Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6092731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:28:43+00:00 2026-05-23T12:28:43+00:00

I trying to think in a way that I can have the same methods

  • 0

I trying to think in a way that I can have the same methods to get and print data from a JDO database to all the 3 platforms, but with the difference that if it’s a browser request it will prints in a dynamic web page generator. But I cant seem to think of a good method.

For example, if a browser asks for a post it will go to the code that prints a dynamic page + the info request. Like this

for (Texto e : results) 
        {
 print = "<table width='100%' border='2' cellspacing='2' cellpadding='2'>"
                                    + "<tr><td colspan='2'>"
                                    + results.get(0).titulo
                                    + ";</td></tr><tr><td colspan='2'>"
                                    + results.get(0).texto

But if one of the apps asks for a post it just returns:

 for (Texto e : results) 
        {
            resp.getWriter().println("Titulo:"
                + results.get(0).titulo);
            resp.getWriter().println("Nome:"
                + results.get(0).nome);

Because it doesn’t need to print to a dynamic web page and gets the info from here. So i want it to return different content based on the user platform. But using the same method call.

Now I have different links to request the same info, one to the web and one to apps (desk and android). But I was thinking in having just one link for all the three. So far i though of

1º Get information in the login cookie about the platform that is doing the request and do a if in the print methods by two different types.

2º Or just send one more parameter always with that information and do a if… etc…

But I’m thinking this methods are really unsophisticated.

Anyone has any toughs about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:28:43+00:00Added an answer on May 23, 2026 at 12:28 pm

    it’s usually made by checking “extension” and/or requests’s Accept header. For example for url like /person/profile.html you’ll render this data as HTML, or if url is /person/profile + header Accept: application/json you’ll render it as JSON.

    You can use same data for both methods, but with different serialization type. It’s easy to configure if you are using ‘Spring Web’, or similar, framework.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to user actionlink helpers in a way that I don't think
I'm trying to think of clever, clear, and simple ways to write code that
I'm trying to think of a naming convention that accurately conveys what's going on
I think I should mention I'm trying to get Entity Framework\SQL server to do
I'm trying to get this simple PowerShell script working, but I think something is
I'm trying to design a database for a sports meeting. I think I've got
I'm trying to build a Chrome browser extension, that should enhance the way the
I've got a lot of pages in my site, I'm trying to think of
I'm trying to code what I think is a fairly routine AJAX pattern using
I'm trying to do what I think is a simple thing under Linux. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.