English 中文(简体)
Struts2 - Linking to external URL on JSP * und* local context path?
原标题:Struts2 - Linking to external URL on JSP *excluding* local context path?

Using Struts2, I compute a link in my java code and expose the link s string in a getter for the JSP page. I try to link to this external link using <a href= <s:property value="mylink" /> >a Link</a>. Sadly, Struts always puts the local context before this link, so the resulting link looks like <a href="http://localhost:8080/Mycontext/https://twitter.com/some?more=param&ete=rs">a Link</a>.

Note: I also tried using <s:a> and <s:url> with includeContext="false" ... same result. What s wrong here?

最佳回答

Struts always puts the local context before this link

uh? If you really write a plain <a ... > element

<a href= <s:property value="mylink" /> >a Link</a>

在您的jsp中,Steuts2将添加任何内容,Stuts2甚至不知道有这种联系,property tag不过是一般的echo the Value of this property”。 可以通过复制同一标签<代码><s:property Value=“mylink”/>在A项内容之外进行核对。 要么你计算出财产在你的行动中是错误的,要么要么你写不出碎片,而是使用一些与链接有关的Stuts2标签(<s:a><s:url>)。

BTW, if you want to place an external link, unrelated to your application, the first option (a plain A element, not a Struts2 link tag) seems the right way.

问题回答

暂无回答




相关问题
Tomcat´s server.xml dynamic configuration

My web application uses the same database configuration as the application XYZ. I have a resource declaration for a context in server.xml, so I have a duplicated configuration (once for web ...

session transfer issue from Tomcat to ASP.Net

I am using Tomcat to host JSP and using IIS 7.0 to host aspx (C# + .Net 3.5 + VSTS 2008), and I have some session transfer issue from JSP page to ASPX page. JSP page is in one domain and all other ...

JSP exception - class not found (tomcat)

I m setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root ...

热门标签