How to display PDF on the HTML page - java

I have migrated my application from wicket 1.x to wicket 8.x and now facing an error to display PDF on iframe. It is showing as blank on the iframe.
I am trying to display PDF in the iframe tag in the HTML on page load but it is showing as blank.
Share the detailed code below path:
https://github.com/smartuadk/Shared_Repo_StackOverflow/tree/main/PDF_Preview

Please add below http security header tag in Spring security module xml file to allow Spring security to display the HTML iframe in spring application:
<security:http use-expressions="false">
<security:headers>
<security:frame-options disabled="true"></security:frame-options>
</security:headers>
</security:http>
This solution worked for me and now my application is able to display the iFrame without any error and able to load PDF file in iFrame as well.

Related

Creating html page in Spring Tool Suit 4

While right clicking on template under src/main/resources I have clicked on New and then on Others. In select a wizard dialogbox when i am searching html i am not getting it in the options available below.
What should now be done to create html page in Spring boot.
I am not getting how to proceed.

JSP file not using CSS because of web.xml

I've had this simple jsp log-in form that used the css style sheet. It was working just fine until I included the web.xml file in my directory. Now the JSP file won't load the css files no matter what. I've tried changing the link address of the css in multiple different ways but with no luck.
I'm pretty positive that the web.xml file is the reason it's not loading because if I remove it, everything works again.
Here's my project structure:
Here's my login.jsp:
here's my web.xml:
Your web.xml includes /* in a security constraint, limiting access to all content of your application to those users with the role users. This means that, instead of serving your CSS file as requested to the browser, tomcat will redirect to the login.jsp as well (which is obviously an incorrect and not very stylish stylesheet)

Jquery and css files are overwritten with html code when deploying on glassfish 4.0

I have an EJB with servlet project and JSP as front end pages.
I'm trying to deploy the project on a glassfish 4.0 server. Everything worked fine until now, when all my jquery and css files are overwritten with html of the current jsp page. I have no idea what is happening.
All the jquery and css files look ok in project folders.
See bellow print screen.
Anyone encountered this wired behaviour??
Overwritten jquery
Overwritten CSS

Get current page apache tiles within jsp

I have spring mvc application using apache tiles.Main file is template.jsp which includes header.jsp, then got place for potential messages and footer.jsp included.
Is there a way to check within jsp page ( using JSTL ) on which page I'm inside header.jsp code ?
Normal way of getting page URL are not good because
${pageContext.request.servletPath}
Always get's me the page I supposed to be so , template:
/WEB-INF/tiles/template.jsp
Is there a way to do it somehow , without adding anything to model from within spring?
(Because this is one of way to do this )
You can access the page URL (as it would appear in the browser) using the following EL in your JSP:
${requestScope['javax.servlet.forward.request_uri']}

How to use iframe in liferay portlet?

Currently I am working on liferay 6.0
In my project I need to show a page in iframe. I have added iframe in my jsf page. When user request that jsf page whole page works fine but that iframe doesnt show respective page. Except that it shows that page not found and in console side gives message Current URL generates exception:null.
Please somedbody tell me how can I use iframe in portlet.
You should set the URL of the desired JSF page as the src of the iframe, and set the iframe as the content of the portlet.

Categories