Errors reporting on JSP using Struts tags - struts

I have created a small login application using struts and ibatis. Everything is working fine.
Validation errors are shown using in my JSP page.
<html:errors> tag shows all errors at one place in a group.
I want to show errors in front of each html element associated with the particular error.
Is there any tag like <html:error name="username" />
Please advise

Both the <html:errors> tag and the <html:messages> tag do that (in a different way). Read their documentation

Related

Aurelia tutorial stuck building out contact list

I'm an experienced WPF developer, but new to web development.
I'm stuck at point where you replace the Contact List Placeholder
with the contact-list custom element.
When I run it the web page still shows the placeholder text instead of the contact list. I assumed this was a cache issue, but I've tried everything I can think of to clear the cache. I have also tried deleting the app.html and running the site to see what kind of error I'd get, but still I get the template with Contact List Placeholder. I've tried reverting to the original tag and changing the inner text, and I still get "Contact List Placeholder".

How to render a jade block(section) using links?

I was hoping someone had any insight on this basic approach. Sample scenario:
I have a dashboard template with menu links a(href "/page") and I want to click the links to render a different section/view on the template. I used block content...but does it need a specific route?
If I understand correctly, you want to update the content of the page on click of the link without the page getting refreshed.
In that case, no you can't do it using block content.
The purpose of block content is to apply inheritance in your templates.
The typical use of block content would be creating a layout and then creating more specific page from the layout. This is what the official documentation says.
The reason why you cannot do it because, jade is server side templating library. This resolves the block content on server. Once rendered in client, the html looses all the information that was specific to jade (which is obvious because its an html afterall).
What you can do here is
Create a /page.jade and make a ajax call to a service. That service should return an already compiled html string. Since you are using jade, you can easily use jade.compile(source, options) to template / generate html.
Jade API documentation here

ADF Essentials in Glassfish: AUTOSUBMIT and VALUECHANGELISTENER attribute makes a message appear in the Web Browser

I have a ADF project in Jdeveloper 11.1.2.4.0, one of my pages contains this:
<af:selectOneChoice label="HEllO" value="#{bean.data}" id="id1" autoSubmit="true" valueChangeListener="#{bean.createNewData}">
<f:selectItems value="#{data.list}" id="id2"/>
</af:selectOneChoice>
I deployed it to Weblogic and everything worked fine.
Then I deployed it to Glassfish using the ADF Essential libraries. And it seems to work fine, but there is a unsuspected behavior at any place where there is a attribute AUTOSUBMIT. Everytime the value of the component containing the AUTOSUBMIT="true" is changed I have this behavior...
Firefox: A message saying: "To display this page, Firefox must send
information that will repeat any acction..."
IE: A message saying: "To display the webpage again, the web browser needs to resend the information you've previously submitted.."
Chrome: It redirects to the back page.
Opera: It redirects to the back page.
EDIT: The same happen when I have PARTIALSUBMIT set to true. I realized that I have to have the valueChangeListener attribute in order to get message.
Autosubmit=true will make (by default) your page to resubmit entirely. You should use partial triggers to avoid this. Set the ID of this component to the 'partial Triggers' attribute of the component you want to refresh (form,table, etc.). You should set 'partialSubmit=true' to your first component.

Page not displayed on my website

I'm trying to put together my website but I'm experiencing a very weird behaviour. I have an html resource named y6.html in my www directory in the root directory of the website. It worked very fined until yesterday when suddenly when accessing it it sends me a void webpage with an empty head and an empty body (not a 404).
Also I realized after one point that I would change the css on the website but that the changes I made would be on the ftp server at the right place but the website would still display the old version I had not modified even after emptying the cache.
The page is : http://www.dronecontrast.com/y6.html
Any clue on what's causing this?
Thanks
This is an HTML error. Your <title> is not closed as usual. You must use </title> to close it.
</title> is missing. Add the slash and try again
Just looking through the page source of that web page, you have made an error with the title tag. On your closing tag you have missed your "/". Put that in and see if it works
Your HTML markup is wrong. Please check nesting of title,head and body inside your html tag. Please consider using a text editor like Notepad++ / Sublime Text and check whether the tags are closed and nested properly.
In your markup Title tag should be closed.

Keeping DRY with progressive enhancement

I'm building a website with very small amounts of Javascript, just to add things to the page (like a contact form) without having to go to a new page.
I understand that I should build the contact page anyways (just in case the user doesn't have javascript turned on) and then use javascript if they've got it.
So where do I store the HTML for the form if I don't want to have it in two places?
(Normally I'm not so picky, but I'm curious on this one.)
If you have access to a server-side language, you can keep a separate snippet of the form in an external page. Then, you can include the snippet into the HTML content page with an appropriate include call. This has the added benefit that, for your JavaScript, you can pull the contact form from this snippet file using AJAX. In fact, many plugins allow you to display DHTML windows with HTML content. For example, check out ThickBox.
Without a server-side language, you can do something similar with frames. Just display the form snippet in a frame when you need to reference it. Personally, I don't like frames very much, so this isn't a very attractive solution for me, but you can use it if you choose (and style the frames appropriately).
Just put your HTML for the contact form in a .html file. Assuming you're using PHP or something, just include the file in your contact page and include it in the section for your dynamic contact form. The form should still submit to the same server-side page and have the same look and feel..
e.g. contactForm.html
<div class="contact-form">
<input ....>
</div>