im planning to do something using bootstrap, where i will split the .jsp in 2 divs, the top one is the menubar.jsp and the other is the contentclicked eg:
start.jsp
<div id="menubar"></div>
<div id="content"></div>
when the users get access(after a login) and go to the http://www.localhost.com/restrict/start
it will run this .js
$(document).ready(function(){
$("#menubar").load("restrict/menubar");
});
the /restrict/menubar is because i have a file called menu.jsp that have the bootstrap code of the menubar
and for each link that the client click in the menubar it will do:
$("#content").load("restrict/linkCliked");
and for each link i will have a linkCliked.jsp
it seems to work, BUT i dont know if this is a good way and secure, because if the use write the uri http://www.localhost.com/restrict/linkCliked, he will get just the linkClicked.jsp, but i want it to render the menubar.jsp too without, is there any solution that i dont have to "include" in each .jsp the menubar?
obs: using VRaptor MVC
Your system seems OK. If you are concerned about the HTML URI being pointed to incorrectly, you can keep your templates in a separate folder than your bootstrap. If your setup is like so:
/var
/var/www
/var/www/html <- your web
You can add a new folder:
/var/www/template
And put linkClicked.jsp and menubar.jsp into that folder, calling them. A user will not be able to type in an address to get to those paths and you won't need to do any funky redirection in your server configuration either.
Related
Currently, I have an html file which has a basic layout of a login page which has an option for new users to sign up if they're not a member.
I have the following line inside of my html :
Join Us!
What I want to have happen is load up a new HTML page which will be a modal (using twitter bootstrap) that will ask the user to input the correct data to create a login/pass combination.
But this isn't working. It keeps doing the following (doesn't do anything) :
http://localhost:3000/register.html
I'm a little confused whether my HTML is wrong or MeteorJS requires some sort of specific way to do something like this.
You can use a relative url: Example: register.html only
If your file is into the same project, you don't need to put him an url absolute.
Put your register.html file in your project's /public directory and you will be able to access it via /register.html. However that page will run outside your Meteor app and won't have any Meteor functionality per se.
The /public folder maps to / and is normally used for images and other client-side assets. It's common to map /public/images to /images for example.
I made a website with Twitter bootstrap and the design is finished in terms of all the HTML and CSS.
Now I need to add functions like making an account and blogging. I decided to use Ruby on Rails to do this, but I have no idea where to put the files and how to connect them.
So far I have figured out that I want to put them in the "views" folder and have it say, for example, "index.html.erb" but I don't know if that goes into another folder in "views" or how any of that works.
I also don't know where to put all the CSS and JavaScript incorporated with bootstrap.
Following Rails conventions, views should go in a dir that mirrors the model name (plural), which also aligns with the controller name. i.e. model = user, views dir = users, controller = users_controller.rb. You should read through at least the first few Rails guides; esp this layout and rendering one:
RE the bootstrap portion of this question, just use the bootstrap-sass gem and follow the instructions for including it in your application.scss and application.js.
When we launch a website, we usually see webpage name (menu.php or admin.aspx) but I would like to hide that name and show only virtual path or just website name. I don't want it for the first page because I did that with default.aspx but I want to implement it for the whole website.
Showing www.abcd.com/faq/ instead of www.abcd.com/faq/faq.html
Note: My code is not MVC code and server is Apache.
Use .htaccess to rewrite the URL. Millions of tutorials are out there for that ;)
What you are asking is achieved using (for xampp, wamp, lamp or any other apache powered webserver setup) htaccess rewriterules. The rules take the URL and break it into parts that can be modified or used as variables to feed other pages - whilst still keeping the URL you typed. Neat huh!
Showing www.abcd.com/faq/ instead of www.abcd.com/faq/faq.html
call the file placed into the folder faq simply index.html (not faq.html) and then www.abcd.com/faq/
will display the page without the filename. (Make sure, you have defined index.html as a valid Directory index.)
There are more options with using mod_rewrite etc - but since you seem to use a prety static directory based navigation layout, that would be the easiest way.
Ok, so the title tells very little of my issue.
Basically, I have a project written in node that does something. It's a website that uses express, jade and stylus. I have set up the routing for static content like this:
app.use(express.static('public'));
The website works fine and all the CSS loads properly if, in the HTML, I reference it like this (for example):
link(rel="stylesheet", href="global.css")
As expected, when I hover over the link in Chrome's element viewer, the URL is localhost/global.css
So now I've got a couple of these little project and I want to put them all together. They aren't related but I'd like to put them all on my website. For this I have made a new project that server like a hub for the other ones.
In it, I've setup routing like this:
var proj = require("../proj/server.js");
app.use("/proj ", proj);
and in each of the projects I have set the modules exports like this module.exports = app where app is their respective express app object.
This also worked like a charm. I didn't have to run a separate server instance on a separate port for each project. Instead, you can access them like localhost/proj/
Now here's where the issue starts. The CSS that is referenced in the generated HTML of each project doesn't point to localhost/proj/global.css. Instead it still points to localhost/global.css. And since there's no global.css in the public folder of my hub application, it doesn't find it.
I could, of course, just change the relative URLs to proj/global.css instead of just global.css and this does work, but it means that I need to modify all of my projects. It also means that I have one more string to change should I decide to change their names.
Besides, the URL already shows localhost/proj, so why can't it just be automatically implied that when I reference global.css it should be looked for in localhost/proj/global.css?
I'm sure there's some easy trick I'm missing. Maybe my relative URLs should have some extra stuff that says it refers to the current URL?
Edit:
It actually seems that the relative URLs work, but only if the address in the address bar is localhost/proj/. If it's localhost/proj it doesn't. What can I do to force that last slash?
I don't know if it can help you, but in express, you can define several "public" directories
router.use(express.static(path.resolve(__dirname, 'client')));
router.use(express.static(path.resolve(__dirname, 'public')));
router.use(express.static(path.resolve(__dirname, 'foo')));
I finished my Ruby on Rails project and I get extra credit for making it "look good." I made an HTML template with some images and css styling on my local machine (not the RoR server). I've tested it out in plain HTML and it looks good.
I can't figure out how to incorporate it into my RoR project though. I thought i'd be able to create a directory in my views, called "images" to hold the images for my template.
Before transferring all of the code for my RoR to the tags for my template, I wanted to make sure the images were in the right location. I added to my index.html.erb file, but it won't display. I tried moving that images directory to a few other directories and tried again, same thing!
I thought it would be easy to incorporate a template haha but now I'm thinking not?
Is there a way to simply do this like an ordinary HTML website?
There are two main options for this...
You can use the asset pipeline and serve up assets from a location like app/assets... So, app/assets/images.
You can put them in public/images and just serve them up that way as well.
If you feel like learning a bit more, I'd dig into the asset pipeline. If you're just ready to be done, public/images for a small project should work just fine. :)