• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java MySql WordPress  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

is it possible to write data in a WordPress form, validate it and make business logic using Java and insert it in Mysql? All inside the WordPress context, like adding one plugin for writing Java code and another for the DB or similar case.

Any info, please?

Regards, Isaac
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course you can use Java® code to insert data in a database. Don't know about wordpress.
 
chris webster
Bartender
Posts: 2407
36
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why you would want to do this. Wordpress has plugins for form validation and you can write custom validations if you want using the appropriate tools: https://developer.wordpress.org/plugins/security/data-validation/

More importantly, you are effectively hijacking Wordpress and hacking around all the Wordpress standard functionality, including security functions, in order to write directly to the database. Like some kind of JavaInjection attack. This introduces a number of potential problems:

  • Your Java code will access the DB directly from the JVM, outside the normal Wordpress user security model, so you need to ensure your JVM app is secure.
  • You need to understand the Wordpress data model and ensure that you respond to any changes to the data model e.g. if the owner upgrades to a new version of WP.
  • You need to understand how your code will interact with any third-party plugins that might have been added to this Wordpress installation, including any upgrades to these.
  • If you get any of this wrong you may well break the entire Wordpress installation.
  • Whoever is responsible for running the Wordpress server now has to maintain a Java server as well.

  • Why are you trying to implement business logic in Java for a Wordpress installation? Wordpress is written in PHP, and it has a mature and widely used set of APIs, extension points and plugin mechanisms for you to extend the built-in functionality in whatever way you want. Why not use these?

    If this is just a fun project on your own Wordpress installation to see if you can do this kind of thing, then good luck to you. But if anybody is paying you to do this on a system that actually matters in any way, then my personal view is that they probably need to get their head examined.
     
    Isaac Ferguson
    Ranch Hand
    Posts: 1063
    3
    Java Netbeans IDE Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator


    The flux is like this: a user goes into my WordPress page, introduce their CV vitae data, and for every user a record is created and for every record a report is created.

    So I thougth that (I m not very familiar with WordPress), from the user insertion till the extraction of the data via report there are this steps:

    WordPress--->Validates data; and introduces it automatically in a DB? (Maybe I should use PHP for this), then the data is extracted from the DB and added to the report. Maybe this should use the MVC pattern?

    Maybe using the validate plugin of Word Press, once the data has been validated then include them in a record. Every record is a user CV and then a CV .doc is automatically generated using Birt for example.

    Usually I would do this using MVC and Java then doubt is when introducing WordPress.

    Any idea, please?
     
    chris webster
    Bartender
    Posts: 2407
    36
    Linux Oracle Postgres Database Python Scala
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I don't understand why you are mixing Wordpress and Java into the same application.

    If you want to use Wordpress, use the Wordpress APIs and plugins to do whatever it is you are trying to do. This means using PHP because Wordpress is a PHP framework. It doesn't use Java.

    If you want to use a Java MVC application, you don't need Wordpress.

    It's possible you could add functionality in your Wordpress forms to forward your incoming data to a remote Java application. But you'd need to investigate the Wordpress tools for doing this kind of thing.

    Tip: Just because you know Java, doesn't mean you have to use it everywhere: check out the Golden Hammer anti-pattern.


    From XKCD
     
    Isaac Ferguson
    Ranch Hand
    Posts: 1063
    3
    Java Netbeans IDE Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ok then PHP and WordPress, not Java in between.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!