• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to include / or do we need to include 3rd party bootstrap dependency in pom.xml ?

 
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear expert,

I run my project and found that the Index.jsp which is the Welcome file did not give me the bootstrap layout as before.

It led me to wonder if I should include bootstrap dependency in pom.xml ?

And the thing is that should I use the jar from  http://www.webjars.org/ ? Or can I use my third party bootstrap template ?

I am quite confused and hope someone can tell me the correct way to do thing.

Tks.
Staff note (Knute Snortum) :

I now believe that the Maven issue was a red herring. I think this is a JSP configuration issue.

 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using Maven, then optimally, all dependencies should be in the POM file.  

Looking at the WebJars site, it says that all its jar files are in the Maven Central Repository, which is the default repository for Maven, so you should be able to add a dependency.

Pick the version number here.
 
tangara goh
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:If you're using Maven, then optimally, all dependencies should be in the POM file.  

Looking at the WebJars site, it says that all its jar files are in the Maven Central Repository, which is the default repository for Maven, so you should be able to add a dependency.

Pick the version number here.



Hi Knute,

The thing is that I am using a third party bootstrap template  - startbootstrap-modern-business-gh-pages, which I downloaded and I changed the folder name to Bootstrap which I put under Web Content as shown in the picture I attached.

And now when I run my jsp form, it is not showing the layout as before that was working perfectly.  I guess I have changed and tweaked here and there that I now ended in this state.

Please help me to put things right again.

How should I indicate this kind of dependencies in my pom.xml cos I have been searching over the internet but can't find anything that is in my situation.

picture-of-where-my-bootstrap-template-stuff-resides.png
[Thumbnail for picture-of-where-my-bootstrap-template-stuff-resides.png]
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure why bootstrap would have a scope of "provided".  Try the default scope, which is "compile".
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The thing is that I am using a third party bootstrap template  - startbootstrap-modern-business-gh-pages, which I downloaded and I changed the folder name to Bootstrap which I put under Web Content as shown in the picture I attached.  


Is this third party template a replacement for bootstrap, or something that sits on top of the webjars bootstrap?
 
tangara goh
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Knute,

The 3rd party template is included in a folder that sits below the WebContent, and inside the folder which I named Bootstrap, it's got :

css, font-awesome and font.

And one of my jsp page where I wanted the jsp to read the bootstrap library, I do it like this :



So, how do I do the dependency in pom.xml ?

 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I run my project and found that the Index.jsp which is the Welcome file did not give me the bootstrap layout as before.


Okay, you're going to have to TellTheDetails (that's a link) about exactly what is the problem.  What kind of project is this, exactly?  How are you running the project?  Through Maven or an IDE or from the command line?  When you say "the Welcome file did not give me the bootstrap layout as before", do you mean the Welcome page is not formatted with the files provided in bootstrap?  What changed from when it was working?

Now, Maven does not "configure" your project, in the sense that it helps your project to find where CSS and other layout files are.  So you don't need a dependency in your POM to get your project configured correctly.

CSS files are often put a src/main/webapp/resources directory and Maven can help by moving them into a jar or war file for you.  I will look into that more for you -- but you should too!
 
tangara goh
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:

I run my project and found that the Index.jsp which is the Welcome file did not give me the bootstrap layout as before.


Okay, you're going to have to TellTheDetails (that's a link) about exactly what is the problem.  What kind of project is this, exactly?  How are you running the project?  Through Maven or an IDE or from the command line?  When you say "the Welcome file did not give me the bootstrap layout as before", do you mean the Welcome page is not formatted with the files provided in bootstrap?  What changed from when it was working?

Now, Maven does not "configure" your project, in the sense that it helps your project to find where CSS and other layout files are.  So you don't need a dependency in your POM to get your project configured correctly.

CSS files are often put a src/main/webapp/resources directory and Maven can help by moving them into a jar or war file for you.  I will look into that more for you -- but you should too!



Hi Knute,

I am running my project using Eclipse EE Mars version.

My directory schema in my webapp project is
Deployment Descriptor
JAX-WS Web Service
Java Resources
JavaScript Resources
Deployed Resources -
                              BootStrap which contains css
                              Image
                              META-INF
                              WEB-INF -
                                                   Index.jsp
                                                   etc etc jsp

Sorry about my bad English re this line :
When you say "the Welcome file did not give me the bootstrap layout as before", do you mean the Welcome page is not formatted with the files provided in bootstrap?

Previously, all the jsp files were able to rendered the layouts as per the downloaded template that comes with the css.  Now, it ain't working as before

What could have gone wrong ?
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What URL are you using to access the website?
It can't be index.jsp because that is hidden under your WEB-INF folder

You are using relative URLs to import the css from the Bootstrap stuff


Because the URL is relative to the page you are looking at, it might not find the file.
Try using the Dev Tools (F12 in the browser) to see if the file is actually resolved correctly.

This will work if your URL is
http://localhost:8080/myWebApp/myStartPage.  
It would look for http://localhost:8080/myWebApp/BootStrap/css/bootstrap.min.css and find it.    

but not for
http://localhost:8080/myWebApp/intro/myStartPage
It would look for http://localhost:8080/myWebApp/intro/BootStrap/css/bootstrap.min.css and not find it.    


Suggestion:



This changes the link from being relative to your page to being absolute within your webapp, and should resolve it successfully.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic