I'm working with struts2.
An external app calls to my app with url
http://localhost:8080/present/jsp/mi.action?cod=02021
But because of my JSP file system, my action result is in
http://localhost:8080/present/jsp/ALTE/mi.action?cod=02021
(note the difference in ALTE).
The JSP has some lines as
<%# include file="../comuns/comunCssyJs.jsp"%>
The first ../ is to go out ALTE.
If I access with first link the page is loaded but no include files are found. However, with second link there is no problem.
Does someone know what can I do? I know I can change my JSP-s dir-s, but I'd prefer to "add automatically" the ALTE path to the url. is that possible?
Thanks in advance.
Jon
Use Struts2 <s:include> tag http://struts.apache.org/2.x/docs/include.html with <s:url> tag http://struts.apache.org/2.x/docs/url.html.
Related
If I were to put
Replace this
where does this link go to? I am using eldarion-ajax and the examples all use this link location.
Does this link to replace.html?
the div with id #replace
It probably just goes to the url "replace". like if you're at www.website.com/index.html it would go to www.website.com/replace. It's probably just a placeholder indicating you should replace it with another value.
Web URLs do not need to end in .html or such.
i have the joomla TPL file, its has hyper link with
{$ROOT_HOST}/&liststyle=grid
i need to replace the {$ROOT_HOST} with the current URL and its full parameters to include the grid style tab # to the end of the current url. this is done in tpl file.
SO can any one tell me if there is a possibilty to include the #grid to the Current page url(parameter)
I tried {$CURRENT_URI} but didnt work still getting the main host url!.
please help :)
you should be using JURI like MasterAM stated http://docs.joomla.org/JURI/current
I have my my app url: 127.0.0.1:8080/reader/read.xhtml
The read.xhtml is populated thorough database and has got various
links which are hard coded in database. (read.xhtml is actually
retrieved as String from DB.) for e.g. there are links
(<a href ="/write.xhtml>write</a>)
/write.xhtml
/upload.xhtml
as I cannot add the context when i click the link it directs me to
WWW://127.0.0.1:8080/write.xhtml or
HTTP://127.0.0.1:8080/upload.xhtml
Is there any way I can redirect the link to
HTTP://127.0.0.1:8080/reader/write.xhtml.
Can Prettyfaces handle this. If yes how?
You can simply add the context path to the links by rendering it in front of your links. Something like:
write
I have a Struts2 app and I'm having a bit of a problem:
at the first page (index.jsp) I have a javascript line that sets the url to './admin/Search' like this:
window.location='./admin/Search';
that sends me to the login page and if I have access it will redirect me directly to the mentioned page. The problem is that, after that, all my actions keep this first namespace '/admin'. Other actions just do not have this '/admin' namespace, for example, they could have a '/users' namespace. In this cases the server can't locate the right action because it will look for /admin/myAction in the struts.xml file. It's like struts 2 doesn't change the whole namespace/action. It just replaces the action and that's it. I really need help on this guys! Thanks.
You need to change the package namespace specified in the in struts.xml files. That will help you redirect your namespace inside your application.
The
<g:link controller="foo" action="bar">foobar</g:link>
tag sometimes works, that is is renders as
foobar
and sometimes it doesn't. In this case I'll get a
foobar
Does anyone know what conditions cause this tag to fail to expand? Also is there any way to debug the tag expansion logic?
To debug - the file you need is at
$GRAILS_HOME\src\java\org\codehaus\groovy\grails\plugins\web\taglib\ApplicationTagLib.groovy
This might not solve your problem or everyone else's, but I had this same problem occur for me. I had a /mywebapp/session/login URL that I wanted to link to, but <g:link controller="session" action="login"> just resolved to /mywebapp/.
But it turns out that I had mapped my context root "/" to show the login page. I had thought it would redirect, but really it exposed the Session.login page at "/". So, when grails was told to create a link to go to Session.login, the simplest link it could come up with that would take me there was "/". So "/" was correct after all.
If you still can't get it working, but you still need a way to generate links relative to your context root, you can use <a href="${createLink(uri: '/foo/bar')}">
Only one remark which may be useful:
If you are in a file .gsp into the folder:
view
controller_name
your_view.gsp
This works fine: >> <a href="${createLink(uri: '/foo/bar')}">
If you are in a file .gsp into the src/template (for example to modify the list.gsp, create.gsp, etc.):
You have to add a backslash like this:<a href="\${createLink(uri: '/foo/bar')}">