PDA

View Full Version : Struts2 Ext-js basic question: linking .css and .js files



Kafir
7 Feb 2010, 12:46 PM
Hi all,
I am new to Ext-JS. I've been practicing Ext-JS lately. Today, I tried it with struts2 and I was unable to configure basic stuffs and any help on this matter is appreciated.

I have the following file structure set up for struts2

war
WEB-INF ->lib folder, classes folder and web.xml
views (contains html, jsp pages)
css (css pages)
extjsinwar (contains whole 39mb of extjs) -> resources etc folders and files

my questions are

1. how exactly do you put the extjs libraries? I am sure you are not going to load 39mb of libraries

2. the links from the html pages are following

<link rel="stylesheet" type="text/css" href="/extjsinwar/resources/css/ext-all.css" />
<script type="text/javascript" src="/extjsinwar/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/extjsinwar/ext-all-debug.js"></script>

how?

Kafir
7 Feb 2010, 1:08 PM
Okay, figured out the #2 part
In struts2, it should be

<link rel="stylesheet" type="text/css" href="<s:url value='/extjs/resources/css/ext-all.css' />"/>
<script type="text/javascript" src="<s:url value='/extjs/adapter/ext/ext-base.js' />"></script>
<script type="text/javascript" src="<s:url value='/extjs/ext-all-debug.js' />"></script>

Still wondering about the question 1. :S

jjulian
7 Feb 2010, 1:22 PM
You only need those 2 js files, that 1 css file, and the /resources directory. The rest you do not need to package in your war.

Kafir
7 Feb 2010, 1:24 PM
You only need those 2 js files, that 1 css file, and the /resources directory. The rest you do not need to package in your war.

Thanks Julian.